Skip to content

Instantly share code, notes, and snippets.

Avatar

MDCollins mdcollins05

View GitHub Profile
View schedule_vacation_overrides_for_user.py
#!/usr/bin/python
import requests
import sys
import json
import pprint
from time import sleep
#This is the user ID going on vacation
vacationing_user = 'PR2D0IM'
@mdcollins05
mdcollins05 / import_users.rb
Last active Jan 12, 2017 — forked from baskarp/import_users.rb
A simple Ruby script to import users into PagerDuty from a CSV file
View import_users.rb
#!/usr/bin/env ruby
require 'rubygems'
require 'faraday'
require 'json'
require 'csv'
class PagerDutyAgent
attr_reader :requester_id
attr_reader :token
View keybase.md

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:

View get_incident_details_with_body.py
#!/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'
View recurring_maint_windows.py
#!/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
View import_users_with_job_title.rb
#!/usr/bin/env ruby
require 'rubygems'
require 'faraday'
require 'json'
require 'csv'
class PagerDutyAgent
attr_reader :requester_id
attr_reader :token
@mdcollins05
mdcollins05 / users-without-sms.py
Created Jul 27, 2015
This will generate a CSV containing user's names and email addresses if they do not have at least one SMS notification rule.
View users-without-sms.py
#!/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
@mdcollins05
mdcollins05 / check_pd_mailserver_ips.sh
Last active Aug 29, 2015
For use in a cron job. It will echo the new IPs to stdout if there are changes.
View check_pd_mailserver_ips.sh
#!/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
View get_incident_details_teams.py
#!/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
View get_teams_info.py
#!/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'