Skip to content

Instantly share code, notes, and snippets.

View baskarp's full-sized avatar

Baskar Puvanathasan baskarp

View GitHub Profile
CMDB:
I do not have names on specific commentors. These notes have been re-ordered to make a bit more sense.
We have dynamic environments, with information coming from systems and builds.
Systems need configuration from runtime data based on service discovery and build configuration (IP addresses, versions, etc).
CMDB use contexts:
On call users - The sysadmin who has been paged at 4 am needs to determine context for the page.
Deployment systems - To know where to deploy software, what version(s) to deploy, etc.
Maintenance - Downtimes, escalate, software versions, hardware info...
@baskarp
baskarp / PagerDuty_Migration.js
Created January 14, 2016 17:20 — forked from jlrjr/PagerDuty_Migration.js
Migration script to move from legacy PagerDuty update set integration to the new Fuji ServiceNow store app
/*
* Must be run from backgroup script as a user with the elevated security_admin role
*/
// migrate incident id values
migrateIncidents();
// migrate group attributes from legacy update set application to the new Fuji store app
migrateGroups();
Import-Module ActiveDirectory
#Import users via the PD API, echo results
function POST_Request ($url,$parameters, $api_key) {
$http_request = New-Object -ComObject Msxml2.XMLHTTP
$http_request.open('POST', $url, $false)
$http_request.setRequestHeader("Content-type", "application/json")
$token = "Token token=" + $api_key
$http_request.setRequestHeader("Authorization", $token)
$http_request.setRequestHeader("Content-length", $parameters.length)
@baskarp
baskarp / import_users.rb
Created December 18, 2012 20:07
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'
class PagerDutyAgent
attr_reader :requester_id
attr_reader :token
#!/usr/bin/env ruby
# Ruby script to create recurring maintenance windows in PagerDuty
#
# Copyright (c) 2012, PagerDuty, Inc. <[email protected]>
# 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
@baskarp
baskarp / mirror_incident.rb
Created November 2, 2012 08:28
Ruby script to mirror an email incident as an API incident in PagerDuty
#!/usr/bin/env ruby
# Ruby script to mirror an email incident as an API incident
#
# Copyright (c) 2011, PagerDuty, Inc. <[email protected]>
# 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
@baskarp
baskarp / pagerduty.bat
Created October 29, 2012 09:41
Invoke PagerDuty using cURL from Windows
@echo off
:: Download cURL with SSL support from here: http://www.paehl.com/open_source/?CURL_7.28.0:
:: Extract curl.exe in the same directory as this bat file
:: Usage: pagerduty.bat service_key event_type description incident_key
:: event_types = (trigger | acknowledge | resolve)
::
set service_key=%1
set service_key=%service_key:"=\"%
set event_type=%2
set event_type=%event_type:"=\"%
@baskarp
baskarp / quick_ack.rb
Created October 29, 2012 07:43
A script to quickly ack a PagerDuty incident by incident number
#
#
# How to use this script:
#
# 1) You'll need to have Ruby installed on your machine.
# Follow these instructions to install Ruby on your machine: https://docs.google.com/document/pub?id=1Eo3f77CC1Flkb2f71ro-NZCYK2VuA6ajxvcuTGG_c6Q
#
# 2) Once Ruby is installed, run the following from your command prompt:
# gem install faraday --no-ri --no-rdoc
#
@baskarp
baskarp / pagerduty_opsview.pl
Created August 21, 2012 00:43
PagerDuty Nagios plug-in with support for OpsView
#!/usr/bin/env perl
# Nagios plugin that sends Nagios events to PagerDuty.
#
# Copyright (c) 2011, PagerDuty, Inc. <[email protected]>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@baskarp
baskarp / gist:3291141
Created August 8, 2012 01:12
How to setup Python command line tool for PagerDuty
Here is a quick instructions on how to setup the Python command line tool for PagerDuty.
1) You'll need to have Python installed (tested with Python 2.6.1)
2) Verify if Python setuptools are installed
python -c "import setuptools;print 'OK';"
if you don't see output "OK", then setuptools are not installed.
To install setuptools, download setuptools (http://pypi.python.org/pypi/setuptools/) appropriate to your Python major version. ("python --version" to get the version number).