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);
41 contact_groups ops-printers
47 contact_groups ops-printers
51 define hostescalation{
53 contact_groups ops-printers
56 notification_interval 0
59 define serviceescalation{
61 contact_groups ops-printers
62 service_description PING
65 notification_interval 0
68 define serviceescalation{
70 contact_groups ops-printers
71 service_description HPJD
74 notification_interval 0
83 hostgroup_name printers
85 contact_groups ops-printers
88 print OUT "\tmembers\t\t";
91 foreach $printer (@allprinters) {
92 print OUT "$maybecomma$printer";
96 print OUT "\n\t}\n\n";