Skip to content

Instantly share code, notes, and snippets.

@Freakin
Freakin / Sams_datadog_sensors.py
Created November 23, 2017 00:41 — forked from Sam-Martin/Sams_datadog_sensors.py
Sam's Server's Datadog Sensors
from subprocess import check_output
from datadog import statsd
from datadog.api.constants import CheckStatus
import requests
import re
zpool_status = check_output(["/sbin/zpool", "status"])
pattern = re.compile('state: ONLINE')
@Freakin
Freakin / getCfResult.py
Created April 25, 2017 17:50
Function to query results from CF API for N pages
def getCfResult(token, url, verify=False, resultsPerPage=50):
"""Get pages of json objects back from CF API URL"""
headers = {
"Authorization":"bearer {0}".format(token)
}
nextPage = True
jsonResult = []
while nextPage:
if "?" in url:
resultString = "&results-per-page={0}".format(resultsPerPage)