check_bind9.pl: sort perfdata keys
This commit is contained in:
parent
76668f21b4
commit
29fc33a8e7
1 changed files with 16 additions and 17 deletions
|
@ -208,7 +208,8 @@ my @STATUS_KEYS = qw(
|
||||||
tcp_hard_limit
|
tcp_hard_limit
|
||||||
);
|
);
|
||||||
|
|
||||||
my @PERFKEYS = ( @STATS_KEYS, @STATUS_KEYS, );
|
my @TMP = ( @STATS_KEYS, @STATUS_KEYS, );
|
||||||
|
my @PERFKEYS = sort @TMP;
|
||||||
my %PERFDATA = map { ( $_ => 0, ) } @PERFKEYS;
|
my %PERFDATA = map { ( $_ => 0, ) } @PERFKEYS;
|
||||||
|
|
||||||
sub slurp_command {
|
sub slurp_command {
|
||||||
|
@ -339,7 +340,7 @@ for my $status_line ( slurp_command(@RNDC_STATUS) ) {
|
||||||
$PERFDATA{'zones'} = $1;
|
$PERFDATA{'zones'} = $1;
|
||||||
}
|
}
|
||||||
elsif ( $status_line =~ m/debug level: (\d+)/i ) {
|
elsif ( $status_line =~ m/debug level: (\d+)/i ) {
|
||||||
$PERFDATA{'debug'} = $1;
|
$PERFDATA{'debug'} = $1 . q{;1};
|
||||||
}
|
}
|
||||||
elsif ( $status_line =~ m/xfers running: (\d+)/i ) {
|
elsif ( $status_line =~ m/xfers running: (\d+)/i ) {
|
||||||
$PERFDATA{'xfers_running'} = $1;
|
$PERFDATA{'xfers_running'} = $1;
|
||||||
|
@ -405,30 +406,28 @@ print qq{ |};
|
||||||
# http://docs.pnp4nagios.org/pnp-0.6/perfdata_format
|
# http://docs.pnp4nagios.org/pnp-0.6/perfdata_format
|
||||||
|
|
||||||
# Stats keys are all 'Counter' data
|
# Stats keys are all 'Counter' data
|
||||||
for my $k (@STATS_KEYS) {
|
#for my $k (@STATS_KEYS) {
|
||||||
print q{ } , $k , q{=} , $PERFDATA{$k} , q{c};
|
# print q{ } , $k , q{=} , $PERFDATA{$k} , q{c};
|
||||||
}
|
#}
|
||||||
my %EXTRAS = (
|
|
||||||
q{debug} => ';1', # Warning if in debug
|
|
||||||
);
|
|
||||||
if ( $PERFDATA{'udp_soft_limit'} + $PERFDATA{'udp_hard_limit'} > 0 ) {
|
if ( $PERFDATA{'udp_soft_limit'} + $PERFDATA{'udp_hard_limit'} > 0 ) {
|
||||||
|
|
||||||
# Running at soft limit is warning, running at hard limit is critical
|
# Running at soft limit is warning, running at hard limit is critical
|
||||||
|
$PERFDATA{'udp_running'} .= q{;}
|
||||||
$EXTRAS{'udp_running'} = q{;}
|
|
||||||
. ( $PERFDATA{'udp_soft_limit'} || q{} ) . q{;}
|
. ( $PERFDATA{'udp_soft_limit'} || q{} ) . q{;}
|
||||||
. ( $PERFDATA{'udp_hard_limit'} || q{} );
|
. ( $PERFDATA{'udp_hard_limit'} || q{} );
|
||||||
}
|
}
|
||||||
if ( $PERFDATA{'tcp_hard_limit'} ) {
|
if ( $PERFDATA{'tcp_hard_limit'} ) {
|
||||||
|
|
||||||
# Running at hard limit is critical
|
# Running at hard limit is critical
|
||||||
$EXTRAS{'tcp_running'} = q{;;} . $PERFDATA{'tcp_hard_limit'};
|
$PERFDATA{'tcp_running'} .= q{;;} . $PERFDATA{'tcp_hard_limit'};
|
||||||
}
|
}
|
||||||
|
|
||||||
for my $k (@STATUS_KEYS) {
|
for my $k (@PERFKEYS) {
|
||||||
print q{ } , $k , q{=} , $PERFDATA{$k};
|
if ( defined $PERFDATA{$k} ) {
|
||||||
if ( defined $EXTRAS{$k} ) {
|
print q{ } , $k , q{=} , $PERFDATA{$k};
|
||||||
print $EXTRAS{$k};
|
if (grep( /^$k$/, @STATS_KEYS )) {
|
||||||
|
print q{c};
|
||||||
|
}
|
||||||
|
#if ( defined $EXTRAS{$k} ) {
|
||||||
|
# print $EXTRAS{$k};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exit $exit_code;
|
exit $exit_code;
|
||||||
|
|
Loading…
Reference in a new issue