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 "<html><body><p style=font-family:Verdana;font-size:12px;font-style:normal;font-weight:normal;><b>HP Open View NNM Alarm Incident Report</b><br /><br />||<b>Date:</b> %date% %time% ($fot)<br />|<b>Alarm:</b> UPS on battery - power failure($name)<br />|<b>Node:</b> $snn($sln)<br />|<b>IP:</b> $mga ($oma)<br />|<b>Contact:</b> $sct<br />|<b>Location:</b> $slc<br /><br />|<b>Notes:</b> generated by HP Open View NNM 9i management server.<br /></p>|</body></html>"
The command line above will utilize blat to send an HTML formatted email message to alert@acme.org with a copy to helpdesk@acme.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.
Cheers!