Skip to content

Instantly share code, notes, and snippets.

Ryan Hoskin ryanhoskin

Block or report user

Report or block ryanhoskin

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View resolve_all.py
#!/usr/bin/python
import requests
import sys
import json
from datetime import date
import pprint
#Your PagerDuty API key. A read-only key will work for this.
auth_token = 'API_KEY_HERE'
View pd_dns_lookup.sh
#!/bin/bash
while true; do
dig foo.pagerduty.com mx >> ./test_mx.log
dig @8.8.8.8 foo.pagerduty.com mx >> ./test_mx.log
dig foo.pagerduty.com mx +trace >> ./test_mx.log
sleep 5
done
View pd_dns_lookup.cmd
:loop
@echo off
date /t >> test_mx.log
time /t >> test_mx.log
nslookup -type=MX foo.pagerduty.com >> test_mx.log
time /t >> test_mx.log
nslookup -type=MX foo.pagerduty.com 8.8.8.8 >> test_mx.log
time /t >> test_mx.log
nslookup -type=MX -d2 foo.pagerduty.com >> test_mx.log
time /t >> test_mx.log
@ryanhoskin
ryanhoskin / get_users.py
Last active Jan 7, 2019
Export a list of your PagerDuty users to a CSV file
View get_users.py
#Export a list of all users to a CSV file.
#This script is not supported by PagerDuty.
#!/usr/bin/env python
import datetime
import requests
import sys
import csv
View snooze
$pd_headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$pd_headers.Add("Authorization", 'Token token=<rest_api_token>')
$pd_url = "https://<subdomain>.pagerduty.com/api/v1"
$requester_id = "<requester_id>"
$incident_id = "<incident_id>"
$duration = "900" //in seconds
$data = @{
requester_id="$requester_id"
@ryanhoskin
ryanhoskin / get_log_entries.py
Created Aug 18, 2015
This script will export all log entries associated with a PagerDuty user.
View get_log_entries.py
#!/usr/bin/env python
import requests
import sys
import json
import csv
from datetime import date, timedelta
#This script will export all log entries associated with a PagerDuty user. All data is written to log_entries.csv.
View pandora_fms.pl
#! /usr/bin/perl
use LWP::UserAgent;
use JSON qw(decode_json);
use File::Basename;
### Configuration parameters ###
# Directory where is stored necessary files with match up ids between Pandora FMS and PagerDuty
# One hidden tiny file per alert will be created
View tien.py
#!/usr/bin/env python
#
# Copyright (c) 2011-2012, 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
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
@ryanhoskin
ryanhoskin / SN_filtered_integration.js
Created Apr 22, 2015
Filter out ServiceNow incidents that don't have a PagerDuty Service API Key associated with the assigned group.
View SN_filtered_integration.js
// High priority incident escalated - use PagerDuty to find Assigned to
// To support auto-escalated incidents, needed to add Advanced Script Condition
// Evaluates Filter conditions and then advanced conditions (not either/or)
// 1. changes() is not respected on a record insert
// 2. evaluates filter conditions (on When to run pane) before script conditions
// 3. auto-escalated events trap on current.operation() == insert
// 4. also needed to change into an 'after' event
@ryanhoskin
ryanhoskin / PAGERDUTY_V6.xml
Last active May 11, 2019
ServiceNow Update Set for PagerDuty integration
View PAGERDUTY_V6.xml
<?xml version="1.0" encoding="UTF-8"?>
<unload unload_date="2015-01-30 16:06:32">
<sys_remote_update_set action="INSERT_OR_UPDATE">
<collisions/>
<commit_date/>
<deleted/>
<description>PagerDuty is a third-party system used to alerts individuals/teams when an important issue requires attention. The integration with ServiceNow focuses on finding an owner (assignee) for high priority incidents.
Integration is supported in both directions allowing incidents to be acknowledged, delegated (assigned to another group) and resolved in either system. The following work models are supported:
1. User uses PagerDuty for notification only. Once notified, he/she uses ServiceNow to assign, investigate, resolve the incident.
You can’t perform that action at this time.