summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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");