diff options
author | Alexander Sulfrian <alexander@sulfrian.net> | 2014-02-14 03:24:56 +0100 |
---|---|---|
committer | Alexander Sulfrian <alexander@sulfrian.net> | 2014-02-14 04:36:57 +0100 |
commit | 45d24754154efca6caba08b206ccad195558a610 (patch) | |
tree | 0ad24b2ccb97f0c8447f7e32c9491aa71719be75 /check_load | |
parent | 79463d4b3e779a8ae1026df3fe2b816754c8dee2 (diff) | |
download | vserver-monitoring-45d24754154efca6caba08b206ccad195558a610.tar.gz vserver-monitoring-45d24754154efca6caba08b206ccad195558a610.tar.bz2 vserver-monitoring-45d24754154efca6caba08b206ccad195558a610.zip |
add domain switch
Diffstat (limited to 'check_load')
-rwxr-xr-x | check_load | 14 |
1 files changed, 13 insertions, 1 deletions
@@ -11,7 +11,7 @@ our $VERSION = '1.6'; sub init_nagios_plugin() { my $plugin = Nagios::Plugin->new( usage => "Usage: %s [-h|--help] [-w|--warnings=...] " . - "[-c|--critical=...] vserver-name", + "[-c|--critical=...] [-d|--domain=...] [vserver-name]", version => $VERSION, blurb => "This plugin could monitor the load of single vserver guests." ); @@ -28,6 +28,13 @@ sub init_nagios_plugin() { label => "INTEGER[,INTEGER[,INTEGER]]", ); + $plugin->add_arg( + spec => 'd|domain=s', + help => 'Domainname to append in bulk mode or to stip ' . + 'in single host mode.', + label => "DOMAIN", + ); + return $plugin; } @@ -102,6 +109,11 @@ unless ($vserver) { $n->nagios_exit(UNKNOWN, "vserver name required"); } +my $domain = ''; +$domain = ('.' . $n->opts->d) if $n->opts->d; +$domain = quotemeta $domain; +$vserver =~ s/$domain$//; + my $context = VServer::get_context_id($vserver); unless ($context) { $n->nagios_exit(UNKNOWN, "vserver '$vserver' not found"); |