<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Guide: Integrate OpsGenie and NetXMS]]></title><description><![CDATA[<p dir="auto">Hello,<br />
Through extensive setup and testing, I have been able to implement an integration with OpsGenie using NetXMS server actions and the OpsGenie API. This is a one-way integration currently and I may work on a two-way integration in the future.</p>
<p dir="auto">Key Components:</p>
<ul>
<li>OpsGenie API</li>
<li>Custom Scripts in Script Library</li>
<li>Event Processing Policy Rules</li>
</ul>
<p dir="auto">The most basic functionality using this would be to create an OpsGenie alert when a node is down. This guide will walk you through setting up functionality to create, acknowledge, and close OpsGenie alerts from inside the NetXMS client. I won’t go through the steps necessary to set up and opsgenie API integration but the link to the official guide for that will be posted below.</p>
<p dir="auto">OpsGenie API Setup<br />
You can obtain an API key by following the instructions here:  <a href="https://support.atlassian.com/opsgenie/docs/create-a-default-api-integration/" rel="nofollow ugc">https://support.atlassian.com/opsgenie/docs/create-a-default-api-integration/</a><br />
Additional API Docs can be found here: <a href="https://docs.opsgenie.com/docs/alert-api" rel="nofollow ugc">https://docs.opsgenie.com/docs/alert-api</a></p>
<p dir="auto">Create Alert<br />
To create an alert in OpsGenie we will need to set up an event processing policy that will call a server action.</p>
<p dir="auto"><strong>Server Action:</strong><br />
<strong>Name:</strong> OpsGenie Create Alert<br />
<strong>Type:</strong> Execute command on management server<br />
<strong>Options:</strong> None</p>
<pre><code>C:\\Windows\\System32\\curl.exe -v -X POST https://api.opsgenie.com/v2/alerts -H "Content-Type: application/json" -H "Authorization: GenieKey XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX" -d "{ \\"message\\": \\"%Z - %m - %n\\", \\"alias\\": \\"%N%g\\", \\"description\\":\\"Ip Address: %a \\n \\n GUID: %g \\n \\n Severity: %S \\n \\n Event Name: %N \\n Event Source Object Name: %n \\n Time: %t \\n Zone Name: %Z\\", \\"entity\\":\\"%n\\", \\"priority\\":\\"%[ConvertSeverity]\\" }"
</code></pre>
<p dir="auto"><strong>Important Notes:</strong><br />
·        Message will be the title of the OpsGenie Alert. In this example we have the Zone, the Event Name, and the Object Name for easy identification when receiving mobile alerts.<br />
·        You MUST use \\ to escape the characters in the message or the request will not submit properly.<br />
·        To be able to acknowledge and close OpsGenie alerts from inside NetXMS, you MUST use an alias that can be referenced. We will use %N%g for our alias. This will give us a unique Alias of EventName+GUID of the source object.<br />
·        In multi-tenant MSP scenarios you can set “<strong>Zone Name: %Z”</strong> inside the command in order to route the alerts to the appropriate OpsGenie teams.<br />
<strong>Macros used:</strong><br />
    ·        %n - Name of event source object. Name of interface when interface name is generated using macros.<br />
    ·        %Z - Zone name of event source object.<br />
    ·        %t - Event’s timestamp is a form day-month-year hour:minute:second.<br />
    ·        %g - Globally unique identifier (GUID) of event source object.<br />
    ·        %N - Event’s name.<br />
    ·        %a - IP address of event source object.<br />
    ·        %S - Event’s severity code as text.</p>
<p dir="auto">You can use additional macros for event processing: <a href="https://www.netxms.org/documentation/adminguide/event-processing.html#macros-for-event-processing" rel="nofollow ugc">https://www.netxms.org/documentation/adminguide/event-processing.html#macros-for-event-processing</a></p>
<p dir="auto"><strong>Custom Scripts:</strong><br />
This script is necessary because the severity codes for NetXMS are the opposite of OpsGenie. You can create this script in the script library.</p>
<p dir="auto"><strong>Script ( ConvertSeverity )</strong></p>
<pre><code>sub main()
{
 prioritylevel = "P5";
   switch($event-&gt;severity)
   {
   case 0:
        prioritylevel = "P5";
        break;
   case 1:
        prioritylevel = "P4";
        break;
   case 2:
        prioritylevel = "P3";
        break;
   case 3:
        prioritylevel = "P2";
        break;
   case 4:
        prioritylevel = "P1";
        break;
   };
   return prioritylevel;
}
</code></pre>
]]></description><link>https://forum.netxms.org/topic/7819/guide-integrate-opsgenie-and-netxms</link><generator>RSS for Node</generator><lastBuildDate>Fri, 13 Nov 2026 07:21:40 GMT</lastBuildDate><atom:link href="https://forum.netxms.org/topic/7819.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 15 Nov 2023 19:45:56 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Guide: Integrate OpsGenie and NetXMS on Mon, 19 Feb 2024 13:49:38 GMT]]></title><description><![CDATA[<p dir="auto">I'll be updating this using correct syntax for NetXMS v5.0.</p>
]]></description><link>https://forum.netxms.org/post/33217</link><guid isPermaLink="true">https://forum.netxms.org/post/33217</guid><dc:creator><![CDATA[graeChris]]></dc:creator><pubDate>Mon, 19 Feb 2024 13:49:38 GMT</pubDate></item><item><title><![CDATA[Reply to Guide: Integrate OpsGenie and NetXMS on Wed, 15 Nov 2023 20:02:57 GMT]]></title><description><![CDATA[<p dir="auto">Acknowledge Alert<br />
When an alarm is acknowledged or sticky acknowledged in NetXMS, send an API call via curl to Opsgenie to acknowledge the alert.</p>
<p dir="auto"><strong>Server Action:</strong><br />
<strong>Name:</strong> OpsGenie Acknowledge Alarm<br />
<strong>Type:</strong>  Execute command on management server<br />
<strong>Command:</strong></p>
<pre><code>C:\\Windows\\System32\\curl.exe -v -X POST https://api.opsgenie.com/v2/alerts/%1/acknowledge\?identifierType=alias -H "Content-Type: application/json" -H "Authorization: GenieKey XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX" -d "{ \\"user\\": \\"netXMS Admin\\", \\"source\\": \\"netXMS\\", \\"note\\":\\"Acknowledged via Alert API from netXMS \\n Alarm ID:%1 \\n Time: %t\\" }"
</code></pre>
<p dir="auto"> <br />
<strong>Macros Used:</strong><br />
     ·         %1 – Alarm Source Event Name + GUID<br />
     ·         %t - %t - Event’s timestamp is a form day-month-year hour:minute:second.<br />
 <br />
