Skip to content

Instantly share code, notes, and snippets.

@baskarp
Created August 8, 2012 01:12
Show Gist options
  • Save baskarp/3291141 to your computer and use it in GitHub Desktop.
Save baskarp/3291141 to your computer and use it in GitHub Desktop.
How to setup Python command line tool for PagerDuty
Here is a quick instructions on how to setup the Python command line tool for PagerDuty.
1) You'll need to have Python installed (tested with Python 2.6.1)
2) Verify if Python setuptools are installed
python -c "import setuptools;print 'OK';"
if you don't see output "OK", then setuptools are not installed.
To install setuptools, download setuptools (http://pypi.python.org/pypi/setuptools/) appropriate to your Python major version. ("python --version" to get the version number).
For example, to install setuptools for For Python 2.6.x:
wget http://pypi.python.org/packages/2.6/s/setuptools/setuptools-0.6c11-py2.6.egg
sudo sh setuptools-0.6c11-py2.6.egg
3) Install PagerDuty Python command-line tool
wget -O pagerduty.tar.gz --no-check-certificate https://github.com/samuel/python-pagerduty/tarball/v0.2.1
tar -zxvf pagerduty.tar.gz
cd samuel-python-pagerduty-0eefe24
sudo ./setup.py install
You'll now have a "pagerduty" command-line tool installed in your system
4) PagerDuty Setup
Create a Generic API service in PagerDuty and obtain the api key
5) You can view the usage via "pagerduty --help"
e.g usage:
pagerduty --key="04c29f9081e0012d407b12313d009e57" --incident="a.unique.incident.id" --description="a description that is read on the phone" trigger
pagerduty --key="04c29f9081e0012d407b12313d009e57" --incident="a.unique.incident.id" acknowledge
pagerduty --key="04c29f9081e0012d407b12313d009e57" --incident="a.unique.incident.id" resolve
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment