Skip to content

Instantly share code, notes, and snippets.

@lfepp
lfepp / import_users.rb
Last active October 9, 2018 16:30
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'
require 'optparse'
class PagerDutyAgent
attr_reader :token
#!/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_YOUR_API_KEY'
#!/usr/bin/env ruby
require 'pp'
require 'httparty'
# Class to GET or POST to the PagerDuty REST API
class PagerDuty
include HTTParty
format :json
def initialize(api_token)
@lfepp
lfepp / pd_maintenance_windows_v2.rb
Created June 21, 2016 21:20
Create recurring maintenance windows
#!/usr/bin/env ruby
# Ruby script to create recurring maintenance windows in PagerDuty
#
# Copyright (c) 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
@lfepp
lfepp / README.md
Created June 10, 2016 16:02
Links to the PagerDuty Public Support Scripts utilizing v1 of the REST API
@lfepp
lfepp / create_vacation_overrides.py
Created June 6, 2016 20:35
Script to override all on-call schedules for a vacationing user with another user for the given time period within PagerDuty
#!/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 / import_users_from_ad.ps1
Last active November 9, 2016 16:24
Script to import users from Active Directory into PagerDuty
# 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
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
@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
@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 / remove_future_maintenance_windows.py
Last active October 15, 2019 19:23
Script to remove all future maintenance windows from your PagerDuty account or your PagerDuty 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