summaryrefslogtreecommitdiffstats
path: root/check_load
diff options
context:
space:
mode:
Diffstat (limited to 'check_load')
-rwxr-xr-xcheck_load15
1 files changed, 14 insertions, 1 deletions
diff --git a/check_load b/check_load
index 59a8554..ac2db4d 100755
--- a/check_load
+++ b/check_load
@@ -12,7 +12,8 @@ our $VERSION = '1.6';
sub init_nagios_plugin() {
my $plugin = Nagios::Plugin->new(
usage => "Usage: %s [-h|--help] [-w|--warnings=...] " .
- "[-c|--critical=...] [-d|--domain=...] [vserver-name]",
+ "[-c|--critical=...] [-d|--domain=...] " .
+ "[-s|--service=...] [vserver-name]",
version => $VERSION,
blurb => "This plugin could monitor the load of vserver guests."
);
@@ -36,6 +37,14 @@ sub init_nagios_plugin() {
label => "DOMAIN",
);
+ $plugin->add_arg(
+ spec => 's|service=s',
+ help => 'Name of the service, as defined in the config of ' .
+ 'the monitoring server. (default: ' .
+ Nagios::Plugin::Functions::get_shortname() . ')',
+ label => 'SERVICE',
+ );
+
return $plugin;
}
@@ -138,6 +147,10 @@ for my $load (qw( load1 load5 load15 )) {
}
}
+if ($n->opts->s && $n->opts->s =~ m/(\w[\w\/]*\w)/) {
+ $ENV{'NAGIOS_PLUGIN'} = $1;
+}
+
my $domain = '';
$domain = ('.' . $n->opts->d) if $n->opts->d;