summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Sulfrian <alexander@sulfrian.net>2014-02-14 03:24:56 +0100
committerAlexander Sulfrian <alexander@sulfrian.net>2014-02-14 04:36:57 +0100
commit45d24754154efca6caba08b206ccad195558a610 (patch)
tree0ad24b2ccb97f0c8447f7e32c9491aa71719be75
parent79463d4b3e779a8ae1026df3fe2b816754c8dee2 (diff)
downloadvserver-monitoring-45d24754154efca6caba08b206ccad195558a610.tar.gz
vserver-monitoring-45d24754154efca6caba08b206ccad195558a610.tar.bz2
vserver-monitoring-45d24754154efca6caba08b206ccad195558a610.zip
add domain switch
-rwxr-xr-xcheck_load14
-rwxr-xr-xcheck_mem14
2 files changed, 26 insertions, 2 deletions
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");
diff --git a/check_mem b/check_mem
index 1455d8b..e33cdb0 100755
--- a/check_mem
+++ b/check_mem
@@ -12,7 +12,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."
);
@@ -29,6 +29,13 @@ sub init_nagios_plugin() {
label => "RANGE[,RANGE[,RANGE[,RANGE]]]",
);
+ $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;
}
@@ -110,6 +117,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");