Skip to content

Instantly share code, notes, and snippets.

@lfepp
lfepp / import_users.rb
Last active Oct 9, 2018
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'
require 'optparse'
class PagerDutyAgent
attr_reader :token
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_YOUR_API_KEY'
View pagerduty_ruby_httparty.rb
#!/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 Jun 21, 2016
Create recurring maintenance windows
View pd_maintenance_windows_v2.rb
#!/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 Jun 10, 2016
Links to the PagerDuty Public Support Scripts utilizing v1 of the REST API
View README.md
@lfepp
lfepp / create_vacation_overrides.py
Created Jun 6, 2016
Script to override all on-call schedules for a vacationing user with another user for the given time period within PagerDuty
View create_vacation_overrides.py
#!/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 Nov 9, 2016
Script to import users from Active Directory into PagerDuty
View import_users_from_ad.ps1
# 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 Jun 6, 2016
Script to create a list of users in PagerDuty from a file named "users.csv"
View create_users.py
#!/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 Jun 6, 2016
Script to retrieve the most recent activity for all users in your PagerDuty account
View get_user_activity.py
#!/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 Jul 1, 2016
Script to remove all future maintenance windows from your PagerDuty account or your PagerDuty services
View remove_future_maintenance_windows.py
#!/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
You can’t perform that action at this time.