check_junos, Nagios::Plugin::JUNOS: Pass $plugin and $junos to check subs.
This commit is contained in:
parent
8e12d7e44c
commit
85c8c6d28f
|
@ -178,7 +178,9 @@ sub send_query
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub check_interface {
|
sub check_interface
|
||||||
|
{
|
||||||
|
my $plugin = shift;
|
||||||
my $iface = shift;
|
my $iface = shift;
|
||||||
my $opts = shift || {};
|
my $opts = shift || {};
|
||||||
my @targets = @_;
|
my @targets = @_;
|
||||||
|
@ -403,6 +405,8 @@ sub get_liface_marker
|
||||||
|
|
||||||
sub check_interfaces
|
sub check_interfaces
|
||||||
{
|
{
|
||||||
|
my $plugin = shift;
|
||||||
|
my $junos = shift;
|
||||||
my @targets = @_;
|
my @targets = @_;
|
||||||
|
|
||||||
my $opts = {
|
my $opts = {
|
||||||
|
@ -427,7 +431,7 @@ sub check_interfaces
|
||||||
|
|
||||||
foreach my $iface (@interfaces) {
|
foreach my $iface (@interfaces) {
|
||||||
my $name = get_iface_name($iface);
|
my $name = get_iface_name($iface);
|
||||||
my $status = check_interface($iface, $opts, @targets);
|
my $status = check_interface($plugin, $iface, $opts, @targets);
|
||||||
|
|
||||||
if ($status == 0) {
|
if ($status == 0) {
|
||||||
++$down_count;
|
++$down_count;
|
||||||
|
@ -459,7 +463,7 @@ sub check_interfaces
|
||||||
|
|
||||||
my @phy_interfaces = get_interfaces($junos, {}, $phy_name);
|
my @phy_interfaces = get_interfaces($junos, {}, $phy_name);
|
||||||
foreach my $phy_iface (@phy_interfaces) {
|
foreach my $phy_iface (@phy_interfaces) {
|
||||||
if (check_interface($phy_iface, {}, $phy_name) == 0) {
|
if (check_interface($plugin, $phy_iface, {}, $phy_name) == 0) {
|
||||||
++$phys_down_count;
|
++$phys_down_count;
|
||||||
push @phys_down_ifaces, "$name -> $phy_name";
|
push @phys_down_ifaces, "$name -> $phy_name";
|
||||||
}
|
}
|
||||||
|
@ -496,6 +500,8 @@ sub check_interfaces
|
||||||
|
|
||||||
sub check_chassis_environment
|
sub check_chassis_environment
|
||||||
{
|
{
|
||||||
|
my $plugin = shift;
|
||||||
|
my $junos = shift;
|
||||||
my @targets = @_;
|
my @targets = @_;
|
||||||
|
|
||||||
my $res = send_query($junos, 'get_environment_information');
|
my $res = send_query($junos, 'get_environment_information');
|
||||||
|
@ -589,6 +595,8 @@ sub check_chassis_environment
|
||||||
|
|
||||||
sub check_system_storage
|
sub check_system_storage
|
||||||
{
|
{
|
||||||
|
my $plugin = shift;
|
||||||
|
my $junos = shift;
|
||||||
my @targets = @_;
|
my @targets = @_;
|
||||||
|
|
||||||
my $res = send_query($junos, 'get_system_storage');
|
my $res = send_query($junos, 'get_system_storage');
|
||||||
|
|
|
@ -346,7 +346,7 @@ sub run_checks
|
||||||
);
|
);
|
||||||
|
|
||||||
my $sub = $self->get_check_impl($check->{'name'});
|
my $sub = $self->get_check_impl($check->{'name'});
|
||||||
$sub->(@targets);
|
$sub->($self, $self->{'junos'}, @targets);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue