OEC Actions Documentation
Asked by David:

Hi Everyone,

I have managed to find how to set up an action and action channel in the Opsgenie website however I have been unable to find any documentation on how the OEC is setup on the server side with the actions you want it to run on the server it resides on.

I am assuming that it is setup to call a script based on a mapping when it processes from the incoming queue but I have found nothing to specify how it is all setup. Breaking down the Nagios connector it appears that it is setup in config.json??? (<https://support.atlassian.com/opsgenie/docs/configure-opsgenie-edge-connector/>)  
However I could be wrong


Answers:
author: Darryl Lee
body: Hi [@David](/t5/user/viewprofilepage/user-id/1801388),

This is Darryl. I am here to help. ?

Understand that you are trying to configure your OEC service on your server to handle the action requests from Opsgenie to your Nagios instance.

I assume that your OEC has been installed and running on your server so we can put the focus on the script it calls.

You are correct, the page you are referring to is guiding you on how to configure your config.json file for your OEC service to reference, and when there is a request coming in, OEC will find the exactly matched action name to find the script at the path specified underneath.

Example {#toc-hId--527107876}
-----------------------------

This is the **config.json** that we have published specifically for Nagios. -\> <https://github.com/opsgenie/oec-scripts/blob/master/Nagios/conf/config.json>

Let's take the Create action for example. When your OEC receives the action for Create, it will refer to the "filepath" value under the "Create" action name under the "actionMappings" object to find the action script to trigger and log the result in the "stdout" path.

```
"actionMappings": {
"Create": {
"filepath": "<path_of_script>",
"sourceType": "local",
"stdout": "<path_of_output_file_of_script>"
},
```

We also have published an action script for Nagios for your reference. -\> <https://github.com/opsgenie/oec-scripts/tree/master/Nagios/scripts>

*** ** * ** ***

Hope this is helpful.

Kind regards,  
Darryl Lee  
Support Engineer, Atlassian

comments: author: David
body: Hi [@Darryl Lee](/t5/user/viewprofilepage/user-id/3680306) ,  

I was using the Nagios integration as an example and I am referring to custom actions for use cases such as restarting a service from the actions options in Alerts.  

I managed to work it out without any documentation on the topic which needs looking at.  

For any future readers the documentation is not really clear on the roll the OEC plays with actions however you can simply change the name of an item in the action mapping and edit the data to send it to your custom scripts.  

For example in the snippet above you change the word Create to what you need it to be and this is key, you must have it match the name of the action in Opsgenie. This is a very limiting feature IMO there should be a Display name on screen and a back end name that is send through the OEC etc. for developers to easily bundle up common actions and rename them.  

Keeping the above in mind you can look at any of the other documentation around integrations and work back on what options are available to you and what can be achieved.


Tags: cloud