]> jspc29.x-matter.uni-frankfurt.de Git - hadesdaq.git/commitdiff
JAM: adjustments for icinga on lxhadeb06
authorHades DAQ <hadaq@hades33.gsi.de>
Fri, 7 Mar 2014 16:21:23 +0000 (17:21 +0100)
committerHades DAQ <hadaq@hades33.gsi.de>
Fri, 7 Mar 2014 16:21:23 +0000 (17:21 +0100)
hmon/permanent/hmon_icinga.pl

index eb4d22c003686786ec0c3f2190e4803eaa6a90a5..cc416b64ee84f84385ab5b542f1fb20f3f040eca 100755 (executable)
@@ -19,7 +19,7 @@ my $interval = 5;
 my ($socket,$client_socket);
 
 $socket = new IO::Socket::INET (
-                               PeerHost => 'hadesdaq02',
+                               PeerHost => 'lxhadeb06',
                                PeerPort => '12345',
                                Proto => 'tcp'
                               );
@@ -52,13 +52,13 @@ while (1) {
   if (!$result) {
     #print "open socket\n";
     $socket = new IO::Socket::INET (
-                                   PeerHost => 'hadesdaq02',
+                                   PeerHost => 'lxhadeb06',
                                    PeerPort => '12345',
                                    Proto => 'tcp');
     if (!($socket)) {
       #print "unable to open socket\n";
       $value = "DOWN";
-      $longtext = "Unable to connect to hadesdaq02 (icinga log deamon)";
+      $longtext = "Unable to connect to lxhadeb06 (icinga log deamon)";
       $num_errors = 999;
     }
   }
@@ -80,19 +80,21 @@ while (1) {
     }
   
     #print "blubb\n";
-    
+    # JAM: below changed from a[8] to a[9] due to different ls format
     if (defined $result_a) {
       #print $result_a . "\n";
       my @a = split(/\s+/,$result_a);
+      #print $a[9]. "\n";
+      #print $a[10]. "\n";
       if ($started == 1) {
        $started = 0;
-       $last_mod_time = $a[8];
+       $last_mod_time = $a[9];
        $num_unchanged = 0;
       }
       
-      if ($last_mod_time ne $a[8]) {
+      if ($last_mod_time ne $a[9]) {
        my @a = split(/\s+/,$result_a);
-       $last_mod_time = $a[8];
+       $last_mod_time = $a[9];
        $num_unchanged = 0;
       } else {
        $num_unchanged++;
@@ -108,30 +110,32 @@ while (1) {
     $value = "DOWN";
     $longtext = "Icinga not updated since $last_mod_time";
     QA::WriteQALog($flog,"server","icinga",10,QA::FATAL,$title,$value,$longtext);
+    $num_unchanged = 0;
+    # JAM better reset counter here
   } else {
      
       
 
-    my $icinga_query_hosts = "ssh hadesdaq02 \"REMOTE_USER='icingaadmin' REQUEST_METHOD='GET' QUERY_STRING='csvoutput&style=hostdetail&hoststatustypes=4&hostprops=10' /usr/lib/icinga/cgi/status.cgi\" | grep -v declare";
+    my $icinga_query_hosts = "ssh lxhadeb06 \"REMOTE_USER='icingaadmin' REQUEST_METHOD='GET' QUERY_STRING='csvoutput&style=hostdetail&hoststatustypes=4&hostprops=10' /usr/lib/cgi-bin/icinga/status.cgi\" | grep -v declare";
     my @icinga_result_hosts = qx($icinga_query_hosts);
     splice(@icinga_result_hosts, 0, 7);
     #printf("@icinga_result_hosts");
     $num_errors += scalar @icinga_result_hosts;
 
-    my $icinga_query_etrax = "ssh hadesdaq02 \"REMOTE_USER='icingaadmin' REQUEST_METHOD='GET' QUERY_STRING='csvoutput&hostgroup=etrax&style=hostdetail&hoststatustypes=4&hostprops=10' /usr/lib/icinga/cgi/status.cgi\" | grep -v declare";
+    my $icinga_query_etrax = "ssh lxhadeb06 \"REMOTE_USER='icingaadmin' REQUEST_METHOD='GET' QUERY_STRING='csvoutput&hostgroup=etrax&style=hostdetail&hoststatustypes=4&hostprops=10' /usr/lib/cgi-bin/icinga/status.cgi\" | grep -v declare";
     my @icinga_result_etrax = qx($icinga_query_etrax);
     #printf("@icinga_result_etrax");
     splice(@icinga_result_etrax, 0, 7);
     my $num_errors_etrax = scalar @icinga_result_etrax;
 
-    my $icinga_query_power = "ssh hadesdaq02 \"REMOTE_USER='icingaadmin' REQUEST_METHOD='GET' QUERY_STRING='csvoutput&hostgroup=power&style=hostdetail&hoststatustypes=4&hostprops=10' /usr/lib/icinga/cgi/status.cgi\" | grep -v declare";
+    my $icinga_query_power = "ssh lxhadeb06 \"REMOTE_USER='icingaadmin' REQUEST_METHOD='GET' QUERY_STRING='csvoutput&hostgroup=power&style=hostdetail&hoststatustypes=4&hostprops=10' /usr/lib/cgi-bin/icinga/status.cgi\" | grep -v declare";
     my @icinga_result_power = qx($icinga_query_power);
     #print @icinga_result_power . "\n";
     splice(@icinga_result_power, 0, 7);
     my $num_errors_power = scalar @icinga_result_power;
 
 
-    my $icinga_query_services = "ssh hadesdaq02 \"REMOTE_USER='icingaadmin' REQUEST_METHOD='GET' QUERY_STRING='csvoutput&style=detail&servicestatustypes=16&hoststatustypes=3&serviceprops=2097162' /usr/lib/icinga/cgi/status.cgi\" | grep -v declare";
+    my $icinga_query_services = "ssh lxhadeb06 \"REMOTE_USER='icingaadmin' REQUEST_METHOD='GET' QUERY_STRING='csvoutput&style=detail&servicestatustypes=16&hoststatustypes=3&serviceprops=2097162' /usr/lib/cgi-bin/icinga/status.cgi\" | grep -v declare";
     my @icinga_result_services = qx($icinga_query_services);
     splice(@icinga_result_services, 0, 7);
     #printf("@icinga_result_services");