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 <pr_id>`, 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.
This commit is contained in:
Richard Mayhew
2018-06-26 19:37:16 +02:00
committed by Neil Lathwood
parent 1e47f57bd8
commit e2c698bc68

View File

@@ -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);