version 1.4, 2007/01/10 00:47:53 |
version 1.5, 2007/01/10 01:17:44 |
|
|
#!/usr/bin/perl -T |
#!/usr/bin/perl -T |
# $RedRiver: check_rrd,v 1.3 2006/11/10 22:58:37 andrew Exp $ |
# $RedRiver: check_rrd,v 1.4 2007/01/10 00:47:53 andrew Exp $ |
######################################################################## |
######################################################################## |
# check_rrd *** A nagios check for changing averages in rrds |
# check_rrd *** A nagios check for changing averages in rrds |
# |
# |
|
|
my $new = shift; |
my $new = shift; |
|
|
foreach (@{ $new }) { |
foreach (@{ $new }) { |
my ($check, $vals) = split /=/, $_, 2; |
my ($check, $vals); |
unless ($vals) { |
if ($_ =~ /=/) { |
$vals = $check; |
($check, $vals) = split /=/, $_, 2; |
|
} else { |
|
$vals = $_; |
$check = 'default'; |
$check = 'default'; |
} |
} |
|
|
my ($DS, $key) = split /:/, $check, 2; |
my ($DS, $key) = split /:/, $check, 2; |
$DS ||= 'default'; |
$DS ||= 'default'; |
$key ||= 'abs'; |
$key ||= 'abs'; |
|
|
my ($min, $max) = split /:/, $vals; |
my ($min, $max) = split /:/, $vals; |
|
|
$checks->{$DS}->{$key}->{$type}->{'max'} = $max |
$checks->{$DS}->{$key}->{$type}->{'max'} = $max; |
if defined $max && length $max; |
$checks->{$DS}->{$key}->{$type}->{'min'} = $min; |
$checks->{$DS}->{$key}->{$type}->{'min'} = $min |
|
if defined $min && length $min; |
|
} |
} |
} |
} |