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 $outfile = '/moira/dcm/nagios-printers.out';
13 $dbh = DBI->connect("dbi:Oracle:moira", "moira", "moira")
16 $sth = $dbh->prepare("SELECT m.name FROM machine m, printers p " .
17 "WHERE (p.type = 'DORM' OR p.type ='CLUSTER') " .
18 "AND p.mach_id = m.mach_id AND m.status=1")
21 $sth->execute || exit $MR_DBMS_ERR;
24 open(OUT, ">$outfile") || exit $MR_OCONFIG;
25 print OUT "# This File is automatically generated by Moira. Do not edit.\n";
27 while (($name) = $sth->fetchrow_array) {
28 next if $name eq "[NONE]";
30 push(@allprinters, $name);
36 contact_groups ops-printers
42 contact_groups ops-printers
48 contact_groups ops-printers
52 define hostescalation{
54 contact_groups ops-printers
57 notification_interval 0
60 define serviceescalation{
62 contact_groups ops-printers
63 service_description PING
66 notification_interval 0
69 define serviceescalation{
71 contact_groups ops-printers
72 service_description HPJD
75 notification_interval 0
84 hostgroup_name printers
88 print OUT "\tmembers\t\t";
91 foreach $printer (@allprinters) {
92 print OUT "$maybecomma$printer";
96 print OUT "\n\t}\n\n";