From 45d24754154efca6caba08b206ccad195558a610 Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Fri, 14 Feb 2014 03:24:56 +0100 Subject: add domain switch --- check_load | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'check_load') diff --git a/check_load b/check_load index 02ffed2..9f76b78 100755 --- a/check_load +++ b/check_load @@ -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"); -- cgit v1.2.3-1-g7c22