4 # The following exit codes are defined and MUST BE CONSISTENT with the
5 # error codes the library uses:
6 $MR_DBMS_ERR = 47836421;
7 $MR_OCONFIG = 47836460;
9 $outdir = '/moira/dcm/nagios-colo';
13 $dbh = DBI->connect("dbi:Oracle:moira", "moira", "moira")
16 $sth0 = $dbh->prepare("SELECT l.list_id, m.name " .
17 "FROM list l, machine m, serverhosts sh " .
18 "WHERE sh.value3 = l.name AND sh.service = " .
19 "'NAGIOS-COLO' AND m.mach_id = sh.mach_id")
23 while (($root_list_id, $hostname) = $sth0->fetchrow_array) {
25 open(OUT, ">$outdir/$hostname") || exit $MR_OCONFIG;
26 print OUT "# This file is automatically generated by Moira. Do not edit.\n";
27 $sth = $dbh->prepare("SELECT m.name FROM machine m, imembers i " .
28 "WHERE i.list_id = " . $dbh->quote($root_list_id) .
29 "AND i.member_type = 'MACHINE' AND m.status = 1 " .
30 "AND i.member_id = m.mach_id AND i.direct = 1 ORDER BY m.name")
34 while (($name) = $sth->fetchrow_array) {
35 next if $name eq "[NONE]";
37 push(@allcolohosts, $name);
52 define hostescalation{
54 contact_groups ops,dost-mail
57 notification_interval 0
60 define serviceescalation{
62 contact_groups ops,dost-mail
63 service_description PING
66 notification_interval 0
75 hostgroup_name colo-hosts
77 contact_groups ops,dost
80 print OUT "\tmembers\t\t\t";
83 foreach $host (@allcolohosts) {
84 print OUT "$maybecomma$host";
88 print OUT "\n\t}\n\n";