Nagios integration problem - pagerduty.cgi not working and errors

pagerduty.cgi is throwing errors on a host acknowledgement.

[Mon May 06 13:57:41 2019] [error] [client] Use of uninitialized value in string eq at /usr/local/nagios/sbin/pagerduty.cgi line 157.
[Mon May 06 13:57:41 2019] [error] [client] Use of uninitialized value $host in printf at /usr/local/nagios/sbin/pagerduty.cgi line 36.

The host is not set to acknowledged in Nagios.

Hi Patrick!

I believe what is happening here is that the CGI script is encountering a JSON format that is not of the expected type, vis-à-vis that first error. The format of JSON that gets delivered by a webhook depends on the type of the webhook selected when creating it, i.e. Slack, Mattermost, v1 generic, v2 generic, etc.

For that matter, I believe the key to getting around this easily is selecting the “Nagios” type of webhook object and configuring it to deliver webhooks to the CGI script on your Nagios instance’s HTTP service.

I have concluded this because the CGI script depends on the property trigger_summary_data of the webhook payload, which is present in generic v1 webhooks and the newer Nagios-style webhooks (which allows more secure storage of HTTP Basic Auth credentials, if applicable). However, it’s not present in many other types of webhooks. The uninitialized value errors are thus probably caused by the issue of that property being missing from the webhook message.

Hopefully that helps!

1 Like

Thanks for input.
I changed both the Integration and the Extension to Nagios type and the two errors are now just one. (see below) But the good news is the host is acknowledged in Nagios so I’m happy. Thanks.

[Tue May 07 11:43:35 2019] [error] [client] Use of uninitialized value in string eq at /usr/local/nagios/sbin/pagerduty.cgi line 157.

Hmm, maybe I was wrong and it’s just that the SERVICEDESC attribute is not defined.

Can you perhaps share the command_line directive in your Nagios configuration? That may provide clues as to why this is happening.

I say this because that property in the data sent from the Nagios server, which should end up getting included in the webhook back to the Nagios server, is part of how the CGI script identifies the original alert. If the call to pd-nagios doesn’t include it, then that would explain the issue.

Might I also ask, what version of Perl is running on the system?

If for any reason you would like to switch to private messages (i.e. because you feel that the information is too sensitive to share in a public forum) please feel free to send me a direct message.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.