Fixed found translation.

This commit is contained in:
Kevin LABOURDETTE 2016-09-27 16:15:21 +02:00
parent 2659073fec
commit 43bc24186b
4 changed files with 45 additions and 45 deletions

View File

@ -71,9 +71,9 @@ sub new {
"warning-time:s" => { name => 'warning_time' },
"critical-time:s" => { name => 'critical_time' },
"threshold-value:s" => { name => 'threshold_value', default => 'count' },
"format-ok:s" => { name => 'format_ok', default => '%{count} element(s) finded' },
"format-warning:s" => { name => 'format_warning', default => '%{count} element(s) finded' },
"format-critical:s" => { name => 'format_critical', default => '%{count} element(s) finded' },
"format-ok:s" => { name => 'format_ok', default => '%{count} element(s) found' },
"format-warning:s" => { name => 'format_warning', default => '%{count} element(s) found' },
"format-critical:s" => { name => 'format_critical', default => '%{count} element(s) found' },
"values-separator:s" => { name => 'values_separator', default => ', ' },
});
$self->{count} = 0;
@ -296,7 +296,7 @@ FORMAT OPTIONS:
=item B<--format-ok>
Output format (Default: '%{count} element(s) finded')
Output format (Default: '%{count} element(s) found')
Can used:
'%{values}' = display all values (also text string)
'%{values_ok}' = values from attributes and text node only (seperated by option values-separator)
@ -304,11 +304,11 @@ Can used:
=item B<--format-warning>
Output warning format (Default: %{count} element(s) finded')
Output warning format (Default: %{count} element(s) found')
=item B<--format-critical>
Output critical format (Default: %{count} element(s) finded')
Output critical format (Default: %{count} element(s) found')
=item B<--values-separator>

View File

@ -70,9 +70,9 @@ sub new {
"warning-time:s" => { name => 'warning_time' },
"critical-time:s" => { name => 'critical_time' },
"threshold-value:s" => { name => 'threshold_value', default => 'count' },
"format-ok:s" => { name => 'format_ok', default => '%{count} element(s) finded' },
"format-warning:s" => { name => 'format_warning', default => '%{count} element(s) finded' },
"format-critical:s" => { name => 'format_critical', default => '%{count} element(s) finded' },
"format-ok:s" => { name => 'format_ok', default => '%{count} element(s) found' },
"format-warning:s" => { name => 'format_warning', default => '%{count} element(s) found' },
"format-critical:s" => { name => 'format_critical', default => '%{count} element(s) found' },
"values-separator:s" => { name => 'values_separator', default => ', ' },
});
$self->{count} = 0;
@ -120,7 +120,7 @@ sub check_options {
$self->{output}->add_option_msg(short_msg => "You need to specify data.");
$self->{output}->option_exit();
}
$self->{http}->set_options(%{$self->{option_results}});
$self->{http}->add_header(key => 'SOAPAction', value => $self->{option_results}->{service_soap});
}
@ -309,7 +309,7 @@ FORMAT OPTIONS:
=item B<--format-ok>
Output format (Default: '%{count} element(s) finded')
Output format (Default: '%{count} element(s) found')
Can used:
'%{values}' = display all values (also text string)
'%{values_ok}' = values from attributes and text node only (seperated by option values-separator)
@ -317,11 +317,11 @@ Can used:
=item B<--format-warning>
Output warning format (Default: %{count} element(s) finded')
Output warning format (Default: %{count} element(s) found')
=item B<--format-critical>
Output critical format (Default: %{count} element(s) finded')
Output critical format (Default: %{count} element(s) found')
=item B<--values-separator>

View File

@ -27,11 +27,11 @@ use warnings;
sub set_counters {
my ($self, %options) = @_;
$self->{maps_counters_type} = [
{ name => 'node', type => 1, cb_prefix_output => 'prefix_node_output', message_multiple => 'All nodes are ok' }
];
$self->{maps_counters}->{node} = [
{ label => 'status', threshold => 0, set => {
key_values => [ { name => 'state' }, { name => 'display' } ],
@ -47,14 +47,14 @@ sub set_counters {
my $instance_mode;
sub custom_threshold_output {
my ($self, %options) = @_;
my ($self, %options) = @_;
my $status = 'ok';
my $message;
eval {
local $SIG{__WARN__} = sub { $message = $_[0]; };
local $SIG{__DIE__} = sub { $message = $_[0]; };
if (defined($instance_mode->{option_results}->{critical_status}) && $instance_mode->{option_results}->{critical_status} ne '' &&
eval "$instance_mode->{option_results}->{critical_status}") {
$status = 'critical';
@ -75,14 +75,14 @@ sub custom_threshold_output {
sub custom_status_output {
my ($self, %options) = @_;
my $msg = 'state : ' . $self->{result_values}->{state};
return $msg;
}
sub custom_status_calc {
my ($self, %options) = @_;
$self->{result_values}->{state} = $options{new_datas}->{$self->{instance} . '_state'};
$self->{result_values}->{display} = $options{new_datas}->{$self->{instance} . '_display'};
return 0;
@ -90,7 +90,7 @@ sub custom_status_calc {
sub prefix_node_output {
my ($self, %options) = @_;
return "Node '" . $options{instance_value}->{display} . "' ";
}
@ -98,7 +98,7 @@ sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$self->{version} = '1.0';
$options{options}->add_options(arguments =>
{
@ -114,14 +114,14 @@ sub new {
sub check_options {
my ($self, %options) = @_;
$self->SUPER::check_options(%options);
$instance_mode = $self;
$self->change_macros();
}
sub change_macros {
my ($self, %options) = @_;
foreach (('warning_status', 'critical_status', 'unknown_status')) {
if (defined($self->{option_results}->{$_})) {
$self->{option_results}->{$_} =~ s/%\{(.*?)\}/\$self->{result_values}->{$1}/g;
@ -129,7 +129,7 @@ sub change_macros {
}
}
my %map_vnode_status = (
my %map_vnode_status = (
1 => 'unknown',
2 => 'onLine',
3 => 'offLine',
@ -156,14 +156,14 @@ sub manage_selection {
$self->{output}->output_add(long_msg => "skipping '" . $result->{clusterVNodeName} . "': no matching filter.", debug => 1);
next;
}
$self->{node}->{$instance} = { display => $result->{clusterVNodeName},
$self->{node}->{$instance} = { display => $result->{clusterVNodeName},
state => $result->{clusterVNodeStatus}};
}
if (scalar(keys %{$self->{node}}) <= 0) {
$self->{output}->output_add(severity => 'OK',
short_msg => 'No node(s) finded');
short_msg => 'No node(s) found');
}
}
@ -198,4 +198,4 @@ Can used special variables like: %{state}, %{display}
=back
=cut
=cut

View File

@ -27,31 +27,31 @@ use warnings;
sub set_counters {
my ($self, %options) = @_;
$self->{maps_counters_type} = [
{ name => 'global', type => 0 },
{ name => 'ssid', type => 1, cb_prefix_output => 'prefix_ssid_output', message_multiple => 'All users by SSID are ok' },
{ name => 'ap', type => 1, cb_prefix_output => 'prefix_ap_output', message_multiple => 'All users by AP are ok' },
];
$self->{maps_counters}->{global} = [
{ label => 'total', set => {
key_values => [ { name => 'total' } ],
output_template => 'Total Users : %s',
perfdatas => [
{ label => 'total', value => 'total_absolute', template => '%s',
{ label => 'total', value => 'total_absolute', template => '%s',
unit => 'users', min => 0 },
],
}
},
];
$self->{maps_counters}->{ssid} = [
{ label => 'ssid', set => {
key_values => [ { name => 'total' }, { name => 'display' } ],
output_template => 'users : %s',
perfdatas => [
{ label => 'ssid', value => 'total_absolute', template => '%s',
{ label => 'ssid', value => 'total_absolute', template => '%s',
unit => 'users', min => 0, label_extra_instance => 1, instance_use => 'display_absolute' },
],
}
@ -76,20 +76,20 @@ sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$self->{version} = '1.0';
$options{options}->add_options(arguments =>
{
{
"filter-ssid:s" => { name => 'filter_ssid' },
"filter-ap:s" => { name => 'filter_ap' },
});
return $self;
}
sub prefix_ssid_output {
my ($self, %options) = @_;
return "SSID '" . $options{instance_value}->{display} . "' ";
}
@ -114,11 +114,11 @@ sub manage_selection {
$self->{global} = { total => 0};
$self->{ssid} = {};
$self->{ap} = {};
$self->{results} = $options{snmp}->get_multiple_table(oids => [{ oid => $oid_trpzApStatApStatusApName }, { oid => $mapping->{trpzClSessClientSessApSerialNum}->{oid} },
{ oid => $mapping1->{trpzClSessClientSessSsid}->{oid} }],
nothing_quit => 1);
foreach my $oid (keys %{$self->{results}->{ $mapping->{trpzClSessClientSessApSerialNum}->{oid} }}) {
$oid =~ /^$mapping->{trpzClSessClientSessApSerialNum}->{oid}\.(.*)$/;
my $instance = $1;
@ -130,7 +130,7 @@ sub manage_selection {
$ap_oid .= '.'.ord($char);
}
my $ap_name = $self->{results}->{$oid_trpzApStatApStatusApName}->{$oid_trpzApStatApStatusApName . '.' . $ap_oid};
if (defined($self->{option_results}->{filter_ap}) && $self->{option_results}->{filter_ap} ne '' &&
if (defined($self->{option_results}->{filter_ap}) && $self->{option_results}->{filter_ap} ne '' &&
$ap_name !~ /$self->{option_results}->{filter_ap}/) {
$self->{output}->output_add(long_msg => "Skipping '" . $ap_name . "': no matching filter.", debug => 1);
next;
@ -140,17 +140,17 @@ sub manage_selection {
$self->{output}->output_add(long_msg => "Skipping '" . $result1->{trpzClSessClientSessSsid} . "': no matching filter.", debug => 1);
next;
}
$self->{global}->{total}++;
$self->{ap}->{$ap_name} = { total => 0, display => $ap_name } if (!defined($self->{ap}->{$ap_name}));
$self->{ap}->{$ap_name}->{total}++;
$self->{ssid}->{$result1->{trpzClSessClientSessSsid}} = { total => 0, display => $result1->{trpzClSessClientSessSsid} } if (!defined($self->{ssid}->{$result1->{trpzClSessClientSessSsid}}));
$self->{ssid}->{$result1->{trpzClSessClientSessSsid}}->{total}++;
}
if (scalar(keys %{$self->{ap}}) <= 0 && scalar(keys %{$self->{ssid}}) <= 0) {
$self->{output}->output_add(severity => 'OK',
short_msg => 'No AP nor SSID finded, check your filter or maybe we are on a slave controller ? ');
short_msg => 'No AP nor SSID found, check your filter or maybe we are on a slave controller ? ');
}
}