Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions check_d42_health.pl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
use File::Basename;
$PROGNAME = basename($0);


my $plugin = Monitoring::Plugin->new(
usage => "Usage: %s [ -v|--verbose ] [-t|--timeout <timeout>]
[ -H|--host=<hostname> ]
Expand Down Expand Up @@ -81,6 +80,7 @@
# Parse arguments and process standard ones (e.g. usage, help, version)
$plugin->getopts;

my $uom = '';

# -- cache variables
my $cache_enabled = $plugin->opts->cache ? 1 : 0;
Expand Down Expand Up @@ -179,7 +179,15 @@
$data_val = 100 - getPercentage('swaptotal', $data_val);
}


if ($plugin->opts->item =~ /swapfree|memfree|disk_used_percent|cpu_used_percent/) {
$uom = '%'
}
elsif ($plugin->opts->item =~ /swaptotal|memtotal|dbsize/) {
$uom = 'MB'
}
else {
$uom = ''
}

# -- process backup status item
if ($plugin->opts->item eq 'backup_status') {
Expand Down Expand Up @@ -230,6 +238,12 @@
$plugin->set_thresholds(warning => $plugin->opts->warning, critical => $plugin->opts->critical);
}

$plugin->add_perfdata(
label => $plugin->opts->item,
value => $data_val,
uom => $uom,
) if ($uom ne '');

# -- compare thresholds
if ($plugin->opts->warning || $plugin->opts->critical) {

Expand Down