Merge pull request #509 from Bladou46/fix-translation

Fixed found translation.
This commit is contained in:
qgarnier 2016-09-27 16:52:40 +02:00 committed by GitHub
commit 23b94d86f5
4 changed files with 45 additions and 45 deletions

View File

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

View File

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

View File

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

View File

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