Skip to content

Instantly share code, notes, and snippets.

View coxley's full-sized avatar

Codey Oxley coxley

View GitHub Profile
@coxley
coxley / slack-pagerduty-oncall.py
Created September 25, 2024 14:53 — forked from tr-fteixeira/slack-pagerduty-oncall.py
Updates a Slack User Group with People that are on call in PagerDuty (updated for slack_sdk after previous auth method was deprecated, changed user lookup on slack). Based on: https://gist.github.com/markddavidoff/863d77c351672345afa3fd465a970ad6
"""
Script to update on-call groups based on pagerduty escalation policies
From: https://gist.github.com/markddavidoff/863d77c351672345afa3fd465a970ad6
Slack permissions required:
- Installer must be able to update user groups.
- usergroups:read
- usergroups:write
- users:read
- users:read.email
@coxley
coxley / pre-commit
Created December 9, 2015 08:20 — forked from anl/pre-commit
Git pre-commit hook for DNS zone data - see http://andyleonard.com/2012/01/21/git-pre-commit-hook-for-dns-zone-data/
#!/bin/bash
# Adapted from a puppet pre-commit hook at:
# http://blog.snijders-it.nl/2011/12/example-puppet-27-git-pre-commit-script.html
#
# install this as .git/hooks/pre-commit to check DNS zone files
# for errors before committing changes.
rc=0
import copy
from pynsot.client import get_api_client()
api = get_api_client()
site = api.sites(api.default_site)
objects = site.networks.get(network_address='192.168.0.0')['data']['networks']
to_update = copy.deepcopy(objects)
[t['attributes'] = {} for t in to_update] # Strip the attributes
from __future__ import unicode_literals
"""
Loader for Trigger NetDevices using NSoT API.
Right now this loads ALL devices ALL the time, which scales very poorly with
the number of devices and attributes in NSoT.
To use this: