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.",
|
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 = (
|
my %checks = (
|
||||||
interfaces => \&check_interfaces,
|
interfaces => \&check_interfaces,
|
||||||
chassis_environment => \&check_chassis_environment,
|
chassis_environment => \&check_chassis_environment,
|
||||||
|
@ -125,9 +98,7 @@ my %checks = (
|
||||||
|
|
||||||
my $junos = undef;
|
my $junos = undef;
|
||||||
|
|
||||||
foreach my $arg (@args) {
|
$plugin->add_common_args();
|
||||||
$plugin->add_arg($arg);
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach my $check (keys %checks) {
|
foreach my $check (keys %checks) {
|
||||||
$plugin->add_check_impl($check, $checks{$check});
|
$plugin->add_check_impl($check, $checks{$check});
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#############################################################################
|
#############################################################################
|
||||||
# (c) 2012 Sebastian "tokkee" Harl <sh@teamix.net> #
|
# (c) 2011-2012 Sebastian "tokkee" Harl <sh@teamix.net> #
|
||||||
# and team(ix) GmbH, Nuernberg, Germany #
|
# and team(ix) GmbH, Nuernberg, Germany #
|
||||||
# #
|
# #
|
||||||
# This file is part of "team(ix) Monitoring Plugins" #
|
# This file is part of "team(ix) Monitoring Plugins" #
|
||||||
# URL: http://oss.teamix.org/projects/monitoringplugins/ #
|
# URL: http://oss.teamix.org/projects/monitoringplugins/ #
|
||||||
|
@ -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
|
sub add_check_impl
|
||||||
{
|
{
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
|
|
Loading…
Reference in a new issue