aboutsummaryrefslogtreecommitdiffstats
path: root/sitesummary-nodes
diff options
context:
space:
mode:
Diffstat (limited to 'sitesummary-nodes')
-rwxr-xr-xsitesummary-nodes19
1 files changed, 14 insertions, 5 deletions
diff --git a/sitesummary-nodes b/sitesummary-nodes
index e8695ac..7438e3d 100755
--- a/sitesummary-nodes
+++ b/sitesummary-nodes
@@ -9,6 +9,7 @@ use warnings;
use SiteSummary;
use Getopt::Std;
use Socket;
+use File::Temp qw(tempfile);
sub usage {
print <<EOF;
@@ -21,7 +22,7 @@ Usage: $0 [-hmnw]
EOF
}
-# Idea for way to provide overrides for the functions in this script
+# 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 $@;
@@ -31,6 +32,8 @@ my %opts;
getopts("hmnw", \%opts) || (usage(), exit(1));
my %hostnames;
+my $server_hostid = get_localhost_hostid() ||
+ die "Unable to figure out hostid for the local host";
for_all_hosts(\&handle_host);
@@ -60,6 +63,14 @@ sub print_list {
}
}
+sub get_localhost_hostid {
+ my ($fh, $filename) = tempfile();
+ `/sbin/ifconfig -a > $filename`;
+ my $localhost_hostid = get_unique_ether_id($filename);
+ unlink $filename;
+ return $localhost_hostid;
+}
+
# Get an IP address, try to resolve it in DNS , and return the IP
# address if no DNS reverse entry was found.
sub get_dnsnameorip {
@@ -107,10 +118,8 @@ sub print_ip_hw_list {
sub is_remote_nagios_client {
my $hostid = shift;
- return is_pkg_installed($hostid, "nagios-nrpe-server") && !
- (is_pkg_installed($hostid, "nagios-text") ||
- is_pkg_installed($hostid, "nagios2") ||
- is_pkg_installed($hostid, "nagios3"));
+ return is_pkg_installed($hostid, "nagios-nrpe-server") &&
+ $server_hostid ne $hostid;
}
# Return information about the switches connected to a given host, as