Page 1 of 1

How to use pagerduty

Posted: Wed Apr 18, 2012 12:02 pm
by jcamillo
What is the best way to configure pagerduty with Nagios XI?

Thanks
Joe

Re: How to use pagerduty

Posted: Wed Apr 18, 2012 1:53 pm
by scottwilkerson
I haven't used their service but they have a guide for adding it to core here
http://www.pagerduty.com/docs/guides/na ... tion-guide

With that, it looks like the steps should be something like this (not tested):

Install the necessary Perl dependencies:

Code: Select all

yum install perl-libwww-perl perl-Crypt-SSLeay
Download pagerduty_nagios.cfg

Code: Select all

cd /usr/local/nagios/etc
 wget http://www.pagerduty.com/configs/pagerduty_nagios.cfg

Open the file in your favorite editor.
Enter the service key corresponding to your Nagios service into the pager field. The service key is a 32 character string that can be found on the service’s detail page.
Copy the Nagios configuration file into place:


Edit the Nagios config to load the PagerDuty config. To do this, open /usr/local/nagios/etc/nagios.cfg and add this line to the file:

Code: Select all

cfg_file=/usr/local/nagios/etc/pagerduty_nagios.cfg
Add the contact “pagerduty” to your Nagios configuration’s main contact group.

Create User pagerduty and add them to the admins contactgroup

Download pagerduty_nagios.pl to /usr/local/nagiosxi/cron.

Code: Select all

cd /usr/local/nagios/libexec
wget http://www.pagerduty.com/configs/pagerduty_nagios.pl
Make sure the file is executable by Nagios

Code: Select all

chmod 755 /usr/local/nagiosxi/cron/pagerduty_nagios.pl
Enable environment variable macros in /usr/local/nagios/etc/nagios.cfg (if not enabled already)

Code: Select all

enable_environment_macros=1
Edit the nagios user’s crontab

Code: Select all

crontab -u nagios -e
Add the following line to the crontab

Code: Select all

* * * * * /usr/local/nagiosxi/cron/pagerduty_nagios.pl flush

Re: How to use pagerduty

Posted: Thu Apr 19, 2012 7:53 am
by jcamillo
Thanks - I will give it a shot.

Re: How to use pagerduty

Posted: Thu Jun 07, 2012 4:29 pm
by jparker
I am trying to follow the instructions you had here and I am getting an error applying the configuration once adding "pagerduty" to the nagios configurations as a contact.

this is the error I am getting from the log:


Processing object config file '/usr/local/nagios/etc/pagerduty_nagios.cfg'...
Warning: Duplicate definition found for contact 'pagerduty' (config file '/usr/local/nagios/etc/pagerduty_nagios.cfg', starting on line 1)
Error: Could not add object property in file '/usr/local/nagios/etc/pagerduty_nagios.cfg' on line 2.
Error processing object config files!