diff options
author | Petter Reinholdtsen <pere@hungry.com> | 2010-01-26 11:15:25 +0000 |
---|---|---|
committer | Petter Reinholdtsen <pere@hungry.com> | 2010-01-26 11:15:25 +0000 |
commit | f6b7ad7f6a33b76c17d2450ff895898d3cd4c540 (patch) | |
tree | 3c1984a8b224034be728dbca91afde31591d9a2e | |
parent | c83aca7e7b7fd38e45b2a2738fa156df76f8e507 (diff) | |
download | sitesummary-f6b7ad7f6a33b76c17d2450ff895898d3cd4c540.tar.gz sitesummary-f6b7ad7f6a33b76c17d2450ff895898d3cd4c540.tar.bz2 sitesummary-f6b7ad7f6a33b76c17d2450ff895898d3cd4c540.tar.xz |
* New function get_debian_ver() reporting /etc/debian_release conten
in SiteSummary perl module.
* Create Nagios hostclass using the result from get_debian_ver().
-rw-r--r-- | SiteSummary.pm | 14 | ||||
-rw-r--r-- | debian/changelog | 3 | ||||
-rwxr-xr-x | sitesummary-nodes | 3 |
3 files changed, 20 insertions, 0 deletions
diff --git a/SiteSummary.pm b/SiteSummary.pm index 78fc71f..beddd4c 100644 --- a/SiteSummary.pm +++ b/SiteSummary.pm @@ -11,6 +11,7 @@ our @EXPORT = qw( for_all_hosts get_debian_edu_profile get_debian_edu_ver + get_debian_ver get_default_route get_dns_address get_filepath_current @@ -249,6 +250,19 @@ sub get_debian_edu_ver { } } +sub get_debian_ver { + my $hostid = shift; + my $path = get_filepath_current($hostid, "/debian/debian_version"); + if (open (my $fh, $path)) { + my $version = <$fh>; + chomp $version; + close($fh); + return $version; + } else { + return undef; + } +} + sub get_hardware_info { my $hostid = shift; my $path = get_filepath_current($hostid, "/system/dmidecode"); diff --git a/debian/changelog b/debian/changelog index f3ffd49..2e9be8d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -5,6 +5,9 @@ sitesummary (0.0.59) UNRELEASED; urgency=low * Remove entries in the cron job before munin and nagios configuration is updated, to not monitor removed hosts another day. + * New function get_debian_ver() reporting /etc/debian_release conten + in SiteSummary perl module. + * Create Nagios hostclass using the result from get_debian_ver(). -- Petter Reinholdtsen <pere@debian.org> Tue, 26 Jan 2010 08:56:53 +0100 diff --git a/sitesummary-nodes b/sitesummary-nodes index 231cb4c..b4bffdc 100755 --- a/sitesummary-nodes +++ b/sitesummary-nodes @@ -241,12 +241,15 @@ sub generate_nagios_config { my $site = get_site($hostid) || "none"; my $sitegroup = get_sitegroup($hostid); + my $debversion = get_debian_ver($hostid); my $eduprofile = get_debian_edu_profile($hostid); my $eduversion = get_debian_edu_ver($hostid); push(@groups, nagios_hostgroup_namewash("site-$site")); if ($sitegroup) { push(@groups, nagios_hostgroup_namewash("site-$site-$sitegroup")); } + push(@groups, nagios_hostgroup_namewash("debian-version-$debversion")) + if defined $debversion; if ($eduprofile) { $eduprofile =~ s/^"|"$//g; # Remove "" around the values for my $profile (split(/,\s*/, $eduprofile)) { |