diff options
Diffstat (limited to 'check_mem')
-rwxr-xr-x | check_mem | 15 |
1 files changed, 14 insertions, 1 deletions
@@ -19,7 +19,8 @@ our %desc = ( 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 memory of vserver guests." ); @@ -43,6 +44,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; } @@ -143,6 +152,10 @@ my (%warn, %crit); ($warn{'vm'}, $warn{'rss'}, $warn{'anon'}, $warn{'vml'}) = parse_thresholds($n->opts->w); ($crit{'vm'}, $crit{'rss'}, $crit{'anon'}, $crit{'vml'}) = parse_thresholds($n->opts->c); +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; |