Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Before to start you must have a Opsgenie account, then you have to create a "Teams", navigate to Opsgenie portal > Teams > Add team 

Image RemovedImage Added

Please add "Name" and "Description" and click on "Add team".

Image RemovedImage Added

Click on the team that you created and navigate to integrations then click on "Add integration".


Image RemovedImage Added

On integration select "API". 

...

Please add "Name" and "Access". Then click on "Save Integration"

Image RemovedImage Added

Python Scripts

...

Log into your opEvents installation from your browser.  Once authenticated, in the upper right, click System, then Edit Event Actions.


Immediately under the line that reads:

"script" : {

Add the text:

Code Block
"openOpsgenie" : {
         "exec" : "/usr/local/omk/script/openOpsgenie.py",
         "output" : "save",
         "arguments" : "event._id node.name SERVER event.event event.priority event.element event.details event.time"
      },
"closeOpsgenie" : {
         "exec" : "/usr/local/omk/script/closeOpsgenie.py",
         "output" : "save",
         "arguments" : "event._id node.name SERVER event.event event.priority event.element event.details event.time"
      },

When complete this should look like the following:

Image Modified


Then click the Validate button. If you see a 'Syntax OK' prompt, proceed to click Save. You can also click Save and this will also check the syntax is OK.

You can now call the script through opEvents with the command:

script.openOpsgenie()

script.closeOpsgenie()

Add a call to the script when node goes down and when node goes up. This would look like the following: 

Code Block
         "38" : {
               "BREAK" : "false",
               "IF" : "event.event eq \"Node Up\"",
               "THEN" : [
                  "script.traceroute_node()",
                  "script.closeOpsgenie()"
               ]
            },
            "30" : {
               "BREAK" : "false",
               "IF" : "event.event eq \"Node Down\"",
               "THEN" : [
                  "script.traceroute_node()",
                  "script.openOpsgenie()",
                  "tag.isbroken(nodedown)",
                  "tag.verybad(42)"
               ]
            },

After modifying the Event Actions to suit your needs, you can then proceed to press the Save button, and verify the Syntax is OK. Once confirmed, you will then need to restart the opEvents daemon (opeventsd).

Code Block
# systemctl restart opeventsd

...