From e2c698bc68e20e733066cd4c8206360c295c83ad Mon Sep 17 00:00:00 2001 From: Richard Mayhew Date: Tue, 26 Jun 2018 19:37:16 +0200 Subject: [PATCH] Use alert rule title for Pushover title and severity level (#8844) DO NOT DELETE THIS TEXT #### Please note > Please read this information carefully. You can run `./scripts/pre-commit.php` to check your code before submitting. - [X] Have you followed our [code guidelines?](http://docs.librenms.org/Developing/Code-Guidelines/) #### Testers If you would like to test this pull request then please run: `./scripts/github-apply `, i.e `./scripts/github-apply 5926` Revised the title of the message inline with the alert definition and revised the severity levels in accordance with the PushOver API. Removed some unused code. --- LibreNMS/Alert/Transport/Pushover.php | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/LibreNMS/Alert/Transport/Pushover.php b/LibreNMS/Alert/Transport/Pushover.php index eec2797ddb..4790f7441e 100644 --- a/LibreNMS/Alert/Transport/Pushover.php +++ b/LibreNMS/Alert/Transport/Pushover.php @@ -49,15 +49,13 @@ class Pushover implements Transport $data['user'] = $api['userkey']; switch ($obj['severity']) { case "critical": - $severity = "Critical"; $data['priority'] = 1; if (!empty($api['sound_critical'])) { $data['sound'] = $api['sound_critical']; } break; case "warning": - $severity = "Warning"; - $data['priority'] = 0; + $data['priority'] = 1; if (!empty($api['sound_warning'])) { $data['sound'] = $api['sound_warning']; } @@ -65,19 +63,13 @@ class Pushover implements Transport } switch ($obj['state']) { case 0: - $title_text = "OK"; + $data['priority'] = 0; if (!empty($api['sound_ok'])) { $data['sound'] = $api['sound_ok']; } break; - case 1: - $title_text = $severity; - break; - case 2: - $title_text = "Acknowledged"; - break; } - $data['title'] = $title_text . " - " . $obj['hostname'] . " - " . $obj['name']; + $data['title'] = $obj['title']; $data['message'] = $obj['msg']; $curl = curl_init(); set_curl_proxy($curl);