aboutsummaryrefslogtreecommitdiffstats
path: root/sitesummary-nodes
diff options
context:
space:
mode:
Diffstat (limited to 'sitesummary-nodes')
-rwxr-xr-xsitesummary-nodes32
1 files changed, 25 insertions, 7 deletions
diff --git a/sitesummary-nodes b/sitesummary-nodes
index 2ff836c..1f91226 100755
--- a/sitesummary-nodes
+++ b/sitesummary-nodes
@@ -22,11 +22,13 @@ Usage: $0 [-hmnw]
EOF
}
+our @ssh_hosts = ();
+
# Idea for way to provide overrides for the functions in this script
-#eval 'require "/etc/sitesummary/sitesummary-nodes-override"';
-#if ($@ && $@ !~ qr{^Can't locate /etc/sitesummary/sitesummary-nodes-override}) {
-# die $@;
-#};
+eval 'require "/etc/sitesummary/sitesummary-nodes-override"';
+if ($@ && $@ !~ qr{^Can't locate /etc/sitesummary/sitesummary-nodes-override}) {
+ die $@;
+};
my %opts;
getopts("hmnw", \%opts) || (usage(), exit(1));
@@ -62,6 +64,16 @@ if ($opts{'h'}) {
}
exit 0;
+sub is_ssh_host {
+ my ($host) = @_;
+
+ for (@ssh_hosts) {
+ return 1 if $_ eq $host;
+ }
+
+ return 0;
+}
+
sub handle_host {
my $hostid = shift;
my $address = get_dns_address($hostid);
@@ -188,7 +200,12 @@ sub print_nagios_service_check {
return if exists $nagios_ignore{"$hostname $description"};
my $cmd;
if ($remote) {
- $cmd = "check_nrpe!$check";
+ if (is_ssh_host($hostname)) {
+ $cmd = "check_ssh!$check";
+ } else {
+ $cmd = "check_nrpe!$check";
+ }
+
if (defined $check_args) {
$check_args =~ s/!/ /g;
$cmd .= " -a $check_args";
@@ -259,6 +276,7 @@ sub generate_nagios_config {
my $redirect = "";
my $nagiosclient = is_nagios_client($hostid);
my $remote = is_remote_nagios_client($hostid);
+ my $sshhost = is_ssh_host($hostname);
my $nrpestatus = is_remote_nrpe_config_active($hostid);
# Only check laptops that have the nagios tools installed
@@ -389,7 +407,7 @@ sub generate_nagios_config {
# The rest of the checks only work if NRPE is installed and configured
next unless ((!$remote && $nagiosclient)
- || ($remote && defined $nrpestatus));
+ || ($remote && (defined $nrpestatus || $sshhost)));
# These work without any argument passing.
@@ -464,7 +482,7 @@ sub generate_nagios_config {
# These need argument passing (as in dont_blame_nrpe=1)
next unless ((!$remote && $nagiosclient)
- || ($remote && "args" eq $nrpestatus));
+ || ($remote && ("args" eq $nrpestatus || $sshhost)));
print_nagios_service_check($remote, $hostname, "swap",
"check_swap", "10%!5%");