<strong>Event Processing Policy Rule</strong><br />
<strong>Conditions:</strong><br />
 Event Code:<br />
     ·         Xms_Alarm_Ack<br />
     ·         Xms_Alarm_StickyAck<br />
<strong>Actions:</strong><br />
 Execute Server Action called <strong>Opsgenie Acknowledge Alarm</strong></p>
<p dir="auto"><strong>Comments:</strong> Acknowledge OpsGenie alert when NetXMS alarm is acknowledged</p>
<p dir="auto">Close Alert<br />
When an alarm is resolved in NetXMS, send an API call via curl to Opsgenie to close the alert.<br />
<strong>Server Action:</strong></p>
<p dir="auto"><strong>Name:</strong> OpsGenie Close Alert<br />
<strong>Type:</strong>  Execute command on management server<br />
<strong>Command:</strong></p>
<pre><code>C:\\Windows\\System32\\curl.exe -v -X POST https://api.opsgenie.com/v2/alerts/%1/close\?identifierType=alias -H "Content-Type: application/json" -H "Authorization: GenieKey XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX" -d "{ \\"user\\": \\"netXMS Admin\\", \\"source\\": \\"netXMS\\", \\"note\\":\\"Alert Closed via Alert API from netXMS \\n Alarm ID:%1 \\n Time: %t\\" }"
</code></pre>
<p dir="auto"><strong>Macros Used:</strong><br />
·         %1 – Alarm Source Event Name + GUID<br />
·         %t - %t - Event’s timestamp is a form day-month-year hour:minute:second.<br />
 <br />
<strong>Event Processing Policy Rule</strong><br />
<strong>Conditions:</strong><br />
            Event Code:<br />
     ·         Xms_Alarm_Resolve</p>
<p dir="auto"><strong>Actions:</strong><br />
Execute Server Action called <strong>Opsgenie Close Alert</strong></p>
<p dir="auto"><strong>Comments:</strong> Close OpsGenie alerts for resolved Alarms<br />
 </p>
<p dir="auto"><strong>Known issues/limitations:</strong><br />
·         Alert status change in OpsGenie does not change alarm status in NetXMS.<br />
·         Custom OpsGenie routing rules may cause priority to be assigned improperly if priority tag is not used for severity calculation in OpsGenie.<br />
 <br />
