enhance barracuda cloudgen
This commit is contained in:
parent
4f3cb9439c
commit
0d91f2f350
|
@ -24,7 +24,6 @@ use base qw(centreon::plugins::templates::counter);
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use Digest::MD5 qw(md5_hex);
|
|
||||||
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold);
|
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold);
|
||||||
|
|
||||||
sub custom_status_output {
|
sub custom_status_output {
|
||||||
|
@ -69,15 +68,14 @@ sub prefix_services_output {
|
||||||
|
|
||||||
sub new {
|
sub new {
|
||||||
my ($class, %options) = @_;
|
my ($class, %options) = @_;
|
||||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, statefile => 1);
|
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||||
bless $self, $class;
|
bless $self, $class;
|
||||||
|
|
||||||
$options{options}->add_options(arguments =>
|
$options{options}->add_options(arguments => {
|
||||||
{
|
'filter-name:s' => { name => 'filter_name' },
|
||||||
"filter-name:s" => { name => 'filter_name' },
|
'warning-status:s' => { name => 'warning_status', default => '' },
|
||||||
"warning-status:s" => { name => 'warning_status', default => '' },
|
'critical-status:s' => { name => 'critical_status', default => '%{status} !~ /^started$/i' },
|
||||||
"critical-status:s" => { name => 'critical_status', default => '%{status} !~ /^started$/i' },
|
});
|
||||||
});
|
|
||||||
|
|
||||||
return $self;
|
return $self;
|
||||||
}
|
}
|
||||||
|
@ -140,10 +138,6 @@ sub manage_selection {
|
||||||
$self->{output}->add_option_msg(short_msg => "No services found.");
|
$self->{output}->add_option_msg(short_msg => "No services found.");
|
||||||
$self->{output}->option_exit();
|
$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;
|
1;
|
||||||
|
|
|
@ -57,9 +57,8 @@ sub new {
|
||||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||||
bless $self, $class;
|
bless $self, $class;
|
||||||
|
|
||||||
$options{options}->add_options(arguments =>
|
$options{options}->add_options(arguments => {
|
||||||
{
|
});
|
||||||
});
|
|
||||||
|
|
||||||
return $self;
|
return $self;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,10 +30,9 @@ sub new {
|
||||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||||
bless $self, $class;
|
bless $self, $class;
|
||||||
|
|
||||||
$options{options}->add_options(arguments =>
|
$options{options}->add_options(arguments => {
|
||||||
{
|
'filter-name:s' => { name => 'filter_name' },
|
||||||
"filter-name:s" => { name => 'filter_name' },
|
});
|
||||||
});
|
|
||||||
$self->{vpn} = {};
|
$self->{vpn} = {};
|
||||||
|
|
||||||
return $self;
|
return $self;
|
||||||
|
|
|
@ -24,7 +24,6 @@ use base qw(centreon::plugins::templates::counter);
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use Digest::MD5 qw(md5_hex);
|
|
||||||
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold);
|
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold);
|
||||||
|
|
||||||
sub custom_status_output {
|
sub custom_status_output {
|
||||||
|
@ -69,15 +68,14 @@ sub prefix_services_output {
|
||||||
|
|
||||||
sub new {
|
sub new {
|
||||||
my ($class, %options) = @_;
|
my ($class, %options) = @_;
|
||||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, statefile => 1);
|
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||||
bless $self, $class;
|
bless $self, $class;
|
||||||
|
|
||||||
$options{options}->add_options(arguments =>
|
$options{options}->add_options(arguments => {
|
||||||
{
|
'filter-name:s' => { name => 'filter_name' },
|
||||||
"filter-name:s" => { name => 'filter_name' },
|
'warning-status:s' => { name => 'warning_status', default => '' },
|
||||||
"warning-status:s" => { name => 'warning_status', default => '' },
|
'critical-status:s' => { name => 'critical_status', default => '%{status} !~ /^started$/i' },
|
||||||
"critical-status:s" => { name => 'critical_status', default => '%{status} !~ /^started$/i' },
|
});
|
||||||
});
|
|
||||||
|
|
||||||
return $self;
|
return $self;
|
||||||
}
|
}
|
||||||
|
@ -140,10 +138,6 @@ sub manage_selection {
|
||||||
$self->{output}->add_option_msg(short_msg => "No services found.");
|
$self->{output}->add_option_msg(short_msg => "No services found.");
|
||||||
$self->{output}->option_exit();
|
$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;
|
1;
|
||||||
|
|
|
@ -24,7 +24,6 @@ use base qw(centreon::plugins::templates::counter);
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use Digest::MD5 qw(md5_hex);
|
|
||||||
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold);
|
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold);
|
||||||
|
|
||||||
sub custom_status_output {
|
sub custom_status_output {
|
||||||
|
@ -69,16 +68,15 @@ sub prefix_vpns_output {
|
||||||
|
|
||||||
sub new {
|
sub new {
|
||||||
my ($class, %options) = @_;
|
my ($class, %options) = @_;
|
||||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, statefile => 1);
|
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||||
bless $self, $class;
|
bless $self, $class;
|
||||||
|
|
||||||
$options{options}->add_options(arguments =>
|
$options{options}->add_options(arguments => {
|
||||||
{
|
'filter-name:s' => { name => 'filter_name' },
|
||||||
"filter-name:s" => { name => 'filter_name' },
|
'warning-status:s' => { name => 'warning_status', default => '' },
|
||||||
"warning-status:s" => { name => 'warning_status', default => '' },
|
'critical-status:s' => { name => 'critical_status', default => '%{status} =~ /^down$/i' },
|
||||||
"critical-status:s" => { name => 'critical_status', default => '%{status} =~ /^down$/i' },
|
});
|
||||||
});
|
|
||||||
|
|
||||||
return $self;
|
return $self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,10 +136,6 @@ sub manage_selection {
|
||||||
$self->{output}->add_option_msg(short_msg => "No VPNs found.");
|
$self->{output}->add_option_msg(short_msg => "No VPNs found.");
|
||||||
$self->{output}->option_exit();
|
$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;
|
1;
|
||||||
|
|
|
@ -31,20 +31,20 @@ sub new {
|
||||||
|
|
||||||
$self->{version} = '1.0';
|
$self->{version} = '1.0';
|
||||||
%{$self->{modes}} = (
|
%{$self->{modes}} = (
|
||||||
'cpu' => 'snmp_standard::mode::cpu',
|
'cpu' => 'snmp_standard::mode::cpu',
|
||||||
'cpu-detailed' => 'snmp_standard::mode::cpudetailed',
|
'cpu-detailed' => 'snmp_standard::mode::cpudetailed',
|
||||||
'box-service' => 'network::barracuda::cloudgen::snmp::mode::boxservice',
|
'box-service' => 'network::barracuda::cloudgen::snmp::mode::boxservice',
|
||||||
'hardware' => 'network::barracuda::cloudgen::snmp::mode::hardware',
|
'hardware' => 'network::barracuda::cloudgen::snmp::mode::hardware',
|
||||||
'interfaces' => 'snmp_standard::mode::interfaces',
|
'interfaces' => 'snmp_standard::mode::interfaces',
|
||||||
'list-interfaces' => 'snmp_standard::mode::listinterfaces',
|
'list-interfaces' => 'snmp_standard::mode::listinterfaces',
|
||||||
'list-vpns' => 'network::barracuda::cloudgen::snmp::mode::listvpns',
|
'list-vpns' => 'network::barracuda::cloudgen::snmp::mode::listvpns',
|
||||||
'load' => 'snmp_standard::mode::loadaverage',
|
'load' => 'snmp_standard::mode::loadaverage',
|
||||||
'memory' => 'snmp_standard::mode::memory',
|
'memory' => 'snmp_standard::mode::memory',
|
||||||
'server-service' => 'network::barracuda::cloudgen::snmp::mode::serverservice',
|
'server-service' => 'network::barracuda::cloudgen::snmp::mode::serverservice',
|
||||||
'storage' => 'snmp_standard::mode::storage',
|
'storage' => 'snmp_standard::mode::storage',
|
||||||
'uptime' => 'snmp_standard::mode::uptime',
|
'uptime' => 'snmp_standard::mode::uptime',
|
||||||
'vpn-status' => 'network::barracuda::cloudgen::snmp::mode::vpnstatus',
|
'vpn-status' => 'network::barracuda::cloudgen::snmp::mode::vpnstatus',
|
||||||
);
|
);
|
||||||
|
|
||||||
return $self;
|
return $self;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue