Skip to content

Commit

Permalink
Attempt to fallback to old mechanism if /alerts end-point didn't work...
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-eisenhart committed Jul 25, 2023
1 parent 8cb8a22 commit f6552e8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pd2zabbix.cgi
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,12 @@ sub pagerduty_handle_webhook {

my @pagerduty_alerts = @{pagerduty_get_incident_alerts($self_url)};

warn ("pagerduty_alerts count: ".$#pagerduty_alerts, "\n") if $DEBUG >= 2;
warn ("pagerduty_alerts count: ".scalar(@pagerduty_alerts), "\n") if $DEBUG >= 2;

if (scalar(@pagerduty_alerts) <= 0) {
warn("No alerts found, trying get_incident_details\n") if $DEBUG >= 1;
push @pagerduty_alerts, pagerduty_get_incident_details($self_url);
}

foreach my $pagerduty_alert (@pagerduty_alerts) {
warn( "alert: " . to_json($pagerduty_alert) . "\n" ) if $DEBUG >= 2;
Expand Down

0 comments on commit f6552e8

Please sign in to comment.