Note: This guide is intended to be for opHA 3, opEvents 3 and NMIS 9. The tool is available for previous versions, but the syntax and some parameters can change.
In order to integrate the poller events into the primary server on an opHA environment, we can make use of the create_remote_event tool and create some event actions rules to send the poller events the the primary server:
"opevents_primary" : { "exec" : [ "/usr/local/omk/bin/create_remote_event.pl", "-s", "http://PRIMARY-URL.opmantek.net/omk", "-u", "USERNAME", "-p", "PASSWORD", "authority='poller nine Poller'" ], "arguments" : [ "location=http://PRIMARY-URL.opmantek.com/en/omk/opEvents/events/event._id/event_context", "node=node.name", "event=event.event", "details=event.details", "time=event.time", "date=event.date", "element=event.element", "interface_description=event.interface_description", "type=event.type", "priority=event.priority", "level=event.level", "nodeType=node.nodeType", "state=event.state", "stateful=event.stateful" ], "output" : "save", "stderr" : "save", "exitcode" : "save" } |
Please note, you can edit the event information that you want to send.
"100" : { "IF" : "event.priority >= 1", "THEN" : "script.opevents_primary()", "BREAK" : "true" } |
Please note, you can edit the condition and send just the events that you want.
/usr/local/omk/bin/create_remote_event.pl -s http://primary.opmantek.net/omk -u nmis -p password authority='poller nine Poller' location=http://primary.opmantek.com/en/omk/opEvents/events/600161b500eff2351645be2c/event_context host= event="Node Configuration Change" details="Changed at 140 days 1:00:55" node="bnelab-rr1" time=1610703283 date= element= interface_description= type=nmis_eventlog priority=3 level=Warning nodeType= state= stateful= 60016d06891ad2506c49ad72 |
The raw exit code should be 0:
[Mon Jan 18 07:31:50 2021] [info] worker.action[6595] 6005396300eff20fc35d55eb method='opevents_primary' got raw exitcode=0 from pid=6602 exec=['/usr/local/omk/bin/create_remote_event.pl','-s','http://primary.opmantek.net/omk','-u','nmis','-p','password','authority=\'poller nine Poller\'','location=http://primary.opmantek.com/en/omk/opEvents/events/6005396300eff20fc35d55eb/event_context','node=rbogon344','event=Node Configuration Change','details=Changed at 142 days 23:00:55','time=1610955103','date=','element=','interface_description=','type=nmis_eventlog','priority=3','level=Warning','nodeType=','state=','stateful='] |
When an event is acknowledged, opEvents stops the propagation. That means, that all the rules are not going to run anymore. There are different approaches to achieve this, but is a common schema to set up opevents_auto_acknowledge_up to false in the poller, so the event is not acknowledge and can be sent to the primary.
More information: https://community.opmantek.com/pages/viewpage.action?pageId=27264053#EventActionsandEscalation(opEvents3)-ActionPolicyApplicationandTiming
Forwarded events may arrive out of order to the primary server, because of network congestion or slow action processing.
To enable reorder protection, two steps need to be taken:
state_reorder_window
to a positive number (e.g. 30) on the receiving server.authority
property, to denote the event as originating from a remote authoritative source.More information: Deduplication and storm control in opEvents#StatefulDeduplication,ForwardedEventsandReorderProtectionreorder_protection