aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetter Reinholdtsen <pere@hungry.com>2011-12-24 08:32:10 +0000
committerPetter Reinholdtsen <pere@hungry.com>2011-12-24 08:32:10 +0000
commit1d32feb825442eb26e978456d7f3d6ef6463d2b8 (patch)
tree1d499f7e504360ed566ea2b0188af56ee7a566fc
parent75153746eb95b28a4955865ec9b5f01141ae0ddc (diff)
downloadsitesummary-1d32feb825442eb26e978456d7f3d6ef6463d2b8.tar.gz
sitesummary-1d32feb825442eb26e978456d7f3d6ef6463d2b8.tar.bz2
sitesummary-1d32feb825442eb26e978456d7f3d6ef6463d2b8.tar.xz
Make sure DNS, IMAPS and Squid checks can be tested on clients
as well as the server.
-rw-r--r--SiteSummary.pm11
-rw-r--r--debian/changelog4
-rw-r--r--nagios-nrpe-commands.cfg3
-rw-r--r--nagios-templates.cfg2
-rwxr-xr-xsitesummary-nodes6
5 files changed, 21 insertions, 5 deletions
diff --git a/SiteSummary.pm b/SiteSummary.pm
index c8fa9c7..e9f2a93 100644
--- a/SiteSummary.pm
+++ b/SiteSummary.pm
@@ -19,6 +19,7 @@ our @EXPORT = qw(
get_filepath_current
get_hardware_info
get_hostclass
+ get_localhostname
get_hostname
get_linux_kernel_ver
get_macaddresses
@@ -223,6 +224,14 @@ sub get_unique_ether_id {
}
#
+# Return the hostname string as seen on the host itself
+#
+sub get_localhostname {
+ my $hostid = shift;
+ return get_file_string($hostid, "/system/hostname");
+}
+
+#
# Return the hostname string
#
sub get_hostname {
@@ -230,7 +239,7 @@ sub get_hostname {
if (exists $hostmap{$hostid}) {
return $hostmap{$hostid};
} else {
- return get_file_string($hostid, "/system/hostname");
+ return get_localhostname($hostid);
}
}
diff --git a/debian/changelog b/debian/changelog
index e47d6e1..643f7e9 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,4 +1,4 @@
-sitesummary (0.0.74~test0) UNRELEASED; urgency=low
+sitesummary (0.0.74~test1) UNRELEASED; urgency=low
* Add munin include dir to default munin config to match recent
munin versions.
@@ -11,6 +11,8 @@ sitesummary (0.0.74~test0) UNRELEASED; urgency=low
to allow a Nagios server to be another Nagios servers client.
- Fix typo in NRPE rule for check_swap, causing the warning level
to be ignored.
+ - Make sure DNS, IMAPS and Squid checks can be tested on clients
+ as well as the server.
* Collect /etc/lsb-release if present to have more detailed version
information on Ubuntu.
* Add suggests from sitesummary on ldap-utils and cups-client for
diff --git a/nagios-nrpe-commands.cfg b/nagios-nrpe-commands.cfg
index 4bbbeda..2cf40eb 100644
--- a/nagios-nrpe-commands.cfg
+++ b/nagios-nrpe-commands.cfg
@@ -17,3 +17,6 @@ command[check_procs_zombie]=/usr/lib/nagios/plugins/check_procs -w $ARG1$ -c $AR
command[check_shutdown]=/usr/lib/sitesummary/nagios-plugins/check_shutdown
command[check_smtp]=/usr/lib/nagios/plugins/check_smtp -H localhost
command[check_swap]=/usr/lib/nagios/plugins/check_swap -w $ARG1$ -c $ARG2$
+command[check_dns]=/usr/lib/nagios/plugins/check_dns -H $HOSTADDRESS$
+command[check_squid]=/usr/lib/nagios/plugins/check_http -H localhost -p $ARG1$ -u $ARG2$ -e 'HTTP/1.0 200 OK'
+command[check_imaps]=/usr/lib/nagios/plugins/check_imap -p 993 -H localhost -S
diff --git a/nagios-templates.cfg b/nagios-templates.cfg
index 01af7fd..ac539f7 100644
--- a/nagios-templates.cfg
+++ b/nagios-templates.cfg
@@ -165,7 +165,7 @@ define command{
define command{
command_name check_dns
- command_line /usr/lib/nagios/plugins/check_dns -H $HOSTADDRESS$ -s $HOSTADDRESS$
+ command_line /usr/lib/nagios/plugins/check_dns -s $HOSTADDRESS$ -H $ARG1$
}
define command{
diff --git a/sitesummary-nodes b/sitesummary-nodes
index 7438e3d..13c7594 100755
--- a/sitesummary-nodes
+++ b/sitesummary-nodes
@@ -236,6 +236,7 @@ sub generate_nagios_config {
my $hostid = $hostnames{$hostname};
my $address = get_dns_address($hostid);
+ my $localhostname = get_localhostname($hostid);
my $redirect = "";
my $nagiosclient = is_nagios_client($hostid);
@@ -394,8 +395,9 @@ sub generate_nagios_config {
# Check DNS server
print_nagios_service_check($remote, $hostname, "dns",
- "check_dns")
- if is_pkg_installed($hostid, "pdns-server");
+ "check_dns", $localhostname)
+ if (is_pkg_installed($hostid, "pdns-server") ||
+ is_pkg_installed($hostid, "bind9"));
# Check FTP server
print_nagios_service_check($remote, $hostname, "ftp",