Enumerate AlertState (#11665)

* Enumerate AlertState

* fix typo

* add missing use's

* .

* .
This commit is contained in:
SourceDoctor
2020-05-24 04:14:36 +02:00
committed by GitHub
parent b8c6769049
commit b89eb22cd5
46 changed files with 163 additions and 90 deletions

View File

@@ -24,6 +24,7 @@
*/
namespace LibreNMS\Alert\Transport;
use LibreNMS\Enum\AlertState;
use LibreNMS\Alert\Transport;
class Victorops extends Transport
@@ -47,11 +48,11 @@ class Victorops extends Transport
'state_message' => $obj['msg'],
'monitoring_tool' => 'librenms',
);
if ($obj['state'] == 0) {
if ($obj['state'] == AlertState::RECOVERED) {
$protocol['message_type'] = 'recovery';
} elseif ($obj['state'] == 2) {
} elseif ($obj['state'] == AlertState::ACKNOWLEDGED) {
$protocol['message_type'] = 'acknowledgement';
} elseif ($obj['state'] == 1) {
} elseif ($obj['state'] == AlertState::ACTIVE) {
$protocol['message_type'] = 'critical';
}