diff options
author | Petter Reinholdtsen <pere@hungry.com> | 2010-01-21 13:42:24 +0000 |
---|---|---|
committer | Petter Reinholdtsen <pere@hungry.com> | 2010-01-21 13:42:24 +0000 |
commit | 719414b5a7604ab762c21aff015f7dccc2c83973 (patch) | |
tree | 51b8468afe2ba91dbd76ea07e41736e0a4a15106 | |
parent | ef052761c51b00238d11f13e53a2293a214b2578 (diff) | |
download | sitesummary-719414b5a7604ab762c21aff015f7dccc2c83973.tar.gz sitesummary-719414b5a7604ab762c21aff015f7dccc2c83973.tar.bz2 sitesummary-719414b5a7604ab762c21aff015f7dccc2c83973.tar.xz |
Create Nagios hostclass for sitesummary hostclass.
-rw-r--r-- | debian/changelog | 6 | ||||
-rwxr-xr-x | sitesummary-nodes | 16 |
2 files changed, 15 insertions, 7 deletions
diff --git a/debian/changelog b/debian/changelog index ddc7a03..d71efb4 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +sitesummary (0.0.57~svnX) UNRELEASED; urgency=low + + * Create Nagios hostclass for sitesummary hostclass. + + -- Petter Reinholdtsen <pere@debian.org> Thu, 21 Jan 2010 11:26:58 +0100 + sitesummary (0.0.56) unstable; urgency=low * Replace Nagios main config file with one based on the current one diff --git a/sitesummary-nodes b/sitesummary-nodes index 635d4a4..8baeb54 100755 --- a/sitesummary-nodes +++ b/sitesummary-nodes @@ -157,7 +157,7 @@ EOF sub nagios_hostgroup_namewash { my $name = shift; - $name =~ s/[^a-zA-Z_-]/-/g; # Avoid illegal characteres + $name =~ s/[^a-zA-Z_-]+/-/g; # Avoid illegal characteres return $name; } @@ -204,15 +204,17 @@ sub generate_nagios_config { my $site = get_site($hostid) || "none"; my $sitegroup = get_sitegroup($hostid); - my $groupname = nagios_hostgroup_namewash("site-$site"); - $hostgroup{$groupname} = 1; - push(@groups, $groupname); + push(@groups, nagios_hostgroup_namewash("site-$site")); if ($sitegroup) { - $groupname = nagios_hostgroup_namewash("site-$site-$sitegroup"); - $hostgroup{$groupname} = 1; - push(@groups, $groupname); + push(@groups, nagios_hostgroup_namewash("site-$site-$sitegroup")); } + my $hostclass = get_hostclass($hostid) || "none"; + push(@groups, nagios_hostgroup_namewash("hostclass-$hostclass")); + + for my $group ( @groups ) { + $hostgroup{$group} = 1; + } # Only check laptops that have the nagios tools installed next if is_laptop($hostid) && ! $remote && ! $nagiosclient; |