Skip to content
Permalink
Browse files

Update acknowledge function

  • Loading branch information
Julien1498 committed Nov 18, 2019
1 parent a68cfe7 commit 859bbe73f99e06f3cdbd1f2866e82c7dd83bd6d9
Showing with 20 additions and 3 deletions.
  1. +20 −3 module/monitoring_ged/ged_functions.php
@@ -374,6 +374,7 @@ function acknowledge($selected_events, $queue, $checkBoxNagios)
global $path_ged_bin;
global $array_serv_system;
$nagios_default = (get_config_var("itsm_thruk") == false ) ? "" : get_config_var("itsm_thruk");
$itsm = (get_config_var("itsm") == false ) ? "" : get_config_var("itsm");

if(!in_array($queue,$array_ged_queues)) { $queue=$array_ged_queues[0]; }

@@ -390,9 +391,24 @@ function acknowledge($selected_events, $queue, $checkBoxNagios)
$hostName = $value_parts[3];
$serviceName = $value_parts[4];
$isHost = explode(" ", $serviceName);
if($nagios_default == "true")
{
if($checkBoxNagios == "true"){
if($itsm == "on") {
if($nagios_default == "true") {
if($checkBoxNagios == "true") {
$off = 0;
$on = 1;
$date = new DateTime();
$timestamp = $date->getTimestamp();
$CommandFile="/srv/eyesofnetwork/nagios/var/log/rw/nagios.cmd";
if($isHost[0] == "HOST") {
$cmdline = '['.$timestamp.'] ACKNOWLEDGE_HOST_PROBLEM;'.$hostName.';'.$on.';'.$on.';'.$off.';' .$owner. '; Acknowleged in Ged'.PHP_EOL;
} else{
$cmdline = '['. $timestamp .'] ACKNOWLEDGE_SVC_PROBLEM;'.$hostName.';'.$serviceName.';'.$on.';'.$on.';'.$off.';' .$owner. '; Acknowleged in Ged'.PHP_EOL;
}
file_put_contents($CommandFile, $cmdline,FILE_APPEND);
}
}
} else {
if($checkBoxNagios == "true") {
$off = 0;
$on = 1;
$date = new DateTime();
@@ -405,6 +421,7 @@ function acknowledge($selected_events, $queue, $checkBoxNagios)
}
file_put_contents($CommandFile, $cmdline,FILE_APPEND);
}

}
if($ged_type == "nagios"){ $ged_type_nbr = 1; }
if($ged_type == "snmptrap"){ $ged_type_nbr = 2; }

0 comments on commit 859bbe7

Please sign in to comment.
You can’t perform that action at this time.