Skip to content

Instantly share code, notes, and snippets.

View ryanhoskin's full-sized avatar

Ryan Hoskin ryanhoskin

View GitHub Profile
@eurica
eurica / PagerDutyWebhookToEmail.php
Last active November 22, 2019 02:12
Simple example of using PagerDuty webhooks and PHP to forward all incident state changes to an email address.
Sample PHP code to accept PagerDuty webhooks and send out notifications by email on state changes.
For more information, see http://developer.pagerduty.com/documentation/rest/webhooks
This example threads emails based on "$status: $description on $service" so each update to each incident would start a new thread.
This code is unsupported by PagerDuty.
<?php
$emailAddress = "CHANGEME@example.com";
@baskarp
baskarp / import_users.rb
Created December 18, 2012 20:07
A simple Ruby script to import users into PagerDuty from a CSV file
#!/usr/bin/env ruby
require 'rubygems'
require 'faraday'
require 'json'
require 'csv'
class PagerDutyAgent
attr_reader :requester_id
attr_reader :token
@baskarp
baskarp / pagerduty_nagios.pl
Created July 20, 2012 08:48
PagerDuty Nagios plug-in with support for FLAPPINGSTART and FLAPPINGSTOP
#!/usr/bin/env perl
# Nagios plugin that sends Nagios events to PagerDuty.
#
# Copyright (c) 2011, PagerDuty, Inc. <info@pagerduty.com>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@samuel
samuel / pagerduty_munin.py
Created November 30, 2010 00:48
PagerDuty script for Munin
#!/usr/bin/env python
try:
import json
except ImportError:
import simplejson as json
import sys
from pagerduty import PagerDuty
def parse(txt):