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 /sitesummary-nodes | |
| parent | ef052761c51b00238d11f13e53a2293a214b2578 (diff) | |
| download | sitesummary-719414b5a7604ab762c21aff015f7dccc2c83973.tar.gz sitesummary-719414b5a7604ab762c21aff015f7dccc2c83973.tar.bz2 sitesummary-719414b5a7604ab762c21aff015f7dccc2c83973.tar.xz | |
Create Nagios hostclass for sitesummary hostclass.
Diffstat (limited to 'sitesummary-nodes')
| -rwxr-xr-x | sitesummary-nodes | 16 |
1 files changed, 9 insertions, 7 deletions
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; |
