Skip to content

Instantly share code, notes, and snippets.

@lfepp
lfepp / create_maintenance_window.cs
Last active May 25, 2016 16:56
Create a PagerDuty maintenance window using C#
using System;
using System.IO;
using System.Net;
using System.Text;
namespace Examples.System.Net
{
public class WebRequestPostExample
{
public static void Main()
@lfepp
lfepp / get_alerts_csv.py
Last active May 25, 2016 16:57
Programatically acess and download the alerts for a PagerDuty incident as a CSV file
#!/usr/bin/env python
#
# Copyright (c) 2016, 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
@lfepp
lfepp / incidents_in_service.rb
Created May 26, 2016 00:07
Sample script to pull all PagerDuty incidents from a service within a given time range and print the output to the file incidents_in_service.txt
#!/usr/bin/env ruby
#
# Copyright (c) 2016, 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
@lfepp
lfepp / get_recent_incidents.sh
Created May 26, 2016 22:11
Sample shell script to pull PagerDuty incidents that were triggerd within the given time period and are in currently queue
#!/bin/sh
#
# Copyright (c) 2016, 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
@lfepp
lfepp / trigger_incident_multiple_services.py
Created June 1, 2016 17:24
Trigger a PagerDuty incident within multiple services
#!/usr/bin/env python
#
# Copyright (c) 2016, 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
@lfepp
lfepp / get_log_entry_details.rb
Last active June 1, 2016 23:59
Script to retrieve detailed information about a specific log entry in PagerDuty
#!/usr/bin/env ruby
#
# Copyright (c) 2016, 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
@lfepp
lfepp / get_incident_log_entries.rb
Created June 2, 2016 00:01
Script to retrieve all log entries from a PagerDuty incident
#!/usr/bin/env ruby
#
# Copyright (c) 2016, 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
@lfepp
lfepp / get_log_entry_details_file.rb
Created June 2, 2016 17:27
Script to retrieve detailed information about a specific PagerDuty log entry in a plain text file
#!/usr/bin/env ruby
#
# Copyright (c) 2016, 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
@lfepp
lfepp / get_user_activity.py
Created June 6, 2016 16:01
Script to retrieve the most recent activity for all users in your PagerDuty account
#!/usr/bin/env python
#
# Copyright (c) 2016, 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
@lfepp
lfepp / create_users.py
Last active June 6, 2016 18:46
Script to create a list of users in PagerDuty from a file named "users.csv"
#!/usr/bin/env python
#
# Copyright (c) 2016, 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