#!/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; my %opts; getopts("m", \%opts); my %hostnames; for_all_hosts(\&handle_host); if ($opts{'m'}) { print_munin_list(); } else { print_list(); } sub handle_host { my $hostid = shift; my $hostname = get_hostname($hostid); $hostnames{$hostname} = $hostid; } sub print_list { for my $hostname (sort keys %hostnames) { print "$hostname\n"; } } sub is_munin_client { my $hostid = shift; # Should check debian/dpkg-l for 'ii *munin-node ' 1; # Assume all nodes are munin nodes for now } sub print_munin_list { for my $hostname (sort keys %hostnames) { return 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 <