+#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"
+}
+
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";
}
# 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";
###############################################################################
# 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
###############################################################################
# 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
define hostgroup{
hostgroup_name etrax
alias all etrax nodes
- hostgroup_members cts,start,tof,rpc
+ hostgroup_members cts,start,tof,rpc,scs
}
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