]> jspc29.x-matter.uni-frankfurt.de Git - hadesicinga.git/commitdiff
JAM: added evaluation of epics etrax nodes to daq2icinga.pl
authorhadaq <hadaq>
Fri, 17 Feb 2012 13:31:17 +0000 (13:31 +0000)
committerhadaq <hadaq>
Fri, 17 Feb 2012 13:31:17 +0000 (13:31 +0000)
icinga configuration for hades hosts

icinga/objects/commands.cfg
icinga/objects/daq2icinga.pl
icinga/objects/hosts_etrax.cfg
icinga/objects/templates.cfg

index 5b795ff00211d7286ae7c46f8f39ac38329cdcc0..ed9b4da24b87562684ca2b8e9899f165ddc6d3fc 100644 (file)
@@ -335,5 +335,23 @@ define command {
 
 
 
+#my_check_disk_smartctl.pl
+define command {
+   command_name check_disk_smartctl
+   command_line $USER1$/my_check_disk_smartctl.pl -d $ARG1$ -d $ARG2$
+}
+
+#my_check_disk_smartctl.pl
+define command {
+   command_name check_disk_smartctl_by_ssh
+   command_line $USER1$/check_by_ssh -l $ARG1$ -H $HOSTADDRESS$ -C "/usr/lib/nagios/plugins/my_check_disk_smartctl.pl $ARG2$ $ARG3$"
+}
+
+#check_by_ssh my_check_raid.pl
+define command {
+   command_name check_raid_by_ssh
+   command_line  $USER1$/check_by_ssh -l $ARG1$ -H $HOSTADDRESS$ -C "/usr/lib/nagios/plugins/check_linux_raid.pl"
+}
+
 
 
index 1f18baf00b8856ad541ba03bcd9561e7b5615f93..cff6f9dc20fd641c193ec18edef8b18214a8f6ff 100755 (executable)
@@ -18,6 +18,8 @@ my $icinga_config_file = "./hosts_etrax.cfg";
 my $daqpath = "/home/hadaq/trbsoft/daq/";
 my $dbfile = "trb.db";
 my @subsystems = ("cts","mdc","start","tof","rpc","shower");
+# on hadesdaq02 we also have access to epics:
+my $epicsconfig = "/home/scs/apps/hades/db/desc_ioc.db";
 my @totalsystems;
 my @totalnodes;        
 open( OUTFILE, '>', $icinga_config_file ) or die "Could not open $icinga_config_file: $! \n";
@@ -116,32 +118,75 @@ foreach my $component(@subsystems)
 
 }
 # add the slow control etrax nodes (fixed)
+my @scsnodes;
+my $rev=open( EIFILE, '<', $epicsconfig);
+        if(!$rev)
+               {
+                       # we do not have file, just set empty number with template:
+                       print "Could not open $epicsconfig. use all etraxp2**\n";
+                       my $i;
+                       for ($i=1;$i<=50;$i++)
+                       {
+                               my $index= 200+$i;
+                               my $scnode=sprintf("etraxp%d",$index);
+                               push(@scsnodes, $scnode);
+                               push(@totalnodes, $scnode);
+                               
+                       }
+
+
+               }
+       else
+               {
+       
+                       my @elines= <EIFILE>;
+                       foreach my $line (@elines) {                    
+                               #ignore comments:
+                               # Filter out headers which indicate used nodenames:
+                               if ($line =~ /.*HADCON:.*/)
+                                 {
+                                
+                                   my @larray=split(/\s+/,$line);
+                                   my $nodename="$larray[2]";
+                                   $nodename=~ s/etrax/etraxp/;
+                                   print "Found line $line , nodename=$nodename\n";
+                                   if (grep {$_ eq $nodename} @totalnodes) 
+                                       {
+                                               print "!!!! WARNING: found duplicate node $nodename in $epicsconfig! Skipped.\n";
+                                               next;
+                                       }
+                                   push(@scsnodes, $nodename);
+                                   push(@totalnodes, $nodename);
+                                 }
+
+                       }
+                       close(EIFILE) || die "Couldn't close file $epicsconfig properly";
+               }
+
+
+
 
 print OUTFILE "\n###############################################################################\n";
 print OUTFILE "# Hosts for slow control:\n";
 print OUTFILE "###############################################################################\n";
 
