Skip to content

Commit

Permalink
Add comment explaining how the different pieces fit together, and sta…
Browse files Browse the repository at this point in the history
…rt renaming things to use correct terms...
  • Loading branch information
eric-eisenhart committed Jul 24, 2023
1 parent 90405db commit 7bb15df
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions pd2zabbix.cgi
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,16 @@ sub pagerduty_validate_authentication {

}

# WebHook->event->incident->alert(s)

# PD sends WebHook with an outbound "event", containing:
# - type of update (event_type)
# - possible additional event data (comment contents)
# - Some incident data (inc self url)
# Incident contains 1 or more "alerts" that can be fetched.
# Alerts are what Zabbix had sent and have the zabbix event id needed to
# update zabbix.

# PagerDuty webhook handler -- most of the work happens here
sub pagerduty_handle_webhook {
my ($payload) = @_;
Expand Down Expand Up @@ -217,7 +227,7 @@ sub pagerduty_handle_webhook {
warn("html_url: $html_url\n") if $DEBUG >= 2;

# Fetch more details from PagerDuty
my $event_details = pagerduty_get_event_details($self_url);
my $event_details = pagerduty_get_incident_details($self_url);

# Those more details from PD should include info to work out the zabbix
# event id for use with the Zabbix API
Expand Down Expand Up @@ -301,7 +311,7 @@ sub pagerduty_handle_webhook {

# Use PD event API to get additional details on the incident.
# Needed for fetching info that includes the zabbix event ID for the zabbix API.
sub pagerduty_get_event_details {
sub pagerduty_get_incident_details {
my ($self_url) = @_;
my $pdtoken = $config->get('pdtoken');

Expand Down

0 comments on commit 7bb15df

Please sign in to comment.