I thought I would share command line (action I )came up with for having HP Open View NNM send email notifications based on the various SNMP traps received by the management station.
blat.exe -server smtp.acme.org -to Alert@acme.org -cc HelpDesk@acme.org -html -subject "HPOV: UPS on battery ($snn)" -body "
HP Open View NNM Alarm Incident Report|"
||Date: %date% %time% ($fot)
|Alarm: UPS on battery - power failure($name)
|IP: $mga ($oma)
|Notes: generated by HP Open View NNM 9i management server.
The command line above will utilize blat to send an HTML formatted email message to email@example.com with a copy to firstname.lastname@example.org with the body looking something similar to the figure to the figure to the right. I’ve sanitized the screenshot to protect the organization I’m currently employed with. The example above is for the SNMP trap ‘upsOnBattery’ while the image to the right is an example of the SNMP trap ‘powerRestored’. You’ll notice the | in the command line is interpreted as a CR/LF by NNM. Here are some of the parameters used in the above example;
- $ssn – node name of the object sending the SNMP trap
- $fot – first occurence time
- $name – OID name of the trap received
- $sln – DNS name of the node
- $mga – management IP address
- $oma – alternative management IP address
- $sct – contact information for the object as stored in sysContact.0
- $slc – location information for the object as stored in sysLocation.0
While it wasn’t too hard it did take some time to get all the formatting down and get it working reliably.