diff options
author | Petter Reinholdtsen <pere@hungry.com> | 2007-05-20 15:47:21 +0000 |
---|---|---|
committer | Petter Reinholdtsen <pere@hungry.com> | 2007-05-20 15:47:21 +0000 |
commit | 2b69ed92dfd4f48612890cb2fe189d17075e2904 (patch) | |
tree | c42c9b6263fe00d5933f5524c850cc279dda2fdc /SiteSummary.pm | |
parent | 4e61781b4575c33b56e1589ffef620b070c9b0ce (diff) | |
download | sitesummary-2b69ed92dfd4f48612890cb2fe189d17075e2904.tar.gz sitesummary-2b69ed92dfd4f48612890cb2fe189d17075e2904.tar.bz2 sitesummary-2b69ed92dfd4f48612890cb2fe189d17075e2904.tar.xz |
[ Petter Reinholdtsen ]
* New perl function get_hostname() available from the SiteSummary
perl module.
* Add script sitesummary-nodes to list all reporting nodes. Use -m
to list them in the format expected in /etc/munin/munin.conf.
Diffstat (limited to 'SiteSummary.pm')
-rw-r--r-- | SiteSummary.pm | 43 |
1 files changed, 26 insertions, 17 deletions
diff --git a/SiteSummary.pm b/SiteSummary.pm index f710e15..fec7b09 100644 --- a/SiteSummary.pm +++ b/SiteSummary.pm @@ -12,9 +12,10 @@ our @EXPORT = qw( get_filepath_current get_site get_sitegroup + get_hostname get_linux_kernel_ver - get_debian_edu_profile - get_debian_edu_ver + get_debian_edu_profile + get_debian_edu_ver ); my $pwd = "/var/lib/sitesummary/entries"; # Path to the entries @@ -65,6 +66,14 @@ sub get_sitegroup { } # +# Return the hostname string +# +sub get_hostname { + my $hostid = shift; + return get_file_string($hostid, "/system/hostname"); +} + +# # Return Linux kernel version for the machines using Linux. # sub get_linux_kernel_ver { @@ -77,7 +86,7 @@ sub get_linux_kernel_ver { s/\#.+$//; next if (/^\s*$/); my @f = (split(/\s+/, $_)); - $kver = $f[1] if ("Linux" eq $f[0]); + $kver = $f[1] if ("Linux" eq $f[0]); } close(FILE); return $kver; @@ -90,16 +99,16 @@ sub get_debian_edu_profile { my $hostid = shift; my $path = get_filepath_current($hostid, $debian_edu_config); if ( ! -e $path ) { - return undef; + return undef; } if (open (FILE, $path)) { - while (<FILE>) { - chomp; + while (<FILE>) { + chomp; s/\#.+$//; - next if not (/PROFILE/); - s/^PROFILE=//; - return $_; - } + next if not (/PROFILE/); + s/^PROFILE=//; + return $_; + } } close(FILE); } @@ -108,16 +117,16 @@ sub get_debian_edu_ver { my $hostid = shift; my $path = get_filepath_current($hostid, $debian_edu_config); if ( ! -e $path ) { - return undef; + return undef; } if (open (FILE, $path)) { - while (<FILE>) { - chomp; + while (<FILE>) { + chomp; s/\#.+$//; - next if not (/VERSION/); - s/^VERSION=//; - return $_; - } + next if not (/VERSION/); + s/^VERSION=//; + return $_; + } } } |