Skip to content

Instantly share code, notes, and snippets.

View ryanhoskin's full-sized avatar

Ryan Hoskin ryanhoskin

View GitHub Profile
@ryanhoskin
ryanhoskin / get_users.py
Last active August 8, 2023 19:37
Export a list of your PagerDuty users to a CSV file
#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
@ryanhoskin
ryanhoskin / Sampleapp.swift
Created April 22, 2022 17:18
A basic integration to Instabug
import SwiftUI
import Instabug
@main
struct Test_6App: App {
@UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
var body: some Scene {
WindowGroup {
ContentView()
}
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 sends emails to the assigned user for all status changes except resolved. Resolved incidents will email the user who last changed the incident status.
This code is unsupported by PagerDuty.
<?php
$messages = json_decode($HTTP_RAW_POST_DATA); // alternately, try file_get_contents('php://input');
@ryanhoskin
ryanhoskin / PAGERDUTY_V6.xml
Last active May 11, 2019 21:15
ServiceNow Update Set for PagerDuty integration
<?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.
@ryanhoskin
ryanhoskin / Trigger PD Incident
Last active March 13, 2018 13:27
Trigger a PagerDuty incident in C#
using System;
using System.IO;
using System.Net;
using System.Text;
namespace Examples.System.Net
{
public class WebRequestPostExample
{
#!/usr/bin/env python
import requests
import sys
import json
from datetime import date, timedelta
import csv
#Your PagerDuty API key. A read-only key will work for this.
AUTH_TOKEN = 'YOURKEYHERE'
#!/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
#!/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'
@ryanhoskin
ryanhoskin / heartbeat.ps1
Created March 31, 2014 17:02
Trigger and resolve incidents within PagerDuty forever... Heartbeat
#This script can trigger and resolve incidents within PagerDuty every 10 minutes
#Hit the PagerDuty Integrations API, echo results
function POST_Request ($url,$parameters) {
$http_request = New-Object -ComObject Msxml2.XMLHTTP
$http_request.open('POST', $url, $false)
$http_request.setRequestHeader("Content-type", "application/json")
$http_request.setRequestHeader("Content-length", $parameters.length)
$http_request.setRequestHeader("Connection", "close")
$http_request.send($parameters)
#!/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