Testing Pagerdutyzabbix #12
-
Hello Eric. Thank you for sharing your contribution. The use case your handling here is very usueful and I wanted to test in my PoC setup, but didn't succeed in doing so. Would you plz give me more insight about the deployment.I'll be very gratefull to you I specifically didn't understand the part below, although ;my zabbix-->pagerduty works just fine I recommend setting the token in the Media type to {ALERT.SENDTO} and putting your PagerDuty API token into "Send to" of the user's media configuration. (so you have the easy option of additional PD integrations for different teams, etc) Also, do we need to open specific ports on the server where we deployed the script(I deployed it to zabbix frontend). what are the ownership of the script?. |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments 6 replies
-
Hello @ichi-the-one. I'll try to answer what I can...
If you have it working, and don't intend to support multiple different groups in your Zabbix setup, it's really not important. In Zabbix / Alerts / Media Types / PagerDuty, for the "token" parameter, instead of the token hard-coded there, I have it set to For the user that's set up to send to PagerDuty, in the "PagerDuty" media entry, I have the PagerDuty api token in the "Send to" field. That gets the contents of the user "send to" field And instead of naming that user "PagerDuty" or something like that, I have it named after the group who the alerts are for. Doing things that way means that it's easy for me to have specific alerts go to other PagerDuty services/automations.
Yes, you'll need the https or http port open to at least the PagerDuty WebHook IPs: https://developer.pagerduty.com/docs/9a349b09b87b7-webhook-i-ps Ours is open to the world, but is also running on a separate server from Zabbix itself.
On mine the script is owned by root, but usually doesn't matter, as long as the web server (httpd) user can read and execute the script. On a RHEL/Rocky server running apache httpd and the fairly stock Zabbix config, I was able to set it up on my zabbix server with: cd /var/www/cgi-bin
git clone https://github.com/sonic-com/pagerduty2zabbix.git
cd pagerduty2zabbix
cp pagerduty2zabbix.conf.example pagerduty2zabbix.conf
vim pagerduty2zabbix.conf # edit with your favorite editor
It will need to be the fully-qualified URL that PagerDuty's servers can use. A shortname like "zabbix" definitely won't work from the servers the WebHooks run from. In my config, that would be something like https://zabbix.example.com/cgi-bin/pagerduty2zabbix/pd2zabbix.cgi You can try it with a web browser or If you do a simple <h1>Software error:</h1>
<pre>No json_payload from webhook POSTDATA
</pre>
Set debug in the config to 3 or higher until you have it working to see more of what's going on... Watch the access logs too. If you have the firewall stuff and PagerDuty and everything set up appropriately, you should be able to "Test" the webhook and have a "ping" sent to it, which will show up in your access logs as PagerDuty doing a POST to the URL. |
Beta Was this translation helpful? Give feedback.
-
I tried to update README.md in f0fc083 to make some of that a bit clearer... |
Beta Was this translation helpful? Give feedback.
-
Screenshots of the PD webhook configuration that I meant: |
Beta Was this translation helpful? Give feedback.
-
Amazing. Thank you so much for your detailed answer. |
Beta Was this translation helpful? Give feedback.
-
It's way better than yesterday. I can see the logs while testing. I have this error while trying to update a ticket. [Wed Feb 07 21:49:43.910534 2024] [cgid:error] [pid 26640:tid 26821] [client 54.213.187.133:29801] [Wed Feb 7 21:49:43 2024] pd2zabbix.cgi: Unable to fetch alerts from PagerDuty: /var/www/cgi-bin/pagerduty2zabbix/pd2zabbix.cgi |
Beta Was this translation helpful? Give feedback.
-
when I use the token from the service in pagerduty and put it as the value of pdtoken I have this [Wed Feb 07 22:24:33.921306 2024] [cgid:error] [pid 27951:tid 28105] [client 54.213.187.133:39491] [Wed Feb 7 22:24:33 2024] pd2zabbix.cgi: Unable to fetch alerts from PagerDuty: /var/www/cgi-bin/pagerduty2zabbix/pd2zabbix.cgi when I use instead a user token and use it in pdtoken as you mentionned in the readme: Get an API token from PagerDuty that can update the relevant PagerDuty events and set pdtoken to that. (profile pic > User Settings > Create API User Token) +++> then I try to update the ticket , I have absolutely no trace coming in myserver |
Beta Was this translation helpful? Give feedback.
-
I confirm. it's working. Zabbix is getting updated according to PD. Thank you so much. |
Beta Was this translation helpful? Give feedback.
Hello @ichi-the-one.
I'll try to answer what I can...
If you have it working, and don't intend to support multiple different groups in your Zabbix setup, it's really not important.
In Zabbix / Alerts / Media Types / PagerDuty, for the "token" parameter, instead of the token hard-coded there, I have it set to
{ALERT.SENDTO}
.For the user that's set up to send…