Skip to content

Commit

Permalink
Catch failed transports that don't return 'false'. Pass error message…
Browse files Browse the repository at this point in the history
… into event log.
  • Loading branch information
khobbits committed Mar 23, 2016
1 parent 75e1712 commit 59ad5d0
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions alerts.php
Original file line number Diff line number Diff line change
Expand Up @@ -345,14 +345,18 @@ function ExtTransports($obj) {
$prefix = array( 0=>"recovery", 1=>$obj['severity']." alert", 2=>"acknowledgment" );
$prefix[3] = &$prefix[0];
$prefix[4] = &$prefix[0];
if ($tmp) {
if ($tmp === true) {
echo 'OK';
log_event('Issued '.$prefix[$obj['state']]." for rule '".$obj['name']."' to transport '".$transport."'", $obj['device_id']);
}
else {
elseif ($tmp === false) {
echo 'ERROR';
log_event('Could not issue '.$prefix[$obj['state']]." for rule '".$obj['name']."' to transport '".$transport."'", $obj['device_id']);
}
else {
echo 'ERROR: '.$tmp."\r\n";
log_event('Could not issue '.$prefix[$obj['state']]." for rule '".$obj['name']."' to transport '".$transport."' Error: ".$tmp, $obj['device_id']);
}
}

echo '; ';
Expand Down

0 comments on commit 59ad5d0

Please sign in to comment.