Skip to content

Instantly share code, notes, and snippets.

View martindstone's full-sized avatar

Martin Stone martindstone

View GitHub Profile
@martindstone
martindstone / get_users_and_contacts.py
Created April 13, 2021 20:09
Use pagerduty-cli to get all PagerDuty users and contact methods as resources, and create import commands to import them
#!/usr/bin/env python3
import json
import subprocess
import datetime
def safe(str):
return str.replace("\\", "\\\\").replace("\"", "\\\"")
tf_user_string = """resource "pagerduty_user" "{name_lower}" {{
@martindstone
martindstone / get_users.py
Last active April 9, 2021 20:59
Use pagerduty-cli to get all PagerDuty users as resources, and create import commands to import them
#!/usr/bin/env python3
import json
import subprocess
import datetime
def safe(str):
return str.replace("\\", "\\\\").replace("\"", "\\\"")
tf_string = """resource "pagerduty_user" "{name_lower}" {{
@martindstone
martindstone / docker-compose.yml
Created April 22, 2020 18:24
PDaltagent docker-compose file
version: "3"
services:
rabbit:
image: rabbitmq:3-management-alpine
container_name: pdaltagent_rabbitmq
environment:
- RABBITMQ_DEFAULT_USER=pdaltagent
- RABBITMQ_DEFAULT_PASS=pdaltagent
ports:
# The standard AMQP protocol port
@martindstone
martindstone / pingdom.js
Created August 3, 2017 20:54
Pingdom custom event transformer
var body = PD.inputRequest.body;
var normalized_event = {
"description": "Check " + body.check_name + " reports " + body.current_state + ": " + body.long_description,
"source": body.check_params.hostname + ":" + body.check_params.port,
"component": body.check_type,
"details": body,
"incident_key": "" + body.check_id,
"dedup_key": "" + body.check_id
};
@martindstone
martindstone / splunk-es.js
Created August 2, 2017 21:51
Custom Event Transformer for Splunk ES payloads
var body = PD.inputRequest.body;
const keys_to_strip = [
"punct",
"_subsecond",
"date_second",
"date_minute",
"date_hour",
"date_wday",
"date_mday",