Nagios::Plugin::JUNOS: Added add_common_args().
This commit is contained in:
parent
75c3337376
commit
d051c32019
|
@ -90,33 +90,6 @@ Warning and critical thresholds may be specified in the format documented at
|
|||
http://nagiosplug.sourceforge.net/developer-guidelines.html#THRESHOLDFORMAT.",
|
||||
);
|
||||
|
||||
my @args = (
|
||||
{
|
||||
spec => 'host|H=s',
|
||||
usage => '-H, --host=HOSTNAME',
|
||||
desc => 'Hostname/IP of Juniper box to connect to',
|
||||
default => 'localhost',
|
||||
},
|
||||
{
|
||||
spec => 'port|p=i',
|
||||
usage => '-p, --port=PORT',
|
||||
desc => 'Port to connect to',
|
||||
default => 22,
|
||||
},
|
||||
{
|
||||
spec => 'user|U=s',
|
||||
usage => '-U, --user=USERNAME',
|
||||
desc => 'Username to log into box as',
|
||||
default => 'root',
|
||||
},
|
||||
{
|
||||
spec => 'password|P=s',
|
||||
usage => '-P, --password=PASSWORD',
|
||||
desc => 'Password for login username',
|
||||
default => '<prompt>',
|
||||
},
|
||||
);
|
||||
|
||||
my %checks = (
|
||||
interfaces => \&check_interfaces,
|
||||
chassis_environment => \&check_chassis_environment,
|
||||
|
@ -125,9 +98,7 @@ my %checks = (
|
|||
|
||||
my $junos = undef;
|
||||
|
||||
foreach my $arg (@args) {
|
||||
$plugin->add_arg($arg);
|
||||
}
|
||||
$plugin->add_common_args();
|
||||
|
||||
foreach my $check (keys %checks) {
|
||||
$plugin->add_check_impl($check, $checks{$check});
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#############################################################################
|
||||
# (c) 2012 Sebastian "tokkee" Harl <sh@teamix.net> #
|
||||
# (c) 2011-2012 Sebastian "tokkee" Harl <sh@teamix.net> #
|
||||
# and team(ix) GmbH, Nuernberg, Germany #
|
||||
# #
|
||||
# This file is part of "team(ix) Monitoring Plugins" #
|
||||
|
@ -107,6 +107,42 @@ sub add_arg
|
|||
);
|
||||
}
|
||||
|
||||
sub add_common_args
|
||||
{
|
||||
my $self = shift;
|
||||
|
||||
my @args = (
|
||||
{
|
||||
spec => 'host|H=s',
|
||||
usage => '-H, --host=HOSTNAME',
|
||||
desc => 'Hostname/IP of Juniper box to connect to',
|
||||
default => 'localhost',
|
||||
},
|
||||
{
|
||||
spec => 'port|p=i',
|
||||
usage => '-p, --port=PORT',
|
||||
desc => 'Port to connect to',
|
||||
default => 22,
|
||||
},
|
||||
{
|
||||
spec => 'user|U=s',
|
||||
usage => '-U, --user=USERNAME',
|
||||
desc => 'Username to log into box as',
|
||||
default => 'root',
|
||||
},
|
||||
{
|
||||
spec => 'password|P=s',
|
||||
usage => '-P, --password=PASSWORD',
|
||||
desc => 'Password for login username',
|
||||
default => '<prompt>',
|
||||
},
|
||||
);
|
||||
|
||||
foreach my $arg (@args) {
|
||||
$self->add_arg($arg);
|
||||
}
|
||||
}
|
||||
|
||||
sub add_check_impl
|
||||
{
|
||||
my $self = shift;
|
||||
|
|
Loading…
Reference in a new issue