-my @scsnodes;
-my $i;
-for ($i=1;$i<=50;$i++)
-{
-       my $index= 200+$i;
-       my $scnode=sprintf("etraxp%d",$index);
-       push(@scsnodes, $scnode);
-       push(@totalnodes, $scnode);
-       print OUTFILE "\n\# HOST DEFINITION $scnode \n";
-       print OUTFILE "define host{\n";
-       print      OUTFILE "     use         etrax\n";
-       my $hdef = sprintf("     host_name   %s \; assigned to slow control system\n",$scnode);
-       print OUTFILE $hdef;
-       my $adef = sprintf("     alias   %s_scs \n",$scnode);
-       print OUTFILE $adef;
-       print OUTFILE "}\n"; 
+foreach my $scnode (@scsnodes) {
+    print OUTFILE "\n\# HOST DEFINITION $scnode \n";
+    print OUTFILE "define host{\n";
+    print      OUTFILE "     use         etrax\n";
+    my $hdef = sprintf("     host_name   %s \; assigned to slow control system\n",$scnode);
+    print OUTFILE $hdef;
+    my $adef = sprintf("     alias   %s_scs \n",$scnode);
+    print OUTFILE $adef; 
+    print OUTFILE "}\n"; 
+
 }
 
+
+
 # define hostgroup of scs nodes:
 print OUTFILE "\n\n###############################################################################\n";
-print OUTFILE "# Hostgroup definition for all nodes\n";
+print OUTFILE "# Hostgroup definition for scs nodes\n";
 print OUTFILE "###############################################################################\n";
 print OUTFILE "define hostgroup{\n";
 print OUTFILE "     hostgroup_name  scs \n";
index 624e78f6bc45c4c441d93bb09cf63fc943d920ed..b0595b0998109eff63480241b24f881e54250c99 100644 (file)
@@ -1,7 +1,7 @@
 ###############################################################################
 # Config File for Monitoring etrax nodes
 # This file was automatically generated from trb.db files by daq2icinga.pl
-# Creation time: 16.02.2012 at 10:22:21
+# Creation time: 17.02.2012 at 14:29:30
 #
 # HOST DEFINITIONS
 ###############################################################################
@@ -302,6 +302,118 @@ define hostgroup{
 # Hosts from subcomponent shower
 ###############################################################################
 
+###############################################################################
+# Hosts for slow control:
+###############################################################################
+
+# HOST DEFINITION etraxp231 
+define host{
+     use         etrax
+     host_name   etraxp231 ; assigned to slow control system
+     alias   etraxp231_scs 
+}
+
+# HOST DEFINITION etraxp239 
+define host{
+     use         etrax
+     host_name   etraxp239 ; assigned to slow control system
+     alias   etraxp239_scs 
+}
+
+# HOST DEFINITION etraxp207 
+define host{
+     use         etrax
+     host_name   etraxp207 ; assigned to slow control system
+     alias   etraxp207_scs 
+}
+
+# HOST DEFINITION etraxp210 
+define host{
+     use         etrax
+     host_name   etraxp210 ; assigned to slow control system
+     alias   etraxp210_scs 
+}
+
+# HOST DEFINITION etraxp232 
+define host{
+     use         etrax
+     host_name   etraxp232 ; assigned to slow control system
+     alias   etraxp232_scs 
+}
+
+# HOST DEFINITION etraxp234 
+define host{
+     use         etrax
+     host_name   etraxp234 ; assigned to slow control system
+     alias   etraxp234_scs 
+}
+
+# HOST DEFINITION etraxp203 
+define host{
+     use         etrax
+     host_name   etraxp203 ; assigned to slow control system
+     alias   etraxp203_scs 
+}
+
+# HOST DEFINITION etraxp202 
+define host{
+     use         etrax
+     host_name   etraxp202 ; assigned to slow control system
+     alias   etraxp202_scs 
+}
+
+# HOST DEFINITION etraxp208 
+define host{
+     use         etrax
+     host_name   etraxp208 ; assigned to slow control system
+     alias   etraxp208_scs 
+}
+
+# HOST DEFINITION etraxp236 
+define host{
+     use         etrax
+     host_name   etraxp236 ; assigned to slow control system
+     alias   etraxp236_scs 
+}
+
+# HOST DEFINITION etraxp201 
+define host{
+     use         etrax
+     host_name   etraxp201 ; assigned to slow control system
+     alias   etraxp201_scs 
+}
+
+# HOST DEFINITION etraxp225 
+define host{
+     use         etrax
+     host_name   etraxp225 ; assigned to slow control system
+     alias   etraxp225_scs 
+}
+
+# HOST DEFINITION etraxp221 
+define host{
+     use         etrax
+     host_name   etraxp221 ; assigned to slow control system
+     alias   etraxp221_scs 
+}
+
+# HOST DEFINITION etraxp237 
+define host{
+     use         etrax
+     host_name   etraxp237 ; assigned to slow control system
+     alias   etraxp237_scs 
+}
+
+
+###############################################################################
+# Hostgroup definition for scs nodes
+###############################################################################
+define hostgroup{
+     hostgroup_name  scs 
+     alias           etrax_scs
+     members etraxp231,etraxp239,etraxp207,etraxp210,etraxp232,etraxp234,etraxp203,etraxp202,etraxp208,etraxp236,etraxp201,etraxp225,etraxp221,etraxp237 
+}
+
 
 ###############################################################################
 # Hostgroup definition for all nodes
@@ -309,7 +421,7 @@ define hostgroup{
 define hostgroup{
      hostgroup_name  etrax 
      alias           all etrax nodes
-     hostgroup_members cts,start,tof,rpc 
+     hostgroup_members cts,start,tof,rpc,scs 
 }
 
 
index 91231283667f4b07f5f635468e9d686efbf0bd7e..ad255306024af1f1024b40b82008f192bc28e795 100644 (file)
@@ -143,6 +143,14 @@ define host{
        notification_period     24x7
 }
 
+define host{
+        name                            hades-host    ; The name of this host template
+        use                             linux-server
+        check_interval                  3 
+       notification_period     24x7
+}
+
+
 define host{
         name                            etrax    ; The name of this host template
         use                             linux-server