diff options
| -rw-r--r-- | debian/changelog | 2 | ||||
| -rwxr-xr-x | sitesummary-nodes | 97 | 
2 files changed, 65 insertions, 34 deletions
diff --git a/debian/changelog b/debian/changelog index 757d253..3cbb4e3 100644 --- a/debian/changelog +++ b/debian/changelog @@ -9,6 +9,8 @@ sitesummary (0.0.38) UNRELEASED; urgency=low        address.      - Ignore filesystem types autofs, binfmt_misc, iso9660, nfsd and usbfs        when generating nagios checks. +    - More automatically configured Nagios checks based on the +      old Debian Edu configuration.   -- Petter Reinholdtsen <pere@debian.org>  Sun,  1 Jun 2008 01:19:50 +0200 diff --git a/sitesummary-nodes b/sitesummary-nodes index 1dbe7d9..e08efcd 100755 --- a/sitesummary-nodes +++ b/sitesummary-nodes @@ -32,7 +32,7 @@ sub in_dns {  sub handle_host {      my $hostid = shift; -    my $address = get_dns_hostname($hostid); +    my $address = get_dns_address($hostid);      $hostnames{$address} = $hostid;  } @@ -103,24 +103,50 @@ define host {  define service {          use                 server-service          host_name           $hostname -        service_description ping +        service_description PING          check_command       check_ping!100.0,20%!500.0,60%  }  EOF -            print <<EOF if is_pkg_installed($hostid, "openssh-server"); +        # check disk free space +        my $path = get_filepath_current($hostid, "/system/procmounts"); +        if ( -e $path ) { +            open (F, "<", $path) || die "unable to read from $path"; +            my %checked; +            while (<F>) { +                chomp; +                my ($dev, $partition, $fs, $opts) = split; +                next if (exists $checked{$partition}); +                next if ($fs eq "devpts" || +                         $fs eq "autofs" || +                         $fs eq "binfmt_misc" || +                         $fs eq "iso9660" || +                         $fs eq "nfsd" || +                         $fs eq "proc" || +                         $fs eq "rootfs" || +                         $fs eq "rpc_pipefs" || +                         $fs eq "sysfs" || +                         $fs eq "tmpfs" || +                         $fs eq "usbfs"); + +                $checked{$partition} = 1; +                my $warn = 10; +                my $crit = 5; +                print <<EOF;  define service {          use                 server-service          host_name           $hostname -        service_description ssh -        check_command       check_ssh +        service_description Disk $partition +        check_command       check_disk!$warn%!$crit%!$partition  }  EOF +            } +        }          my %tcpservices =          (           139  => { name => 'samba',   package => 'samba' }, -         631  => { name => 'cups',    package => 'cupsys' }, +         631  => { name => 'CUPS',    package => 'cupsys' },           636  => { name => 'ldaps',   package => 'slapd' },           3128 => { name => 'squid',   package => 'squid' },  #       10000 => { name => 'webmin',  package => 'webmin' }, @@ -147,39 +173,42 @@ EOF          # check X font server          # check LDAP          # check DNS -        # check disk free space -        my $path = get_filepath_current($hostid, "/system/procmounts"); -        if ( -e $path ) { -            open (F, "<", $path) || die "unable to read from $path"; -            my %checked; -            while (<F>) { -                chomp; -                my ($dev, $partition, $fs, $opts) = split; -                next if (exists $checked{$partition}); -                next if ($fs eq "devpts" || -                         $fs eq "autofs" || -                         $fs eq "binfmt_misc" || -                         $fs eq "iso9660" || -                         $fs eq "nfsd" || -                         $fs eq "proc" || -                         $fs eq "rootfs" || -                         $fs eq "rpc_pipefs" || -                         $fs eq "sysfs" || -                         $fs eq "tmpfs" || -                         $fs eq "usbfs"); - -                $checked{$partition} = 1; -                my $warn = 10; -                my $crit = 5; -                print <<EOF; +        # Check SSH server +        print <<EOF if is_pkg_installed($hostid, "openssh-server");  define service {          use                 server-service          host_name           $hostname -        service_description Disk $partition -        check_command       check_disk!$warn%!$crit%!$partition +        service_description SSH +        check_command       check_ssh  }  EOF -            } +        print <<EOF if (is_pkg_installed($hostid, "apache") || +                        is_pkg_installed($hostid, "apache2")); +define service { +        use                 server-service +        host_name           $hostname +        service_description HTTP +        check_command       check_http          } +EOF + +        print <<EOF if (is_pkg_installed($hostid, "ntp") || +                        is_pkg_installed($hostid, "ntp-server")); +define service { +        use                 server-service +        host_name           $hostname +        service_description Time server NTP +        check_command       check_ntp!-H!localhost +} +EOF +        # Check unix load +        print <<EOF; +define service { +        use                 server-service +        host_name           $hostname +        service_description Load as in top +        check_command       check_load!75,75,75!90,90,90 +} +EOF      }  }  | 
