jjethwa / icinga2

GNU General Public License v3.0
223 stars 188 forks source link

Add pagerduty scripts/hooks #93

Closed jkrauska closed 7 years ago

jkrauska commented 7 years ago

I'd like to add pagerduty scripts hooks to this lovely Docker image.

I've done most of it myself, but curious if you'd like to use it -- willing to add if there' support.

Instructions from pagerduty website: https://www.pagerduty.com/docs/guides/icinga2-integration-guide/

Quick Steps:

Package add

apt-get install -y libwww-perl libcrypt-ssleay-perl libsys-syslog-perl

Get config drop-in

wget https://raw.githubusercontent.com/mdcollins05/PagerDuty-Icinga2/master/pagerduty-icinga2.conf

Apply your key

FIXME: Put key in environment variable

sed -i 's/SERVICE_API_KEY_HERE/BLAHBLAHBLAH/' pagerduty-icinga2.conf

Move in place

mv pagerduty-icinga2.conf /etc/icinga2/conf.d/

Get script and copy in place

wget https://raw.github.com/PagerDuty/pagerduty-icinga-pl/master/pagerduty_icinga.pl mv pagerduty_icinga.pl /usr/local/bin chmod 755 /usr/local/bin/pagerduty_icinga.pl

Also needed:

supervisor job that runs flush (no cron in docker)

jkrauska commented 7 years ago

sorry about all the accidential markup

bebehei commented 7 years ago

HI Joel,

I appreciate your effort.

But IMO, this is best suited in a seperate dockerfile/dockerimage. Currently we only use official packages or icingaweb2 modules from official sources.

Also writing a seperate dockerfile should be quite easy and done in small effort.

jkrauska commented 7 years ago

These are somewhat /official/ sources as they're right from PagerDuty, but I get it.

It's a bit of a diversion from your core effort - I was mainly trying not to diverge too much.

jjethwa commented 7 years ago

Hi @jkrauska

I think you can add this in using a volume(s) to make it even easier 😃

bebehei commented 7 years ago

I think you can add this in using a volume(s) to make it even easier 😃

Yeah, cool idea!

docker run [...] -v $PWD/custom-run.sh:/opt/custom_run custom-run.sh:

#!/bin/sh
apt-get update
apt-get install -y libwww-perl libcrypt-ssleay-perl libsys-syslog-perl

The rest you can add via the /etc/icinga2/-volume. For the pl-script, you can add it to /etc/icinga2/libexec.