Home Directory

Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com

Login

Remember Me

Directory Tree

Directory

murilobaliego

Reviews(1)
bymurilobaliego, March 3, 2017
check_nagiostats
Hi, thanks for this pluging, as was searching for a pluging as I'm using one Nagios server to monitor other Nagios Servers.

I just changed the subroutine check_s_count() to show warning if any service is warning, same idea to critical services.

sub check_s_count(){
my $line;
my $counter_service_checks=0;
my $counter_warning=0;
my $counter_critical=0;

open (FILE, $file)
or die $!;
$/ = "";

foreach $line(){
if($line=~/servicestatus/){
$counter_service_checks++;
}

if($line=~/plugin_output/){
if($line=~/WARNING/){
$counter_warning++;
}
}
if($line=~/plugin_output/){
if($line=~/CRITICAL/){
$counter_critical++;
}
}
}

close (FILE);

# filling vars for print
$text=("Service Checks: $counter_service_checks - Service Warning: $counter_warning - Service Critial: $counter_critical");
$perfdat=("count=$counter_service_checks");

# this ugly thing is needed to return OK:
$warning=2;
$critical=3;

$value=1;
if($counter_warning>0){
$value=$warning;
}
if($counter_critical>0){
$value=$critical;
}

}