From OpenNMS
I wanted passive services that would alert if they had not been updated in awhile. This was to replace nagios passive checks. I didn't see anywhere talking about doing this so here is a brief run down of what I did in case anyone else is wondering. I created passive nodes and services as described in this doc. For me that involved.
- Adding services with a command like psql -U opennms -c "insert into service values (nextval('serviceNxtId'), 'ServiceName');"
- Using the gui provision groups tool to build up a node with services.
- Edited the poller-configuration.xml to add a service and monitor line.
- Setup a snmp trap.
- Setup the event translator to convert my snmp trap to a passive status event.
- Setup my remote end to use the snmptrap command.
Then I followed http://www.opennms.org/index.php/Automations and setup a automation. The automation used a trigger and action-event. The hard part of this for me was the trigger and maybe it can be done cleaner. Here is the config I used
<automation name="db_backup" interval="300000" active="true"
trigger-name="db_backup_Trigger"
action-name="doNothingAction"
action-event="createPassiveStatusEventDown" />
<trigger name="db_backup_Trigger" operator=">=" row-count="1" >
<statement>
SELECT 'Backup_Jobs' as _node, 'db_backup' as _service, 2 as _nodeid
FROM events
WHERE (SELECT eventid
FROM events
WHERE eventuei = 'uei of my custom trap'
AND eventparms like '%db_backup%'
AND eventtime > now() - interval '26 hours' limit 1) IS NULL
limit 1;
</statement>
</trigger>
<action-event name="createPassiveStatusEventDown" for-each-result="true">
<assignment type="field" name="uei" value="uei.opennms.org/services/passiveServiceStatus" />
<assignment type="parameter" name="passiveIpAddr" value="1.1.1.1" />
<assignment type="parameter" name="passiveStatus" value="down" />
<assignment type="parameter" name="passiveServiceName" value="${_service}" />
<assignment type="parameter" name="passiveNodeLabel" value="${_node}" />
<assignment type="field" name="interface" value="1.1.1.1" />
<assignment type="field" name="nodeid" value="${_nodeid}" />
<assignment type="field" name="service" value="${_service}" />
<assignment type="field" name="descr" value="Exceeded maximum time between successful notifications." />
</action-event>






