OpenNMS / opennms-pagerduty-plugin

OpenNMS <-> PagerDuty

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add details to the payload sent to Pager Duty

GanimanSwift opened this issue · comments

It would be useful to have the ability to add more details to the payload. Something like this:

{
  "description": "Node east01.internal.opennms.com is down.",
  "event_type": "trigger",
  "incident_key": "uei.opennms.org/nodes/nodeDown::70:172.20.42.19",
  "service_key": "5e84cb63be324b8387f08ad49735f935",
  "details": {
    "value": "1",
    "team": "OpenNMS",
    "severity": "MAJOR",
    "runbook_url": "https://nhwiki.nanthealth.com/display/techops/OpenNMS+nodeDown+Response+Procedure",
    "ip": "172.20.42.19",
    "hostname": "east01.internal.opennms.com",
    "event_time": "2020.09.24 13:01:17",
    "event_id": "12345",
    "client_url": "https://nms03.internal.opennms.com/opennms/element/nodeList.htm?iplike=172.20.42.19",
    "application": "OpenNMS"
  }
}

Most of this should be easy to fill in. Some of it might require setting up some parameters, like the client_url or runbook_url. The runbook_url can be automatically generated by filling in a blank... it would like like:

https://nhwiki.nanthealth.com/display/techops/OpenNMS+<insert event name here>+Response+Procedure

@j-white as a start we could grab the properties from the alarm object and dump it all as a json in the payload details. Do you think this is something that can be implemented easily?

Sample payload being sent at the moment.

{
  "client": "OpenNMS",
  "client_url": "https://nms03.internal.opennms.com/opennms/alarm/detail.htm?id=871450",
  "contexts": [],
  "description": "High threshold exceeded for service SNMP metric ns-dskPercent on interface //172.20.42.26",
  "event_type": "trigger",
  "incident_key": "uei.opennms.org/threshold/highThresholdExceeded::542:172.20.42.26:ns-dskPercent:90.0:2:75.0:/",
  "service_key": "c6e2e4296d0e4afd84f751562a70a9a2",
  "details": {
    "description": "Trigger an alert when the percentage of disk space used on any disk reaches or goes above 90% full for two consecutive measurement intervals",
    "ds": "ns-dskPercent",
    "instance": "1",
    "instanceLabel": "_root_fs",
    "label": "/",
    "rearm": "75.0",
    "resourceId": "node[542].dskIndex[_root_fs]",
    "resourceType": "dskIndex",
    "threshold": "90.0",
    "trigger": "2",
    "value": "90"
  }
}

Sample payload from a different monitoring system.

{
  "client": "Zabbix",
  "client_url": "https://zabbix.nanthealth.com/zabbix/tr_events.php?triggerid=1298857&eventid=262097281",
  "contexts": [],
  "description": "Free disk space low on volume (/) : PROBLEM for SCIFGITAPP01",
  "event_type": "trigger",
  "incident_key": "262097281",
  "service_key": "371db1c8af2f4402c0df9891ff988706",
  "details": {
    "application": "Infrastructure",
    "event_time": "2022.08.30 11:24:37",
    "hostname": "SCIFGITAPP01",
    "ip": "10.80.60.15",
    "operational_data": "0 %, 0 B",
    "runbook_url": "https://nhwiki.nanthealth.com/display/techops/Free+disk+space+low+Response+Procedure",
    "tags": "Environment:Production, Patching:Odds, Service:Infrastructure, Team:NOC",
    "team": "NOC",
    "trigger_description": "Low disk space on /"
  }
}