mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
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:
committed by
Neil Lathwood
parent
ac5b2c663c
commit
a2a1174033
@@ -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'];
|
||||
@@ -35,7 +36,7 @@ $details = "Librenms alert for: ".$obj['hostname'];
|
||||
$description = $obj['msg'];
|
||||
$url = $opts['url'].'/rest/api/latest/issue';
|
||||
$curl = curl_init();
|
||||
|
||||
|
||||
$data = array("project" => array("key" => $prjkey),
|
||||
"summary" => $details,
|
||||
"description" => $description,
|
||||
@@ -58,7 +59,10 @@ curl_setopt($curl, CURLOPT_POSTFIELDS, $datastring);
|
||||
$ret = curl_exec($curl);
|
||||
$code = curl_getinfo($curl, CURLINFO_HTTP_CODE);
|
||||
if( $code == 200 ) {
|
||||
return true;
|
||||
$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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user