...
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 .pl tool.
Code Block | ||
---|---|---|
| ||
Usage: create_remote_event.pl -s <base_url> -u <user> -p <passwd> [-i] <no_ssl_validation> [-q] {eventprop=value...| < json file}
base_url: http://servername:portnumber/omk, API endpoint details are automatic.
-q: quiet, don't print the new event's id on STDOUT
optional, -i: No arguments, use SSL without validation (self-signed certs).
you must either provide all required event properties as name=value pairs
or as JSON hash on STDIN. |
We can then create some event actions rules to send the poller events the the primary server:
- Edit the Event Actions (Got In opEvents, navigate to System, then Edit Event Actions) and create a new script (Please, replace replacing the below with your configurations):
PRIMARY-URL (this is the Primary server the event will be sent to)
- USERNAME (A user account on the Primary server with Admin rights)
- PASSWORD (the password for the USERNAME account)
Authority (this is the button label that will appear on the Primary)
POLLER-URL (this is the Poller - server sending the event, used to link back to the originating event from the Primary server)
Code Block "opevents_primary" : { "exec" : [ "/usr/local/omk/bin/create_remote_event.pl", "-s", "http://PRIMARY-URL.opmantek.net/omk", "-u", "USERNAME", "-p", "PASSWORD", "authority='POLLER HUMAN NAME'" ], "arguments" : [ "location=http://POLLER-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.
Add a new policy in the Event Actions file:
Please note, you can edit the condition and send just the events that you want.Code Block "100" : { "IF" : "event.priority >= 1", "THEN" : "script.opevents_primary()", "BREAK" : "true" }
- Test the remote event:
Code Block |
---|
/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 |
...