aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntoine Beaupré <anarcat@koumbit.org>2015-04-17 17:38:20 -0400
committerAntoine Beaupré <anarcat@koumbit.org>2015-04-17 17:38:20 -0400
commitd56f1f0852963bb44d92917cc582a533ca27f39f (patch)
tree949868573cc92f4a4782511ca7c7cf592993c987
parent795769c39b21be36235b1cc86a17b104ce4afdff (diff)
downloadpuppet-backupninja-d56f1f0852963bb44d92917cc582a533ca27f39f.tar.gz
puppet-backupninja-d56f1f0852963bb44d92917cc582a533ca27f39f.tar.bz2
add state to message
-rwxr-xr-xfiles/checkbackups.pl4
1 files changed, 3 insertions, 1 deletions
diff --git a/files/checkbackups.pl b/files/checkbackups.pl
index f617297..d68d635 100755
--- a/files/checkbackups.pl
+++ b/files/checkbackups.pl
@@ -34,6 +34,7 @@ my $STATE_WARNING=1;
my $STATE_CRITICAL=2;
my $STATE_UNKNOWN=3;
my $STATE_DEPENDENT=4;
+my %ERRORS=(0=>'OK',1=>'WARNING',2=>'CRITICAL',3=>'UNKNOWN',4=>'DEPENDENT');
# gross hack: we look into subdirs to find vservers
my @vserver_dirs = qw{/var/lib/vservers /vservers};
@@ -117,10 +118,11 @@ sub check_age {
sub print_status {
my ($host, $state, $message, $service) = @_;
+ my $state_msg = $ERRORS{$state};
if (!$service) {
$service = 'backups';
}
- printf "$host\t$service\t$state\t$message\n";
+ printf "$host\t$service\t$state\t$state_msg $message\n";
}
sub check_flag {