Skip to content

Instantly share code, notes, and snippets.

View sacreman's full-sized avatar
💭
Adding tremendous value

Steven Acreman sacreman

💭
Adding tremendous value
  • ThunderOps
  • United Kingdom
View GitHub Profile
@sacreman
sacreman / requirements.txt
Created March 15, 2016 15:41
Dataloop Agent requirements.txt
###
# Core Agent dependencies. These are require for the Agent to run
###
APScheduler==3.0.3
netifaces==0.10.4
nose==1.3.7
psutil==3.2.2
pytz==2015.2
PyYAML==3.11
requests==2.7.0
#!/usr/bin/env python
import sys
import time
import yaml
import json
import requests
url = 'https://app.dataloop.io'
api_key = 'redacted'
org = 'organisation'
@sacreman
sacreman / nginx.py
Created February 9, 2016 10:21
much simpler nginx.py
#!/usr/bin/env python
import os
import re
from datetime import datetime
import sys
LOGFILE = '/var/log/nginx/access.log'
combined = '$remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent"'
timed_combined = '$remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" "$request_time"'
#! /usr/bin/env ruby
require 'main'
require 'yaml'
require 'httparty'
Main {
option('execute'){
argument :optional
description 'execute the check'
}
#!/usr/bin/env python
import requests
import xmltodict
from datetime import datetime
USER = ''
PASSWORD = ''
TIME = 3600 # age metric defaults to hours. set to 60 for minutes
#!/usr/bin/env python
import requests
import xmltodict
USER = ''
PASSWORD = ''
xml = requests.get('http://%s:%s@localhost:8161/admin/xml/queues.jsp' % (USER, PASSWORD)).text
obj = xmltodict.parse(xml)
@sacreman
sacreman / graphite.py
Created July 8, 2015 13:44
Statsite Graphite + Dataloop Sink
"""
Supports flushing metrics to graphite
"""
import sys
import socket
import logging
class GraphiteStore(object):
def __init__(self, host="localhost", port=2003, prefix="statsite.", attempts=3):
/*jshint node:true, laxcomma:true */
/*
* Flush stats to graphite (http://graphite.wikidot.com/).
*
* To enable this backend, include 'graphite' in the backends
* configuration array:
*
* backends: ['dataloop']
*
@sacreman
sacreman / upgrade_python.sh
Created November 19, 2014 14:34
Centos 6 upgrade to Python 2.7
#!/usr/bin/env bash
# install build tools
sudo yum install make automake gcc gcc-c++ kernel-devel git-core -y
# install python 2.7 and change default python symlink
sudo yum install python27-devel -y
sudo rm /usr/bin/python
sudo ln -s /usr/bin/python2.7 /usr/bin/python
root@dlovhriakn1:~# df -h
Filesystem Size Used Avail Use% Mounted on
rootfs 48G 4.8G 41G 11% /
/dev/root 48G 4.8G 41G 11% /
devtmpfs 16G 4.0K 16G 1% /dev
none 3.2G 252K 3.2G 1% /run
none 5.0M 0 5.0M 0% /run/lock
none 16G 0 16G 0% /run/shm
/dev/sda2 832G 100G 694G 13% /data