All,
I've written an email integration between NPM 10.1 and my Service Management System (HP Service Manager 7.11) that allows me to open/close incidents. One of the issues I had to overcome was a way to deal with the unidirectional nature of an email integration into the service management system. Typically with a two way integration the service management system would pass back the incident ID to the source system so that it could reference it in any further updates sent to the service management system. So, to overcome that I created a unique "Alert ID" that gets written into the incident so that any other updates that reference the same Alert ID are considered to be linked to the incident that was originally opened against that Alert ID. For my integration I chose to utilize a combination of the Object ID of the affected Node, Alert ID of the alert that fired, and the Alert Trigger time. The Object ID and Alert ID are strictly numeric with the latter having a few dashes, whereas the trigger time was in a a human readable format that really didn't fit. So my dilemma was how to change that trigger time into a unix style timestamp. After a little research using the infamous Internet Google machine, I pieced together the following solution to use in the alert action.
${SQL:SELECT DATEDIFF(ss,'19700101','${AlertTriggerTime}')}
This leverages the datediff function of the underlying SQL server to calculate the epoch from the trigger time.
Anyway, I just wanted to share should anyone else be looking to accomplish the same thing. Hope someone finds this helpful.
Mike