[1871] in Moira Commits
/svn/moira r4014 - trunk/moira/gen
daemon@ATHENA.MIT.EDU (Jonathon Weiss)
Thu Jul 22 16:10:27 2010
Date: Thu, 22 Jul 2010 16:10:20 -0400
From: Jonathon Weiss <jweiss@MIT.EDU>
Message-Id: <201007222010.o6MKAKDE021140@drugstore.mit.edu>
To: moira-commits@mit.edu
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Author: jweiss
Date: 2010-07-22 16:10:20 -0400 (Thu, 22 Jul 2010)
New Revision: 4014
Modified:
trunk/moira/gen/nagios-wsh.gen
Log:
un-lose change from "nagios" to "nagios3" for dcm and working dir
add default windows tests, including several we've never tested for before
Modified: trunk/moira/gen/nagios-wsh.gen
===================================================================
--- trunk/moira/gen/nagios-wsh.gen 2010-07-09 20:05:47 UTC (rev 4013)
+++ trunk/moira/gen/nagios-wsh.gen 2010-07-22 20:10:20 UTC (rev 4014)
@@ -6,8 +6,14 @@
$MR_DBMS_ERR = 47836421;
$MR_OCONFIG = 47836460;
-$outdir = '/moira/dcm/nagios-wsh';
+$outdir = '/moira/dcm/nagios3-wsh';
+%default_services = ('WINDOWS-CPU', 'WINDOWS-CPU',
+ 'WINDOWS-DISK-C', 'WINDOWS-DISK-C',
+ 'WINDOWS-MEMORY', 'WINDOWS-MEMORY',
+ 'WINDOWS-UPTIME', 'WINDOWS-UPTIME');
+my (%defaults) = %default_services;
+
use DBI;
$dbh = DBI->connect("dbi:Oracle:moira", "moira", "moira")
@@ -16,7 +22,7 @@
$sth0 = $dbh->prepare("SELECT l.list_id, m.name " .
"FROM list l, machine m, serverhosts sh " .
"WHERE sh.value3 = l.name AND sh.service = " .
- "'NAGIOS-WSH' AND m.mach_id = sh.mach_id")
+ "'NAGIOS3-WSH' AND m.mach_id = sh.mach_id")
|| exit $MR_DBMS_ERR;
$sth0->execute;
@@ -81,7 +87,11 @@
while (<@tags>) {
my $service = $_;
chomp $service;
- if ($service =~ /^(FTP|NFS|HTTP|HTTPS|SMTP|SSHD|TELNET|TNS|WINDOWS-UPTIME)$/i) {
+ if ($service =~ /^-DEFAULTS$/) {
+ %defaults = ();
+ } elsif ($service =~ /^WINDOWS-UPTIME$/i) {
+ next; # this is now a default service
+ } elsif ($service =~ /^(FTP|NFS|HTTP|HTTPS|SMTP|SSHD|TELNET|TNS|WINDOWS-DISK-\w)$/i) {
my $ucservice = $service;
$ucservice =~ tr/a-z/A-Z/;
my $lcservice = $service;
@@ -203,6 +213,32 @@
END
}
+ # add default services
+ for (keys %defaults) {
+ chomp;
+ my $service = $_;
+ my $ucservice = $service;
+ $ucservice =~ tr/a-z/A-Z/;
+ my $lcservice = $service;
+ $lcservice =~ tr/A-Z/a-z/;
+ print OUT <<END;
+define service{
+ host_name $name
+ contact_groups wsh
+ use $lcservice-service
+ }
+
+define serviceescalation{
+ host_name $name
+ contact_groups wsh,wsh-mail
+ service_description $ucservice
+ first_notification 2
+ last_notification 0
+ notification_interval 0
+ }
+
+END
+ }
} # while $sth->fetchrow_array
print OUT <<END;