diff options
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; |