enhance barracuda cloudgen

This commit is contained in:
garnier-quentin 2019-07-05 14:08:22 +02:00
parent 4f3cb9439c
commit 0d91f2f350
6 changed files with 38 additions and 58 deletions

View File

@ -24,7 +24,6 @@ use base qw(centreon::plugins::templates::counter);
use strict;
use warnings;
use Digest::MD5 qw(md5_hex);
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold);
sub custom_status_output {
@ -69,15 +68,14 @@ sub prefix_services_output {
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options, statefile => 1);
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$options{options}->add_options(arguments =>
{
"filter-name:s" => { name => 'filter_name' },
"warning-status:s" => { name => 'warning_status', default => '' },
"critical-status:s" => { name => 'critical_status', default => '%{status} !~ /^started$/i' },
});
$options{options}->add_options(arguments => {
'filter-name:s' => { name => 'filter_name' },
'warning-status:s' => { name => 'warning_status', default => '' },
'critical-status:s' => { name => 'critical_status', default => '%{status} !~ /^started$/i' },
});
return $self;
}
@ -140,10 +138,6 @@ sub manage_selection {
$self->{output}->add_option_msg(short_msg => "No services found.");
$self->{output}->option_exit();
}
$self->{cache_name} = "barracuda_cloudgen_" . $self->{mode} . '_' . $options{snmp}->get_hostname() . '_' . $options{snmp}->get_port() . '_' .
(defined($self->{option_results}->{filter_counters}) ? md5_hex($self->{option_results}->{filter_counters}) : md5_hex('all')) . '_' .
(defined($self->{option_results}->{filter_name}) ? md5_hex($self->{option_results}->{filter_name}) : md5_hex('all'));
}
1;

View File

@ -57,9 +57,8 @@ sub new {
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$options{options}->add_options(arguments =>
{
});
$options{options}->add_options(arguments => {
});
return $self;
}

View File

@ -30,10 +30,9 @@ sub new {
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$options{options}->add_options(arguments =>
{
"filter-name:s" => { name => 'filter_name' },
});
$options{options}->add_options(arguments => {
'filter-name:s' => { name => 'filter_name' },
});
$self->{vpn} = {};
return $self;

View File

@ -24,7 +24,6 @@ use base qw(centreon::plugins::templates::counter);
use strict;
use warnings;
use Digest::MD5 qw(md5_hex);
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold);
sub custom_status_output {
@ -69,15 +68,14 @@ sub prefix_services_output {
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options, statefile => 1);
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$options{options}->add_options(arguments =>
{
"filter-name:s" => { name => 'filter_name' },
"warning-status:s" => { name => 'warning_status', default => '' },
"critical-status:s" => { name => 'critical_status', default => '%{status} !~ /^started$/i' },
});
$options{options}->add_options(arguments => {
'filter-name:s' => { name => 'filter_name' },
'warning-status:s' => { name => 'warning_status', default => '' },
'critical-status:s' => { name => 'critical_status', default => '%{status} !~ /^started$/i' },
});
return $self;
}
@ -140,10 +138,6 @@ sub manage_selection {
$self->{output}->add_option_msg(short_msg => "No services found.");
$self->{output}->option_exit();
}
$self->{cache_name} = "barracuda_cloudgen_" . $self->{mode} . '_' . $options{snmp}->get_hostname() . '_' . $options{snmp}->get_port() . '_' .
(defined($self->{option_results}->{filter_counters}) ? md5_hex($self->{option_results}->{filter_counters}) : md5_hex('all')) . '_' .
(defined($self->{option_results}->{filter_name}) ? md5_hex($self->{option_results}->{filter_name}) : md5_hex('all'));
}
1;

View File

@ -24,7 +24,6 @@ use base qw(centreon::plugins::templates::counter);
use strict;
use warnings;
use Digest::MD5 qw(md5_hex);
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold);
sub custom_status_output {
@ -69,16 +68,15 @@ sub prefix_vpns_output {
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options, statefile => 1);
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$options{options}->add_options(arguments =>
{
"filter-name:s" => { name => 'filter_name' },
"warning-status:s" => { name => 'warning_status', default => '' },
"critical-status:s" => { name => 'critical_status', default => '%{status} =~ /^down$/i' },
});
$options{options}->add_options(arguments => {
'filter-name:s' => { name => 'filter_name' },
'warning-status:s' => { name => 'warning_status', default => '' },
'critical-status:s' => { name => 'critical_status', default => '%{status} =~ /^down$/i' },
});
return $self;
}
@ -138,10 +136,6 @@ sub manage_selection {
$self->{output}->add_option_msg(short_msg => "No VPNs found.");
$self->{output}->option_exit();
}
$self->{cache_name} = "barracuda_cloudgen_" . $self->{mode} . '_' . $options{snmp}->get_hostname() . '_' . $options{snmp}->get_port() . '_' .
(defined($self->{option_results}->{filter_counters}) ? md5_hex($self->{option_results}->{filter_counters}) : md5_hex('all')) . '_' .
(defined($self->{option_results}->{filter_name}) ? md5_hex($self->{option_results}->{filter_name}) : md5_hex('all'));
}
1;

View File

@ -31,20 +31,20 @@ sub new {
$self->{version} = '1.0';
%{$self->{modes}} = (
'cpu' => 'snmp_standard::mode::cpu',
'cpu-detailed' => 'snmp_standard::mode::cpudetailed',
'box-service' => 'network::barracuda::cloudgen::snmp::mode::boxservice',
'hardware' => 'network::barracuda::cloudgen::snmp::mode::hardware',
'interfaces' => 'snmp_standard::mode::interfaces',
'list-interfaces' => 'snmp_standard::mode::listinterfaces',
'list-vpns' => 'network::barracuda::cloudgen::snmp::mode::listvpns',
'load' => 'snmp_standard::mode::loadaverage',
'memory' => 'snmp_standard::mode::memory',
'server-service' => 'network::barracuda::cloudgen::snmp::mode::serverservice',
'storage' => 'snmp_standard::mode::storage',
'uptime' => 'snmp_standard::mode::uptime',
'vpn-status' => 'network::barracuda::cloudgen::snmp::mode::vpnstatus',
);
'cpu' => 'snmp_standard::mode::cpu',
'cpu-detailed' => 'snmp_standard::mode::cpudetailed',
'box-service' => 'network::barracuda::cloudgen::snmp::mode::boxservice',
'hardware' => 'network::barracuda::cloudgen::snmp::mode::hardware',
'interfaces' => 'snmp_standard::mode::interfaces',
'list-interfaces' => 'snmp_standard::mode::listinterfaces',
'list-vpns' => 'network::barracuda::cloudgen::snmp::mode::listvpns',
'load' => 'snmp_standard::mode::loadaverage',
'memory' => 'snmp_standard::mode::memory',
'server-service' => 'network::barracuda::cloudgen::snmp::mode::serverservice',
'storage' => 'snmp_standard::mode::storage',
'uptime' => 'snmp_standard::mode::uptime',
'vpn-status' => 'network::barracuda::cloudgen::snmp::mode::vpnstatus',
);
return $self;
}