mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-07-27 15:44:21 +02:00
Merge pull request #257 from bcournaud/master
Fix github ticket count when number of tickets is greater than 100
This commit is contained in:
commit
1d8c7ca962
@ -74,11 +74,9 @@ sub check_options {
|
|||||||
$self->{output}->option_exit();
|
$self->{output}->option_exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
$self->{option_results}->{url_path} = "/repos/" . $self->{option_results}->{owner} . "/" . $self->{option_results}->{repository} . "/issues";
|
$self->{option_results}->{url_path} = "/search/issues?q=state:open+repo:" . $self->{option_results}->{owner} . "/" . $self->{option_results}->{repository};
|
||||||
if (defined($self->{option_results}->{label}) && $self->{option_results}->{label} ne '') {
|
if (defined($self->{option_results}->{label}) && $self->{option_results}->{label} ne '') {
|
||||||
$self->{option_results}->{get_param} = ['state=open', 'labels=' . $self->{option_results}->{label}, 'per_page=1000'];
|
$self->{option_results}->{url_path} .= "+label:" . $self->{option_results}->{label};
|
||||||
} else {
|
|
||||||
$self->{option_results}->{get_param} = ['state=open', 'per_page=1000'];
|
|
||||||
}
|
}
|
||||||
$self->{http}->set_options(%{$self->{option_results}});
|
$self->{http}->set_options(%{$self->{option_results}});
|
||||||
}
|
}
|
||||||
@ -86,6 +84,7 @@ sub check_options {
|
|||||||
sub run {
|
sub run {
|
||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
|
||||||
my $jsoncontent = $self->{http}->request();
|
my $jsoncontent = $self->{http}->request();
|
||||||
|
|
||||||
my $json = JSON->new;
|
my $json = JSON->new;
|
||||||
@ -99,8 +98,7 @@ sub run {
|
|||||||
$self->{output}->option_exit();
|
$self->{output}->option_exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
# Number of issues is array length
|
my $nb_issues = $webcontent->{total_count};
|
||||||
my $nb_issues = @{$webcontent};
|
|
||||||
|
|
||||||
my $exit = $self->{perfdata}->threshold_check(value => $nb_issues, threshold => [ { label => 'critical', exit_litteral => 'critical' }, , { label => 'warning', exit_litteral => 'warning' } ]);
|
my $exit = $self->{perfdata}->threshold_check(value => $nb_issues, threshold => [ { label => 'critical', exit_litteral => 'critical' }, , { label => 'warning', exit_litteral => 'warning' } ]);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user