## ## Example ALARM Script ## It generates a trap/notification as defined in the AGENTPP-MIBEXPLORER-MIB ## based on a monitor alarm using the "alarm" context provided by the monitor tool. ## ## You should replace the below PDU path with an absolute path if you want to use ## this script in production. ## ## This script cannot be used outside a monitor alarm configuration! ## ## The construct "#set( $noecho = )" is used to suppress the echo ## of a newline in the output. alone would echo the return value ## of (if any) and a then a newline to the output buffer. ## ## ------------------------------------------------------------------------------ ## ## Loading the agentppExplAlarm notification PDU as defined in the ## AGENTPP-MIBEXPLORER-MIB (see mibs/agent++ in the installation directory) ## #if (!$snmp.setRequestPdu("agentppExplAlarm.pdu")) Could not load "agentppExplAlarm.pdu" file, aborting alarm script.$utils.stop() #end #set ($vbs = $snmp.requestPdu.variables ) ## ## Setting notification ID ## #set($NOID = "1.3.6.1.4.1.4976.3.2.2.0.$alarm.getAlarmSeverity().toString()") #set( $noecho = $vbs.get(1).setValue($NOID) ) ## ## Setting alarm payload ## #set( $noecho = $vbs.get(2).setValue($alarm.alarmValue) ) #if (!$alarm.isTransient()) #if ($alarm.isRaised()) #set( $noecho = $vbs.get(3).setValue("2") ) #else #set( $noecho = $vbs.get(3).setValue("3") ) #end #end #set( $noecho = $vbs.get(4).setValue($alarm.monitorName) ) #set( $noecho = $alarm.setCurrentTargetToSource() ) #set( $noecho = $vbs.get(5).setValue($snmp.getCurrentTarget()) ) #set( $noecho = $alarm.setCurrentTargetToAlarmTarget() ) #set( $noecho = $snmp.setRequestType("TRAP") ) #set( $status = $snmp.send() ) #if( $status == 0 ) Alarm sent successfully! #else Alarm no sent: $status #end