Skip to content

Instantly share code, notes, and snippets.

View mdcollins05's full-sized avatar

MDCollins mdcollins05

View GitHub Profile
@mdcollins05
mdcollins05 / get_incident_details_with_body.py
Last active August 29, 2015 14:14
Implemented a new method to remove unicode characters before passing the object to str(). Fixes encoding issues with strings in the details and body.
#!/usr/bin/env python
import requests
import sys
import json
from datetime import date, timedelta
#Your PagerDuty API key. A read-only key will work for this.
AUTH_TOKEN = ''
#The API base url, make sure to include the subdomain
#!/usr/bin/python
import requests
import sys
import json
from datetime import date, timedelta
import pprint
#Your PagerDuty API key. A read-only key will work for this.
auth_token = 'API_KEY_HERE'
@mdcollins05
mdcollins05 / check_pd_mailserver_ips.sh
Last active August 29, 2015 14:16
For use in a cron job. It will echo the new IPs to stdout if there are changes.
#!/bin/bash
## This script is designed to be run via a cron job with the MAILTO variable set to generate an email when output occurs (an IP is added/removed/changed)
if [ -f "mailservers_result.txt" ]; then
mv mailservers_result.txt mailservers_result.txt.old
fi
dig +short mx acme.pagerduty.com | sed 's/.$//g' | sed 's/^[0-9][0-9]* //g' | xargs dig +short | sort > mailservers_result.txt
#!/usr/bin/env python
import requests
import sys
import json
from datetime import date, timedelta
#Your PagerDuty API key. A read-only key will work for this.
AUTH_TOKEN = 'YOUR_API_KEY'
#The API base url, make sure to include the subdomain
@mdcollins05
mdcollins05 / users-without-sms.py
Created July 27, 2015 19:03
This will generate a CSV containing user's names and email addresses if they do not have at least one SMS notification rule.
#!/usr/bin/python
import requests
import sys
import json
#Your PagerDuty API key. A read-only key will work for this.
auth_token = 'API_KEY_HERE'
#The PagerDuty subdomain
#!/usr/bin/env ruby
require 'rubygems'
require 'faraday'
require 'json'
require 'csv'
class PagerDutyAgent
attr_reader :requester_id
attr_reader :token
#!/usr/bin/python
# Python script to create recurring maintenance windows in PagerDuty
#
# Copyright (c) 2015, 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:
# * Redistributions of source code must retain the above copyright
#!/usr/bin/env python
import requests
import json
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
# Your PagerDuty API key. A read-only key will work for this.
api_key = 'ENTER_API_KEY'

Keybase proof

I hereby claim:

  • I am mdcollins05 on github.
  • I am mdcollins05 (https://keybase.io/mdcollins05) on keybase.
  • I have a public key ASDQvcOg1DQ3h2CNnD52UqVV5BbGW_WbyZ6uyS00Pe750go

To claim this, I am signing this object:

@mdcollins05
mdcollins05 / import_users.rb
Last active January 12, 2017 23:35 — forked from baskarp/import_users.rb
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