<strong>Notes:</strong><br />
Creating additional custom attributes and filtering scripts can give better control over what events result in OpsGenie notifications. For example, servers and switches may be a higher priority than desktops or laptops.</p>
]]></description><link>https://forum.netxms.org/post/32999</link><guid isPermaLink="true">https://forum.netxms.org/post/32999</guid><dc:creator><![CDATA[graeChris]]></dc:creator><pubDate>Wed, 15 Nov 2023 20:02:57 GMT</pubDate></item><item><title><![CDATA[Reply to Guide: Integrate OpsGenie and NetXMS on Wed, 15 Nov 2023 19:55:58 GMT]]></title><description><![CDATA[<p dir="auto">To Acknowledge or close your OpsGenie Alert we have to modify a built in script to post new events.</p>
<p dir="auto"><strong>Script Name:</strong> Hook::AlarmStateChange<br />
<strong>Code:</strong></p>
<pre><code>sub main()
{
 eventserver = FindNodeObject($node, 100);
 global alarmstate = $alarm-&gt;state;
 global sourceAlarm = $alarm-&gt;id;
 global eventname = $alarm-&gt;eventName;
 global sourceobj = FindObject($alarm-&gt;sourceObject);
 global nameobj = sourceobj-&gt;guid;


 switch(alarmstate)
 {
/* Alarm State is Outstanding */
     case "0":
         break;
/* Alarm State is Acknowledged */
     case "1":
         PostEvent(eventserver, "Xms_Alarm_Ack","ACKALARM", eventname . nameobj);
         break;
/* Alarm State is Resolved */
     case "2":
         PostEvent(eventserver, "Xms_Alarm_Resolve","RSLVALARM", eventname . nameobj);
         break;
/* Alarm State is Sticky Acknowledged */
     case "17":
         PostEvent(eventserver, "Xms_Alarm_Ack","SACKALARM", eventname . nameobj);
         break;
 }
}
</code></pre>
<p dir="auto">We also have to create these events in <strong>Configuration-&gt;Event templates</strong></p>
<p dir="auto"><strong>Alarms Needed:</strong><br />
·        Xms_Alarm_Ack<br />
    o    <strong>Message:</strong> ALARM ACK - Alarm: %1<br />
    o    <strong>Write to log:</strong> TRUE<br />
    o    <strong>Description:</strong> Event created when an Alarm is acknowledged<br />
    o    <strong>Severity:</strong> Normal<br />
·        Xms_Alarm_StickyAck<br />
    o    <strong>Message:</strong> ALARM STICKY_ACK - Alarm: %1<br />
    o    <strong>Write to log:</strong> TRUE<br />
    o    <strong>Description:</strong> Event created when an Alarm is sticky acknowledged<br />
    o    <strong>Severity:</strong> Normal<br />
·        Xms_Alarm_Resolve<br />
    o    <strong>Message:</strong> ALARM RESOLVED - Alarm: %1<br />
    o    <strong>Write to log:</strong> TRUE<br />
    o    <strong>Description:</strong> Event created when an Alarm has been resolved<br />
    o    <strong>Severity:</strong> Normal</p>
]]></description><link>https://forum.netxms.org/post/32998</link><guid isPermaLink="true">https://forum.netxms.org/post/32998</guid><dc:creator><![CDATA[graeChris]]></dc:creator><pubDate>Wed, 15 Nov 2023 19:55:58 GMT</pubDate></item><item><title><![CDATA[Reply to Guide: Integrate OpsGenie and NetXMS on Wed, 15 Nov 2023 19:57:13 GMT]]></title><description><![CDATA[<p dir="auto"><strong>Event Processing Policy</strong></p>
<p dir="auto"><strong>Conditions:</strong><br />
<strong>Event Codes:</strong><br />
·        SYS_NODE_DOWN<br />
<strong>Filtering Script:</strong></p>
<pre><code>if (IsAlerted@$node == "Yes" )
{
    return true;
}
else
{
     return false;
}
</code></pre>
<p dir="auto">The filtering script will check for a Custom Attribute on the node called <strong>IsAlerted.</strong> If the Custom Attribute does not exist you may see script error alarms. This filter is optional and is used to prevent notification spam. You can set the attribute to “No” for your entire network and then set the attribute to “<strong>Yes</strong>” for the nodes you wish to be alerted.</p>
<p dir="auto"><strong>Actions:</strong><br />
We will assign two actions to this Event Processing Policy. The first action will be to create an alarm in NetXMS. The second action will be to execute our server action called <strong>OpsGenie Create Alert.</strong><br />
Alarm configuration<br />
    ·        Message: %m<br />
    ·        Alarm key: NODE_DOWN_%i<br />
    ·        Alarm severity: From event<br />
    ·        Alarm timeout: 0<br />
<strong>Comments:</strong>  Create Alarm and OpsGenie Alert when Node is Down</p>
<p dir="auto">Make sure to save your EPP Rules.</p>
]]></description><link>https://forum.netxms.org/post/32997</link><guid isPermaLink="true">https://forum.netxms.org/post/32997</guid><dc:creator><![CDATA[graeChris]]></dc:creator><pubDate>Wed, 15 Nov 2023 19:57:13 GMT</pubDate></item></channel></rss>