mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-09-23 17:58:27 +02:00
Fix timeout value
Add pagination to /Job request
This commit is contained in:
parent
03deb67cf6
commit
f0fb6a7a70
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Copyright 2024 Centreon (http://www.centreon.com/)
|
# Copyright 2025 Centreon (http://www.centreon.com/)
|
||||||
#
|
#
|
||||||
# Centreon is a full-fledged industry-strength solution that meets
|
# Centreon is a full-fledged industry-strength solution that meets
|
||||||
# the needs in IT infrastructure and application monitoring for
|
# the needs in IT infrastructure and application monitoring for
|
||||||
@ -148,6 +148,7 @@ sub build_options_for_httplib {
|
|||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
$self->{option_results}->{hostname} = $self->{hostname};
|
$self->{option_results}->{hostname} = $self->{hostname};
|
||||||
|
$self->{option_results}->{timeout} = $self->{timeout};
|
||||||
$self->{option_results}->{port} = $self->{port};
|
$self->{option_results}->{port} = $self->{port};
|
||||||
$self->{option_results}->{proto} = $self->{proto};
|
$self->{option_results}->{proto} = $self->{proto};
|
||||||
}
|
}
|
||||||
@ -335,11 +336,21 @@ sub request_jobs {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
my $response = $self->request_internal(
|
my $offset = 0;
|
||||||
endpoint => $options{endpoint},
|
|
||||||
get_param => ['completedJobLookupTime=' . $lookup_time],
|
my @items;
|
||||||
header => ['limit: 10000']
|
while (1) {
|
||||||
);
|
my $content = $self->request_internal(
|
||||||
|
endpoint => $options{endpoint},
|
||||||
|
get_param => ['completedJobLookupTime=' . $lookup_time],
|
||||||
|
header => [ 'limit: 100', "offset: $offset" ]
|
||||||
|
);
|
||||||
|
push @items, @{$content->{jobs}};
|
||||||
|
last if @items >= $content->{totalRecordsWithoutPaging} // 0;
|
||||||
|
$offset += 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
my $response = { jobs => \@items };
|
||||||
|
|
||||||
$self->create_cache_file(type => 'jobs', response => $response)
|
$self->create_cache_file(type => 'jobs', response => $response)
|
||||||
if (defined($self->{cache_create}));
|
if (defined($self->{cache_create}));
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Copyright 2024 Centreon (http://www.centreon.com/)
|
# Copyright 2025 Centreon (http://www.centreon.com/)
|
||||||
#
|
#
|
||||||
# Centreon is a full-fledged industry-strength solution that meets
|
# Centreon is a full-fledged industry-strength solution that meets
|
||||||
# the needs in IT infrastructure and application monitoring for
|
# the needs in IT infrastructure and application monitoring for
|
||||||
@ -283,10 +283,13 @@ You can use the following variables: %{display}, %{status}, %{elapsed}, %{type}
|
|||||||
Set critical threshold for long jobs.
|
Set critical threshold for long jobs.
|
||||||
You can use the following variables: %{display}, %{status}, %{elapsed}, %{type}
|
You can use the following variables: %{display}, %{status}, %{elapsed}, %{type}
|
||||||
|
|
||||||
=item B<--warning-*> B<--critical-*>
|
=item B<--warning-jobs-total>
|
||||||
|
|
||||||
|
Thresholds.
|
||||||
|
|
||||||
|
=item B<--critical-jobs-total>
|
||||||
|
|
||||||
Thresholds.
|
Thresholds.
|
||||||
Can be: 'jobs-total'.
|
|
||||||
|
|
||||||
=back
|
=back
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Copyright 2024 Centreon (http://www.centreon.com/)
|
# Copyright 2025 Centreon (http://www.centreon.com/)
|
||||||
#
|
#
|
||||||
# Centreon is a full-fledged industry-strength solution that meets
|
# Centreon is a full-fledged industry-strength solution that meets
|
||||||
# the needs in IT infrastructure and application monitoring for
|
# the needs in IT infrastructure and application monitoring for
|
||||||
@ -190,10 +190,29 @@ You can use the following variables: %{status}, %{is_maintenance}, %{offline_rea
|
|||||||
Define the conditions to match for the status to be CRITICAL (default: '%{is_maintenance} eq "no" and %{status} eq "offline"').
|
Define the conditions to match for the status to be CRITICAL (default: '%{is_maintenance} eq "no" and %{status} eq "offline"').
|
||||||
You can use the following variables: %{status}, %{is_maintenance}, %{offline_reason}, %{name}
|
You can use the following variables: %{status}, %{is_maintenance}, %{offline_reason}, %{name}
|
||||||
|
|
||||||
=item B<--warning-*> B<--critical-*>
|
=item B<--warning-media-agents-total>
|
||||||
|
|
||||||
|
Thresholds.
|
||||||
|
|
||||||
|
=item B<--critical-media-agents-total>
|
||||||
|
|
||||||
|
Thresholds.
|
||||||
|
|
||||||
|
=item B<--warning-media-agents-online>
|
||||||
|
|
||||||
|
Thresholds.
|
||||||
|
|
||||||
|
=item B<--critical-media-agents-online>
|
||||||
|
|
||||||
|
Thresholds.
|
||||||
|
|
||||||
|
=item B<--warning-media-agents-offline>
|
||||||
|
|
||||||
|
Thresholds.
|
||||||
|
|
||||||
|
=item B<--critical-media-agents-offline>
|
||||||
|
|
||||||
Thresholds.
|
Thresholds.
|
||||||
Can be: 'media-agents-total', 'media-agents-online', 'media-agents-offline'.
|
|
||||||
|
|
||||||
=back
|
=back
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Copyright 2024 Centreon (http://www.centreon.com/)
|
# Copyright 2025 Centreon (http://www.centreon.com/)
|
||||||
#
|
#
|
||||||
# Centreon is a full-fledged industry-strength solution that meets
|
# Centreon is a full-fledged industry-strength solution that meets
|
||||||
# the needs in IT infrastructure and application monitoring for
|
# the needs in IT infrastructure and application monitoring for
|
||||||
@ -181,10 +181,29 @@ You can use the following variables: %{status}, %{display}
|
|||||||
Define the conditions to match for the status to be CRITICAL (default: '%{status} !~ /online/i').
|
Define the conditions to match for the status to be CRITICAL (default: '%{status} !~ /online/i').
|
||||||
You can use the following variables: %{status}, %{display}
|
You can use the following variables: %{status}, %{display}
|
||||||
|
|
||||||
=item B<--warning-*> B<--critical-*>
|
=item B<--warning-usage>
|
||||||
|
|
||||||
Thresholds.
|
Threshold in bytes.
|
||||||
Can be: 'usage' (B), 'usage-free' (B), 'usage-prct' (%).
|
|
||||||
|
=item B<--critical-usage>
|
||||||
|
|
||||||
|
Threshold in bytes.
|
||||||
|
|
||||||
|
=item B<--warning-usage-free>
|
||||||
|
|
||||||
|
Threshold in bytes.
|
||||||
|
|
||||||
|
=item B<--critical-usage-free>
|
||||||
|
|
||||||
|
Threshold in bytes.
|
||||||
|
|
||||||
|
=item B<--warning-usage-prct>
|
||||||
|
|
||||||
|
Threshold in percentage.
|
||||||
|
|
||||||
|
=item B<--critical-usage-prct>
|
||||||
|
|
||||||
|
Threshold in percentage.
|
||||||
|
|
||||||
=back
|
=back
|
||||||
|
|
||||||
|
File diff suppressed because one or more lines are too long
45
tests/apps/backup/commvault/commserve/restapi/job.robot
Normal file
45
tests/apps/backup/commvault/commserve/restapi/job.robot
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
*** Settings ***
|
||||||
|
Documentation Check Commvault REST API Check
|
||||||
|
|
||||||
|
Resource ${CURDIR}${/}..${/}..${/}..${/}..${/}..${/}resources/import.resource
|
||||||
|
|
||||||
|
Suite Setup Start Mockoon ${MOCKOON_JSON}
|
||||||
|
Suite Teardown Stop Mockoon
|
||||||
|
Test Timeout 120s
|
||||||
|
|
||||||
|
|
||||||
|
*** Variables ***
|
||||||
|
${MOCKOON_JSON} ${CURDIR}${/}commvault.mockoon.json
|
||||||
|
${HOSTNAME} 127.0.0.1
|
||||||
|
${APIPORT} 3000
|
||||||
|
${CMD} ${CENTREON_PLUGINS}
|
||||||
|
... --plugin=apps::backup::commvault::commserve::restapi::plugin
|
||||||
|
... --hostname=${HOSTNAME}
|
||||||
|
... --api-username='username'
|
||||||
|
... --api-password='password'
|
||||||
|
... --proto='http'
|
||||||
|
... --mode=jobs
|
||||||
|
... --port=${APIPORT}
|
||||||
|
|
||||||
|
|
||||||
|
*** Test Cases ***
|
||||||
|
jobs ${tc}
|
||||||
|
[Tags] apps backup commvalt commserve restapi
|
||||||
|
|
||||||
|
${command} Catenate
|
||||||
|
... ${CMD}
|
||||||
|
|
||||||
|
${command} Catenate ${CMD} --http-backend=curl ${extraoptions}
|
||||||
|
|
||||||
|
Ctn Run Command And Check Result As Strings ${command} ${expected_result}
|
||||||
|
|
||||||
|
Examples: tc extra_options expected_result --
|
||||||
|
... 1 ${EMPTY} OK: Total jobs: 6 - All policies are ok | 'jobs.total.count'=6;;;0; 'jobs.problems.current.count'=0;;;0;
|
||||||
|
... 2 --filter-client-name='Xg' OK: Total jobs: 1 - Policy 'XXXX-Plan' 0 problem(s) detected | 'jobs.total.count'=1;;;0; 'jobs.problems.current.count'=0;;;0;
|
||||||
|
... 3 --filter-policy-id=2 OK: Total jobs: 2 - Policy 'XXXX-Plan' 0 problem(s) detected | 'jobs.total.count'=2;;;0; 'jobs.problems.current.count'=0;;;0;
|
||||||
|
... 4 --filter-type='Incr Backup' OK: Total jobs: 1 - Policy 'XXXX-Plan' 0 problem(s) detected | 'jobs.total.count'=1;;;0; 'jobs.problems.current.count'=0;;;0;
|
||||||
|
... 5 --filter-policy-name='XXXX-Plan' OK: Total jobs: 5 - Policy 'XXXX-Plan' 0 problem(s) detected | 'jobs.total.count'=5;;;0; 'jobs.problems.current.count'=0;;;0;
|
||||||
|
... 6 --filter-client-group="eta YYYY" OK: Total jobs: 5 - All policies are ok | 'jobs.total.count'=5;;;0; 'jobs.problems.current.count'=0;;;0;
|
||||||
|
... 7 --critical-jobs-total=10: CRITICAL: Total jobs: 6 | 'jobs.total.count'=6;;10:;0; 'jobs.problems.current.count'=0;;;0;
|
||||||
|
... 8 --warning-status='\\%\{status\} !~ /none/' WARNING: 6 problem(s) detected | 'jobs.total.count'=6;;;0; 'jobs.problems.current.count'=6;;;0;
|
||||||
|
... 9 --warning-long='\\%\{elapsed\} >10' WARNING: 1 problem(s) detected | 'jobs.total.count'=6;;;0; 'jobs.problems.current.count'=1;;;0;
|
Loading…
x
Reference in New Issue
Block a user