diff options
| -rw-r--r-- | debian/changelog | 5 | ||||
| -rwxr-xr-x | sitesummary-nodes | 33 | 
2 files changed, 32 insertions, 6 deletions
diff --git a/debian/changelog b/debian/changelog index 445d76f..d3cdbb0 100644 --- a/debian/changelog +++ b/debian/changelog @@ -7,6 +7,11 @@ sitesummary (0.0.57~svn61900) UNRELEASED; urgency=low    * Add Vcs-Browser and Vcs-Svn entries in control file.    * Use switch information collected using cdpr to specify Nagios      host parent relationships. +  * Allow numbers in Nagios host class names. +  * Create Nagios host groups for Debian Edu profile and version +    settings. +  * Mention ignored laptops in generated Nagios config to make it +    easier to figure out why a machine is not monitored.   -- Petter Reinholdtsen <pere@debian.org>  Thu, 21 Jan 2010 20:21:50 +0100 diff --git a/sitesummary-nodes b/sitesummary-nodes index 0b5b673..385359e 100755 --- a/sitesummary-nodes +++ b/sitesummary-nodes @@ -187,7 +187,7 @@ EOF  sub nagios_hostgroup_namewash {      my $name = shift; -    $name =~ s/[^a-zA-Z_-]+/-/g; # Avoid illegal characteres +    $name =~ s/[^0-9a-zA-Z_-]+/-/g; # Avoid illegal characteres      return $name;  } @@ -233,12 +233,31 @@ sub generate_nagios_config {          my $remote = is_remote_nagios_client($hostid);          my $nrpestatus = is_remote_nrpe_config_active($hostid); +        # Only check laptops that have the nagios tools installed +        if (is_laptop($hostid) && ! $remote && ! $nagiosclient) { +            print "# Skipping laptop $hostname\n"; +            next; +        } +          my $site = get_site($hostid) || "none";          my $sitegroup = get_sitegroup($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"));          } +        if ($eduprofile) { +            $eduprofile =~ s/^"|"$//g; # Remove "" around the values +            for my $profile (split(/,\s*/, $eduprofile)) { +                push(@groups, +                     nagios_hostgroup_namewash("edu-profile-$profile")); +            } +        } +        if ($eduversion) { +            $eduversion =~ s/^"|"$//g; # Remove "" around the values +            push(@groups, nagios_hostgroup_namewash("edu-version-$eduversion")); +        }          my $hostclass = get_hostclass($hostid) || "none";          push(@groups, nagios_hostgroup_namewash("hostclass-$hostclass")); @@ -247,9 +266,6 @@ sub generate_nagios_config {              $hostgroup{$group} = 1;          } -        # Only check laptops that have the nagios tools installed -        next if is_laptop($hostid) && ! $remote && ! $nagiosclient; -          my $defaultroute = get_dnsnameorip(get_default_route($hostid));          # Also check default route host @@ -426,7 +442,12 @@ sub generate_nagios_config {              if (is_pkg_installed($hostid, "cron"));      } -    for my $name (sort keys %hostgroup) { -        print_nagios_hostgroup($name) +    if (%hostgroup) { +        print <<EOF; +##################### host groups ####################### +EOF +        for my $name (sort keys %hostgroup) { +            print_nagios_hostgroup($name); +        }      }  }  | 
