Refs #5396
This commit is contained in:
parent
32329f4a9a
commit
a63ba0e27c
|
@ -33,13 +33,13 @@
|
||||||
#
|
#
|
||||||
####################################################################################
|
####################################################################################
|
||||||
|
|
||||||
package hardware::routers::fritzbox::mode::dns1;
|
package network::fritzbox::mode::dns1;
|
||||||
|
|
||||||
use base qw(centreon::plugins::mode);
|
use base qw(centreon::plugins::mode);
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use hardware::routers::fritzbox::mode::libgetdata;
|
use network::fritzbox::mode::libgetdata;
|
||||||
|
|
||||||
sub new {
|
sub new {
|
||||||
my ($class, %options) = @_;
|
my ($class, %options) = @_;
|
||||||
|
@ -50,10 +50,8 @@ sub new {
|
||||||
$options{options}->add_options(arguments =>
|
$options{options}->add_options(arguments =>
|
||||||
{
|
{
|
||||||
"hostname:s" => { name => 'hostname' },
|
"hostname:s" => { name => 'hostname' },
|
||||||
"port:s" => { name => 'port', default => '49000' },
|
"port:s" => { name => 'port', default => 49000 },
|
||||||
"timeout:s" => { name => 'timeout', default => 30 },
|
"timeout:s" => { name => 'timeout', default => 30 },
|
||||||
"warning:s" => { name => 'warning', default => '' },
|
|
||||||
"critical:s" => { name => 'critical', default => '' },
|
|
||||||
});
|
});
|
||||||
return $self;
|
return $self;
|
||||||
}
|
}
|
||||||
|
@ -77,15 +75,14 @@ sub run {
|
||||||
$self->{uri} = 'urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1';
|
$self->{uri} = 'urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1';
|
||||||
$self->{space} = 'GetAddonInfos';
|
$self->{space} = 'GetAddonInfos';
|
||||||
$self->{section} = 'NewDNSServer1';
|
$self->{section} = 'NewDNSServer1';
|
||||||
my $IP = hardware::routers::fritzbox::mode::libgetdata::getdata($self);
|
my $IP = network::fritzbox::mode::libgetdata::getdata($self);
|
||||||
#print $IP . "\n";
|
#print $IP . "\n";
|
||||||
|
|
||||||
if ($IP =~ /^((([0-9]{1,2}|1[0-9]{2}|2[0-4][0-9]|25[0-5])[.]){3}([0-9]{1,2}|1[0-9]{2}|2[0-4][0-9]|25[0-5]))$/) {
|
if ($IP =~ /^((([0-9]{1,2}|1[0-9]{2}|2[0-4][0-9]|25[0-5])[.]){3}([0-9]{1,2}|1[0-9]{2}|2[0-4][0-9]|25[0-5]))$/) {
|
||||||
$exit_code = 'ok';
|
$exit_code = 'ok';
|
||||||
} else {
|
} else {
|
||||||
$exit_code = 'critical';
|
$exit_code = 'critical';
|
||||||
};
|
}
|
||||||
|
|
||||||
|
|
||||||
$self->{output}->output_add(severity => $exit_code,
|
$self->{output}->output_add(severity => $exit_code,
|
||||||
short_msg => sprintf("Your current DNS-Server is " . $IP));
|
short_msg => sprintf("Your current DNS-Server is " . $IP));
|
|
@ -33,13 +33,13 @@
|
||||||
#
|
#
|
||||||
####################################################################################
|
####################################################################################
|
||||||
|
|
||||||
package hardware::routers::fritzbox::mode::dns2;
|
package network::fritzbox::mode::dns2;
|
||||||
|
|
||||||
use base qw(centreon::plugins::mode);
|
use base qw(centreon::plugins::mode);
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use hardware::routers::fritzbox::mode::libgetdata;
|
use network::fritzbox::mode::libgetdata;
|
||||||
|
|
||||||
sub new {
|
sub new {
|
||||||
my ($class, %options) = @_;
|
my ($class, %options) = @_;
|
||||||
|
@ -50,10 +50,8 @@ sub new {
|
||||||
$options{options}->add_options(arguments =>
|
$options{options}->add_options(arguments =>
|
||||||
{
|
{
|
||||||
"hostname:s" => { name => 'hostname' },
|
"hostname:s" => { name => 'hostname' },
|
||||||
"port:s" => { name => 'port', default => '49000' },
|
"port:s" => { name => 'port', default => 49000 },
|
||||||
"timeout:s" => { name => 'timeout', default => 30 },
|
"timeout:s" => { name => 'timeout', default => 30 },
|
||||||
"warning:s" => { name => 'warning', default => '' },
|
|
||||||
"critical:s" => { name => 'critical', default => '' },
|
|
||||||
});
|
});
|
||||||
return $self;
|
return $self;
|
||||||
}
|
}
|
||||||
|
@ -77,15 +75,14 @@ sub run {
|
||||||
$self->{uri} = 'urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1';
|
$self->{uri} = 'urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1';
|
||||||
$self->{space} = 'GetAddonInfos';
|
$self->{space} = 'GetAddonInfos';
|
||||||
$self->{section} = 'NewDNSServer2';
|
$self->{section} = 'NewDNSServer2';
|
||||||
my $IP = hardware::routers::fritzbox::mode::libgetdata::getdata($self);
|
my $IP = network::fritzbox::mode::libgetdata::getdata($self);
|
||||||
#print $IP . "\n";
|
#print $IP . "\n";
|
||||||
|
|
||||||
if ($IP =~ /^((([0-9]{1,2}|1[0-9]{2}|2[0-4][0-9]|25[0-5])[.]){3}([0-9]{1,2}|1[0-9]{2}|2[0-4][0-9]|25[0-5]))$/) {
|
if ($IP =~ /^((([0-9]{1,2}|1[0-9]{2}|2[0-4][0-9]|25[0-5])[.]){3}([0-9]{1,2}|1[0-9]{2}|2[0-4][0-9]|25[0-5]))$/) {
|
||||||
$exit_code = 'ok';
|
$exit_code = 'ok';
|
||||||
} else {
|
} else {
|
||||||
$exit_code = 'critical';
|
$exit_code = 'critical';
|
||||||
};
|
}
|
||||||
|
|
||||||
|
|
||||||
$self->{output}->output_add(severity => $exit_code,
|
$self->{output}->output_add(severity => $exit_code,
|
||||||
short_msg => sprintf("Your current DNS-Server is " . $IP));
|
short_msg => sprintf("Your current DNS-Server is " . $IP));
|
|
@ -33,13 +33,13 @@
|
||||||
#
|
#
|
||||||
####################################################################################
|
####################################################################################
|
||||||
|
|
||||||
package hardware::routers::fritzbox::mode::externalip;
|
package network::fritzbox::mode::externalip;
|
||||||
|
|
||||||
use base qw(centreon::plugins::mode);
|
use base qw(centreon::plugins::mode);
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use hardware::routers::fritzbox::mode::libgetdata;
|
use network::fritzbox::mode::libgetdata;
|
||||||
|
|
||||||
sub new {
|
sub new {
|
||||||
my ($class, %options) = @_;
|
my ($class, %options) = @_;
|
||||||
|
@ -50,10 +50,8 @@ sub new {
|
||||||
$options{options}->add_options(arguments =>
|
$options{options}->add_options(arguments =>
|
||||||
{
|
{
|
||||||
"hostname:s" => { name => 'hostname' },
|
"hostname:s" => { name => 'hostname' },
|
||||||
"port:s" => { name => 'port', default => '49000' },
|
"port:s" => { name => 'port', default => 49000 },
|
||||||
"timeout:s" => { name => 'timeout', default => 30 },
|
"timeout:s" => { name => 'timeout', default => 30 },
|
||||||
"warning:s" => { name => 'warning', default => '' },
|
|
||||||
"critical:s" => { name => 'critical', default => '' },
|
|
||||||
});
|
});
|
||||||
return $self;
|
return $self;
|
||||||
}
|
}
|
||||||
|
@ -77,15 +75,14 @@ sub run {
|
||||||
$self->{uri} = 'urn:schemas-upnp-org:service:WANIPConnection:1';
|
$self->{uri} = 'urn:schemas-upnp-org:service:WANIPConnection:1';
|
||||||
$self->{space} = 'GetExternalIPAddress';
|
$self->{space} = 'GetExternalIPAddress';
|
||||||
$self->{section} = 'NewExternalIPAddress';
|
$self->{section} = 'NewExternalIPAddress';
|
||||||
my $IP = hardware::routers::fritzbox::mode::libgetdata::getdata($self);
|
my $IP = network::fritzbox::mode::libgetdata::getdata($self);
|
||||||
#print $IP . "\n";
|
#print $IP . "\n";
|
||||||
|
|
||||||
if ($IP =~ /^((([0-9]{1,2}|1[0-9]{2}|2[0-4][0-9]|25[0-5])[.]){3}([0-9]{1,2}|1[0-9]{2}|2[0-4][0-9]|25[0-5]))$/) {
|
if ($IP =~ /^((([0-9]{1,2}|1[0-9]{2}|2[0-4][0-9]|25[0-5])[.]){3}([0-9]{1,2}|1[0-9]{2}|2[0-4][0-9]|25[0-5]))$/) {
|
||||||
$exit_code = 'ok';
|
$exit_code = 'ok';
|
||||||
} else {
|
} else {
|
||||||
$exit_code = 'critical';
|
$exit_code = 'critical';
|
||||||
};
|
}
|
||||||
|
|
||||||
|
|
||||||
$self->{output}->output_add(severity => $exit_code,
|
$self->{output}->output_add(severity => $exit_code,
|
||||||
short_msg => sprintf("Your current IP-Address is " . $IP));
|
short_msg => sprintf("Your current IP-Address is " . $IP));
|
|
@ -33,7 +33,7 @@
|
||||||
#
|
#
|
||||||
####################################################################################
|
####################################################################################
|
||||||
|
|
||||||
package hardware::routers::fritzbox::mode::libgetdata;
|
package network::fritzbox::mode::libgetdata;
|
||||||
|
|
||||||
use base qw(centreon::plugins::mode);
|
use base qw(centreon::plugins::mode);
|
||||||
|
|
|
@ -33,15 +33,14 @@
|
||||||
#
|
#
|
||||||
####################################################################################
|
####################################################################################
|
||||||
|
|
||||||
package hardware::routers::fritzbox::mode::traffic;
|
package network::fritzbox::mode::traffic;
|
||||||
|
|
||||||
use base qw(centreon::plugins::mode);
|
use base qw(centreon::plugins::mode);
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use centreon::plugins::misc;
|
use centreon::plugins::misc;
|
||||||
use centreon::plugins::statefile;
|
use centreon::plugins::statefile;
|
||||||
use Digest::MD5 qw(md5_hex);
|
use network::fritzbox::mode::libgetdata;
|
||||||
use hardware::routers::fritzbox::mode::libgetdata;
|
|
||||||
|
|
||||||
sub new {
|
sub new {
|
||||||
my ($class, %options) = @_;
|
my ($class, %options) = @_;
|
||||||
|
@ -54,12 +53,12 @@ sub new {
|
||||||
"hostname:s" => { name => 'hostname' },
|
"hostname:s" => { name => 'hostname' },
|
||||||
"port:s" => { name => 'port', default => '49000' },
|
"port:s" => { name => 'port', default => '49000' },
|
||||||
"timeout:s" => { name => 'timeout', default => 30 },
|
"timeout:s" => { name => 'timeout', default => 30 },
|
||||||
"warning:s" => { name => 'warning', default => '' },
|
"warning-in:s" => { name => 'warning_in', },
|
||||||
"critical:s" => { name => 'critical', default => '' },
|
"critical-in:s" => { name => 'critical_in', },
|
||||||
|
"warning-out:s" => { name => 'warning_out', },
|
||||||
|
"critical-out:s" => { name => 'critical_out', },
|
||||||
"units:s" => { name => 'units', default => 'B' },
|
"units:s" => { name => 'units', default => 'B' },
|
||||||
});
|
});
|
||||||
$self->{result} = {};
|
|
||||||
$self->{hostname} = undef;
|
|
||||||
$self->{statefile_value} = centreon::plugins::statefile->new(%options);
|
$self->{statefile_value} = centreon::plugins::statefile->new(%options);
|
||||||
return $self;
|
return $self;
|
||||||
}
|
}
|
||||||
|
@ -91,16 +90,13 @@ sub check_options {
|
||||||
|
|
||||||
$self->{statefile_value}->check_options(%options);
|
$self->{statefile_value}->check_options(%options);
|
||||||
$self->{hostname} = $self->{option_results}->{hostname};
|
$self->{hostname} = $self->{option_results}->{hostname};
|
||||||
if (!defined($self->{hostname})) {
|
|
||||||
$self->{hostname} = 'me';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sub run {
|
sub run {
|
||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
my $new_datas = {};
|
my $new_datas = {};
|
||||||
$self->{statefile_value}->read(statefile => "cache_linux_local_" . $self->{hostname} . '_' . $self->{mode} . '_' . (defined($self->{option_results}->{name}) ? md5_hex($self->{option_results}->{name}) : md5_hex('all')));
|
$self->{statefile_value}->read(statefile => "cache_fritzbox_" . $self->{hostname} . '_' . $self->{mode});
|
||||||
$new_datas->{last_timestamp} = time();
|
$new_datas->{last_timestamp} = time();
|
||||||
my $old_timestamp = $self->{statefile_value}->get(name => 'last_timestamp');
|
my $old_timestamp = $self->{statefile_value}->get(name => 'last_timestamp');
|
||||||
|
|
||||||
|
@ -110,22 +106,22 @@ sub run {
|
||||||
|
|
||||||
$self->{space} = 'GetAddonInfos';
|
$self->{space} = 'GetAddonInfos';
|
||||||
$self->{section} = 'NewTotalBytesSent';
|
$self->{section} = 'NewTotalBytesSent';
|
||||||
my $NewTotalBytesSent = hardware::routers::fritzbox::mode::libgetdata::getdata($self);
|
my $NewTotalBytesSent = network::fritzbox::mode::libgetdata::getdata($self);
|
||||||
#print $NewTotalBytesSent . "\n";
|
#print $NewTotalBytesSent . "\n";
|
||||||
|
|
||||||
$self->{space} = 'GetAddonInfos';
|
$self->{space} = 'GetAddonInfos';
|
||||||
$self->{section} = 'NewTotalBytesReceived';
|
$self->{section} = 'NewTotalBytesReceived';
|
||||||
my $NewTotalBytesReceived = hardware::routers::fritzbox::mode::libgetdata::getdata($self);
|
my $NewTotalBytesReceived = network::fritzbox::mode::libgetdata::getdata($self);
|
||||||
#print $NewTotalBytesReceived . "\n";
|
#print $NewTotalBytesReceived . "\n";
|
||||||
|
|
||||||
$self->{space} = 'GetCommonLinkProperties';
|
$self->{space} = 'GetCommonLinkProperties';
|
||||||
$self->{section} = 'NewLayer1UpstreamMaxBitRate';
|
$self->{section} = 'NewLayer1UpstreamMaxBitRate';
|
||||||
my $NewLayer1UpstreamMaxBitRate = hardware::routers::fritzbox::mode::libgetdata::getdata($self);
|
my $NewLayer1UpstreamMaxBitRate = network::fritzbox::mode::libgetdata::getdata($self);
|
||||||
#print $NewLayer1UpstreamMaxBitRate . "\n";
|
#print $NewLayer1UpstreamMaxBitRate . "\n";
|
||||||
|
|
||||||
$self->{space} = 'GetCommonLinkProperties';
|
$self->{space} = 'GetCommonLinkProperties';
|
||||||
$self->{section} = 'NewLayer1DownstreamMaxBitRate';
|
$self->{section} = 'NewLayer1DownstreamMaxBitRate';
|
||||||
my $NewLayer1DownstreamMaxBitRate = hardware::routers::fritzbox::mode::libgetdata::getdata($self);
|
my $NewLayer1DownstreamMaxBitRate = network::fritzbox::mode::libgetdata::getdata($self);
|
||||||
#print $NewLayer1DownstreamMaxBitRate . "\n";
|
#print $NewLayer1DownstreamMaxBitRate . "\n";
|
||||||
### GET DATA END
|
### GET DATA END
|
||||||
|
|
||||||
|
@ -137,20 +133,24 @@ sub run {
|
||||||
# calc ($VAR / 8)
|
# calc ($VAR / 8)
|
||||||
$NewLayer1UpstreamMaxBitRate = ($NewLayer1UpstreamMaxBitRate / 8);
|
$NewLayer1UpstreamMaxBitRate = ($NewLayer1UpstreamMaxBitRate / 8);
|
||||||
$NewLayer1DownstreamMaxBitRate = ($NewLayer1DownstreamMaxBitRate / 8);
|
$NewLayer1DownstreamMaxBitRate = ($NewLayer1DownstreamMaxBitRate / 8);
|
||||||
$new_datas->{'in'} = ($NewTotalBytesReceived);
|
$new_datas->{in} = ($NewTotalBytesReceived);
|
||||||
$new_datas->{'out'} = ($NewTotalBytesSent);
|
$new_datas->{out} = ($NewTotalBytesSent);
|
||||||
|
$self->{statefile_value}->write(data => $new_datas);
|
||||||
|
|
||||||
my $old_in = $self->{statefile_value}->get(name => 'in');
|
my $old_in = $self->{statefile_value}->get(name => 'in');
|
||||||
my $old_out = $self->{statefile_value}->get(name => 'out');
|
my $old_out = $self->{statefile_value}->get(name => 'out');
|
||||||
if (!defined($old_timestamp) || !defined($old_in) || !defined($old_out)) {
|
if (!defined($old_timestamp) || !defined($old_in) || !defined($old_out)) {
|
||||||
#next;
|
$self->{output}->output_add(severity => 'OK',
|
||||||
print "ERROR";
|
short_msg => "Buffer creation...");
|
||||||
|
$self->{output}->display();
|
||||||
|
$self->{output}->exit();
|
||||||
}
|
}
|
||||||
if ($new_datas->{'in'} < $old_in) {
|
|
||||||
|
if ($new_datas->{in} < $old_in) {
|
||||||
# We set 0. Has reboot.
|
# We set 0. Has reboot.
|
||||||
$old_in = 0;
|
$old_in = 0;
|
||||||
}
|
}
|
||||||
if ($new_datas->{'out'} < $old_out) {
|
if ($new_datas->{out} < $old_out) {
|
||||||
# We set 0. Has reboot.
|
# We set 0. Has reboot.
|
||||||
$old_out = 0;
|
$old_out = 0;
|
||||||
}
|
}
|
||||||
|
@ -160,8 +160,8 @@ sub run {
|
||||||
# At least one second. two fast calls ;)
|
# At least one second. two fast calls ;)
|
||||||
$time_delta = 1;
|
$time_delta = 1;
|
||||||
}
|
}
|
||||||
my $in_absolute_per_sec = ($new_datas->{'in'} - $old_in) / $time_delta;
|
my $in_absolute_per_sec = ($new_datas->{in} - $old_in) / $time_delta;
|
||||||
my $out_absolute_per_sec = ($new_datas->{'out'} - $old_out) / $time_delta;
|
my $out_absolute_per_sec = ($new_datas->{out} - $old_out) / $time_delta;
|
||||||
|
|
||||||
my ($exit, $in_prct, $out_prct);
|
my ($exit, $in_prct, $out_prct);
|
||||||
|
|
||||||
|
@ -175,8 +175,6 @@ sub run {
|
||||||
$in_prct = sprintf("%.2f", $in_prct);
|
$in_prct = sprintf("%.2f", $in_prct);
|
||||||
$out_prct = sprintf("%.2f", $out_prct);
|
$out_prct = sprintf("%.2f", $out_prct);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Manage Output
|
### Manage Output
|
||||||
my ($in_value, $in_unit) = $self->{perfdata}->change_bytes(value => $in_absolute_per_sec, network => 1);
|
my ($in_value, $in_unit) = $self->{perfdata}->change_bytes(value => $in_absolute_per_sec, network => 1);
|
||||||
my ($out_value, $out_unit) = $self->{perfdata}->change_bytes(value => $out_absolute_per_sec, network => 1);
|
my ($out_value, $out_unit) = $self->{perfdata}->change_bytes(value => $out_absolute_per_sec, network => 1);
|
||||||
|
@ -203,11 +201,7 @@ sub run {
|
||||||
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical-out', total => $NewLayer1UpstreamMaxBitRate),
|
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical-out', total => $NewLayer1UpstreamMaxBitRate),
|
||||||
min => 0, max => $NewLayer1UpstreamMaxBitRate);
|
min => 0, max => $NewLayer1UpstreamMaxBitRate);
|
||||||
|
|
||||||
$self->{statefile_value}->write(data => $new_datas);
|
|
||||||
if (!defined($old_timestamp)) {
|
|
||||||
$self->{output}->output_add(severity => 'OK',
|
|
||||||
short_msg => "Buffer creation...");
|
|
||||||
}
|
|
||||||
|
|
||||||
$self->{output}->display();
|
$self->{output}->display();
|
||||||
$self->{output}->exit();
|
$self->{output}->exit();
|
|
@ -33,13 +33,13 @@
|
||||||
#
|
#
|
||||||
####################################################################################
|
####################################################################################
|
||||||
|
|
||||||
package hardware::routers::fritzbox::mode::upstatus;
|
package network::fritzbox::mode::upstatus;
|
||||||
|
|
||||||
use base qw(centreon::plugins::mode);
|
use base qw(centreon::plugins::mode);
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use hardware::routers::fritzbox::mode::libgetdata;
|
use network::fritzbox::mode::libgetdata;
|
||||||
use POSIX;
|
use POSIX;
|
||||||
|
|
||||||
sub new {
|
sub new {
|
||||||
|
@ -53,8 +53,8 @@ sub new {
|
||||||
"hostname:s" => { name => 'hostname' },
|
"hostname:s" => { name => 'hostname' },
|
||||||
"port:s" => { name => 'port', default => '49000' },
|
"port:s" => { name => 'port', default => '49000' },
|
||||||
"timeout:s" => { name => 'timeout', default => 30 },
|
"timeout:s" => { name => 'timeout', default => 30 },
|
||||||
"warning:s" => { name => 'warning', default => '' },
|
"warning:s" => { name => 'warning', },
|
||||||
"critical:s" => { name => 'critical', default => '' },
|
"critical:s" => { name => 'critical', },
|
||||||
"seconds" => { name => 'seconds', },
|
"seconds" => { name => 'seconds', },
|
||||||
});
|
});
|
||||||
return $self;
|
return $self;
|
||||||
|
@ -88,12 +88,12 @@ sub run {
|
||||||
|
|
||||||
$self->{space} = 'GetCommonLinkProperties';
|
$self->{space} = 'GetCommonLinkProperties';
|
||||||
$self->{section} = 'NewWANAccessType';
|
$self->{section} = 'NewWANAccessType';
|
||||||
my $WANAccessType = hardware::routers::fritzbox::mode::libgetdata::getdata($self);
|
my $WANAccessType = network::fritzbox::mode::libgetdata::getdata($self);
|
||||||
#print "Type: " . $WANAccessType . "\n";
|
#print "Type: " . $WANAccessType . "\n";
|
||||||
|
|
||||||
$self->{space} = 'GetCommonLinkProperties';
|
$self->{space} = 'GetCommonLinkProperties';
|
||||||
$self->{section} = 'NewPhysicalLinkStatus';
|
$self->{section} = 'NewPhysicalLinkStatus';
|
||||||
my $LinkStatus = hardware::routers::fritzbox::mode::libgetdata::getdata($self);
|
my $LinkStatus = network::fritzbox::mode::libgetdata::getdata($self);
|
||||||
#print "Physical Link is: " . $LinkStatus . "\n";
|
#print "Physical Link is: " . $LinkStatus . "\n";
|
||||||
|
|
||||||
$self->{pfad} = '/upnp/control/WANIPConn1';
|
$self->{pfad} = '/upnp/control/WANIPConn1';
|
||||||
|
@ -101,26 +101,26 @@ sub run {
|
||||||
|
|
||||||
$self->{space} = 'GetStatusInfo';
|
$self->{space} = 'GetStatusInfo';
|
||||||
$self->{section} = 'NewUptime';
|
$self->{section} = 'NewUptime';
|
||||||
my $uptime = hardware::routers::fritzbox::mode::libgetdata::getdata($self);
|
my $uptime = network::fritzbox::mode::libgetdata::getdata($self);
|
||||||
#print "Internet is Connected since: " . $uptime . " seconds\n";
|
#print "Internet is Connected since: " . $uptime . " seconds\n";
|
||||||
#print "Internet is Connected since: " . floor($uptime / 60 / 60 / 24) . " days\n";
|
#print "Internet is Connected since: " . floor($uptime / 60 / 60 / 24) . " days\n";
|
||||||
|
|
||||||
$self->{space} = 'GetStatusInfo';
|
$self->{space} = 'GetStatusInfo';
|
||||||
$self->{section} = 'NewConnectionStatus';
|
$self->{section} = 'NewConnectionStatus';
|
||||||
my $ConnectionStatus = hardware::routers::fritzbox::mode::libgetdata::getdata($self);
|
my $ConnectionStatus = network::fritzbox::mode::libgetdata::getdata($self);
|
||||||
#print "Internet is: " . $ConnectionStatus . "\n";
|
#print "Internet is: " . $ConnectionStatus . "\n";
|
||||||
|
|
||||||
$exit_code = $self->{perfdata}->threshold_check(value => floor($uptime),
|
$exit_code = $self->{perfdata}->threshold_check(value => floor($uptime),
|
||||||
threshold => [ { label => 'critical', 'exit_litteral' => 'critical' },
|
threshold => [ { label => 'critical', exit_litteral => 'critical' },
|
||||||
{ label => 'warning', exit_litteral => 'warning' } ]);
|
{ label => 'warning', exit_litteral => 'warning' } ]);
|
||||||
|
|
||||||
if ($LinkStatus !~ /^up$/i) {
|
if ($LinkStatus !~ /^up$/i) {
|
||||||
$exit_code = 'critical';
|
$exit_code = 'critical';
|
||||||
};
|
}
|
||||||
|
|
||||||
if ($ConnectionStatus !~ /^connected$/i) {
|
if ($ConnectionStatus !~ /^connected$/i) {
|
||||||
$exit_code = 'critical';
|
$exit_code = 'critical';
|
||||||
};
|
}
|
||||||
|
|
||||||
$self->{output}->perfdata_add(label => 'uptime',
|
$self->{output}->perfdata_add(label => 'uptime',
|
||||||
value => floor($uptime),
|
value => floor($uptime),
|
|
@ -74,7 +74,7 @@
|
||||||
#NewExternalIPAddress : 133.71.33.7
|
#NewExternalIPAddress : 133.71.33.7
|
||||||
####################################################################################
|
####################################################################################
|
||||||
|
|
||||||
package hardware::routers::fritzbox::plugin;
|
package network::fritzbox::plugin;
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
|
@ -89,11 +89,11 @@ sub new {
|
||||||
|
|
||||||
$self->{version} = '0.1';
|
$self->{version} = '0.1';
|
||||||
%{$self->{modes}} = (
|
%{$self->{modes}} = (
|
||||||
'upstatus' => 'hardware::routers::fritzbox::mode::upstatus',
|
'upstatus' => 'network::fritzbox::mode::upstatus',
|
||||||
'traffic' => 'hardware::routers::fritzbox::mode::traffic',
|
'traffic' => 'network::fritzbox::mode::traffic',
|
||||||
'externalip' => 'hardware::routers::fritzbox::mode::externalip',
|
'externalip' => 'network::fritzbox::mode::externalip',
|
||||||
'dns1' => 'hardware::routers::fritzbox::mode::dns1',
|
'dns1' => 'network::fritzbox::mode::dns1',
|
||||||
'dns2' => 'hardware::routers::fritzbox::mode::dns2',
|
'dns2' => 'network::fritzbox::mode::dns2',
|
||||||
);
|
);
|
||||||
return $self;
|
return $self;
|
||||||
}
|
}
|
Loading…
Reference in New Issue