How to install PagerDuty Agent from source

pdagent
howto
unsupported

(Demitri Morgan) #1

Rationale

This will allow you to install PagerDuty Agent on a system that isn’t officially supported. If you are on a RHEL-based or Debian-based distribution of Linux that isn’t one of the operating systems that we officially support, you may want to first try installing using the same instructions as given in the Agent Install Guide, as that will be much easier.

Disclaimer

This method in itself is not officially supported. Your mileage may vary.

Dependencies and System Requirements

  • Linux or Unix - based operating system
  • Python 2.7
  • Git
  • An internet connection

Process

Run all of the following commands as root.

First, clone the repositories:

umask 0022
cd /
mkdir -p opt
cd opt
git clone https://github.com/PagerDuty/pdagent.git
git clone https://github.com/PagerDuty/pdagent-integrations.git

Add the pdagent library to the path of the integration scripts:

ln -s /opt/pdagent/pdagent /opt/pdagent-integrations/bin

Set up the queue directory structure:

mkdir -p /opt/pdagent/tmp
chmod 777 /opt/pdagent/tmp
ln -s /opt/pdagent/tmp /var/lib/pdagent

Create a non-privileged user for the agent to run as:

adduser --system --shell /bin/false --no-create-home --group pdagent

Copy the daemon configuration into place and make sure the service user has read access to it:

cp /opt/pdagent/conf/pdagent.conf /etc/
chmod 644 /etc/pdagent.conf 

Finally, you can adapt the SysV init script for this setup by modifying the path variables near the beginning of the file. The file can be found in the pdagent repository; the absolute path to it, with the above all said and done, will be /opt/pdagent/build-linux/pdagent.init.

EXEC=/opt/pdagent/bin/pdagentd.py
EXEC_NAME=$(basename "$EXEC")
PID_DIR=/opt/pdagent/tmp
PID_FILE=$PID_DIR/pdagentd.pid

Once you have modified the file, you can place it in /etc/init.d, or /etc/rc.d, depending on the convention in use by your system. You can then add it to one of the standard runlevels.

If your system uses systemd: you can copy the pagerduty.service file into /lib/systemd/system and modify the ExecStart configuration property to reflect the path to pdagentd.py, and then you’ll be able to use service pdagent start|stop to manage it.

To configure the agent to use a HTTP proxy: the process is the same as it is when installing using yum or apt-get.

That’s it!

Addendum

If you want to be able to easily invoke pd-send from the command line, make sure to append /opt/pdagent/bin to your PATH environment variable.


Zabbix integration