fix(salesforce): api version option (#3110)
This commit is contained in:
parent
e4fc05d73f
commit
34da8733e5
|
@ -41,9 +41,9 @@ sub new {
|
||||||
|
|
||||||
if (!defined($options{noptions})) {
|
if (!defined($options{noptions})) {
|
||||||
$options{options}->add_options(arguments => {
|
$options{options}->add_options(arguments => {
|
||||||
'hostname:s' => { name => 'hostname' },
|
'hostname:s' => { name => 'hostname' },
|
||||||
'timeout:s' => { name => 'timeout' },
|
'timeout:s' => { name => 'timeout' },
|
||||||
'api-versions:s' => { name => 'api_version' }
|
'api-version:s' => { name => 'api_version' }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
$options{options}->add_help(package => __PACKAGE__, sections => 'REST API OPTIONS', once => 1);
|
$options{options}->add_help(package => __PACKAGE__, sections => 'REST API OPTIONS', once => 1);
|
||||||
|
@ -143,9 +143,9 @@ Set hostname to query (default: 'api.status.salesforce.com')
|
||||||
|
|
||||||
Set HTTP timeout in seconds (Default: '10').
|
Set HTTP timeout in seconds (Default: '10').
|
||||||
|
|
||||||
=item B<--api-path>
|
=item B<--api-version>
|
||||||
|
|
||||||
API base url path (Default: '/v1').
|
API version (Default: 'v1').
|
||||||
|
|
||||||
=back
|
=back
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ use base qw(centreon::plugins::templates::counter);
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold catalog_status_calc);
|
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold_ng);
|
||||||
|
|
||||||
sub custom_status_output {
|
sub custom_status_output {
|
||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
|
@ -50,21 +50,19 @@ sub set_counters {
|
||||||
];
|
];
|
||||||
|
|
||||||
$self->{maps_counters}->{salesforce} = [
|
$self->{maps_counters}->{salesforce} = [
|
||||||
{ label => 'status', threshold => 0, set => {
|
{ label => 'status', type => 2, critical_default => '%{status} !~ /OK/', set => {
|
||||||
key_values => [ { name => 'status' }, { name => 'active' }, { name => 'name' } ],
|
key_values => [ { name => 'status' }, { name => 'active' }, { name => 'name' } ],
|
||||||
closure_custom_calc => \&catalog_status_calc,
|
|
||||||
closure_custom_output => $self->can('custom_status_output'),
|
closure_custom_output => $self->can('custom_status_output'),
|
||||||
closure_custom_perfdata => sub { return 0; },
|
closure_custom_perfdata => sub { return 0; },
|
||||||
closure_custom_threshold_check => \&catalog_status_threshold
|
closure_custom_threshold_check => \&catalog_status_threshold_ng
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ label => 'incident', nlabel => 'salesforce.incident.current.count', set => {
|
{ label => 'incident', nlabel => 'salesforce.incident.current.count', set => {
|
||||||
key_values => [ { name => 'incident' } ],
|
key_values => [ { name => 'incident' } ],
|
||||||
output_template => '%s incidents currently',
|
output_template => '%s incidents currently',
|
||||||
perfdatas => [
|
perfdatas => [
|
||||||
{ label => 'incident', value => 'incident', template => '%s',
|
{ template => '%s', min => 0, label_extra_instance => 1 }
|
||||||
min => 0, label_extra_instance => 1 },
|
]
|
||||||
],
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
@ -77,22 +75,12 @@ sub new {
|
||||||
|
|
||||||
$options{options}->add_options(arguments => {
|
$options{options}->add_options(arguments => {
|
||||||
'instance:s@' => { name => 'instance' },
|
'instance:s@' => { name => 'instance' },
|
||||||
'alias' => { name => 'use_alias' },
|
'alias' => { name => 'use_alias' }
|
||||||
'unknown-status:s' => { name => 'unknown_status', default => '' },
|
|
||||||
'warning-status:s' => { name => 'warning_status', default => '' },
|
|
||||||
'critical-status:s' => { name => 'critical_status', default => '%{status} !~ /OK/' }
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return $self;
|
return $self;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub check_options {
|
|
||||||
my ($self, %options) = @_;
|
|
||||||
$self->SUPER::check_options(%options);
|
|
||||||
|
|
||||||
$self->change_macros(macros => ['unknown_status', 'warning_status', 'critical_status']);
|
|
||||||
}
|
|
||||||
|
|
||||||
sub manage_selection {
|
sub manage_selection {
|
||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue