Added log events for jira transport (#7059)

* Added log events for jira transport

* Resolve jira ticket bug for normal alerts
This commit is contained in:
Aldemir Akpinar
2017-07-20 22:09:33 +03:00
committed by Neil Lathwood
parent ac5b2c663c
commit a2a1174033

View File

@@ -22,10 +22,11 @@
*/
// Don't create tickets for resolutions
if($obj['status'] == 0 && $obj['msg'] != 'This is a test alert') {
if($obj['severity'] == 'recovery' && $obj['msg'] != 'This is a test alert') {
return True;
}
$device = device_by_id_cache($obj['device_id']); // for event logging
$username = $opts['username'];
$password = $opts['password'];
@@ -58,7 +59,10 @@ curl_setopt($curl, CURLOPT_POSTFIELDS, $datastring);
$ret = curl_exec($curl);
$code = curl_getinfo($curl, CURLINFO_HTTP_CODE);
if( $code == 200 ) {
$jiraout = json_decode($ret, true);
d_echo("Created jira issue ".$jiraout['key']." for ".$device);
return true;
} else {
d_echo("Jira connection error: ".serialize($ret));
return false;
}