#!/usr/bin/perl # # Generate list of nodes to load from /etc/munin/munin.conf to check # all the machines reporting to sitesummary. use strict; use warnings; use SiteSummary; use Getopt::Std; sub usage { print <) { if (m/^ii *$pkgname /) { close($fh); return 1 } } close($fh); } return undef; } sub is_munin_client { my $hostid = shift; return is_pkg_installed($hostid, "munin-node"); } sub is_nagios_client { my $hostid = shift; return is_pkg_installed($hostid, "nagios-nrpe-server") || is_pkg_installed($hostid, "nagios-text") || is_pkg_installed($hostid, "nagios2") || is_pkg_installed($hostid, "nagios3"); } sub print_munin_list { for my $hostname (sort keys %hostnames) { next unless (is_munin_client($hostnames{$hostname})); # Using hostname as address, to avoid hardcoding IP addresses in # the file. Might be an idea to fetch the IP address from # system/ifconfig-a print <) { chomp; my ($dev, $partition, $fs, $opts) = split; next if (exists $checked{$partition}); next if ($fs eq "devpts" || $fs eq "autofs" || $fs eq "binfmt_misc" || $fs eq "iso9660" || $fs eq "nfs" || $fs eq "nfsd" || $fs eq "proc" || $fs eq "rootfs" || $fs eq "rpc_pipefs" || $fs eq "sysfs" || $fs eq "tmpfs" || $fs eq "usbfs"); $checked{$partition} = 1; my $warn = 10; my $crit = 5; print < { name => 'samba', package => 'samba' }, 631 => { name => 'CUPS', package => 'cupsys' }, 636 => { name => 'ldaps', package => 'slapd' }, 3128 => { name => 'squid', package => 'squid' }, # 10000 => { name => 'webmin', package => 'webmin' }, ); for my $port (sort { $a <=> $b } keys %tcpservices) { next if (exists $tcpservices{$port}->{package} && ! is_pkg_installed($hostid, $tcpservices{$port}->{package})); my $servicename = $tcpservices{$port}->{name}; print <