Use correct ID for incident resolution (#9321)

* Use correct ID for incident resolution

* Update Pagerduty.php
This commit is contained in:
Neil Lathwood
2018-10-16 22:38:35 +01:00
committed by Tony Murray
parent 0db8d0ca70
commit 3fc9e334b8

View File

@@ -21,6 +21,7 @@
* @package LibreNMS * @package LibreNMS
* @subpackage Alerts * @subpackage Alerts
*/ */
namespace LibreNMS\Alert\Transport; namespace LibreNMS\Alert\Transport;
use GuzzleHttp\Client; use GuzzleHttp\Client;
@@ -55,7 +56,7 @@ class Pagerduty extends Transport
// This code uses events for PD // This code uses events for PD
$protocol = array( $protocol = array(
'service_key' => $opts, 'service_key' => $opts,
'incident_key' => ($obj['id'] ? $obj['id'] : $obj['uid']), 'incident_key' => $obj['alert_id'],
'description' => ($obj['name'] ? $obj['name'] . ' on ' . $obj['hostname'] : $obj['title']), 'description' => ($obj['name'] ? $obj['name'] . ' on ' . $obj['hostname'] : $obj['title']),
'client' => 'LibreNMS', 'client' => 'LibreNMS',
); );
@@ -88,7 +89,7 @@ class Pagerduty extends Transport
$data = [ $data = [
'routing_key' => $config['service_key'], 'routing_key' => $config['service_key'],
'event_action' => $obj['event_type'], 'event_action' => $obj['event_type'],
'dedup_key' => $obj['uid'], 'dedup_key' => $obj['alert_id'],
'payload' => [ 'payload' => [
'custom_details' => substr(implode(PHP_EOL, array_column($obj['faults'], 'string')), 0, 1020) . '....' ?: 'Test', 'custom_details' => substr(implode(PHP_EOL, array_column($obj['faults'], 'string')), 0, 1020) . '....' ?: 'Test',
'source' => $obj['hostname'], 'source' => $obj['hostname'],