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 / gist:4453493
Created January 4, 2013 15:32
haproxy config
global
log 127.0.0.1 local2 info
pidfile /var/run/haproxy.pid
stats socket /var/run/haproxy.stat mode 600 level admin
#debug
defaults
mode http
log global
@sacreman
sacreman / gist:7504775
Created November 16, 2013 20:15
awesomeness
#!/usr/bin/env python
import setuptools # needed for pyinstaller
import os
import sys
import psutil
import time
import re
import argparse
<URL "http://localhost:8098/stats">
Instance "riak"
<Key "converge_delay_last">
Type "gauge""
</Key>
<Key "converge_delay_max">
Type "gauge""
</Key>
<Key "converge_delay_mean">
Type "gauge""
@sacreman
sacreman / global zone
Created June 11, 2014 09:09
riak perf issues
[root@dlovhn1 /tmp]# iostat -nx 1
extended device statistics
r/s w/s kr/s kw/s wait actv wsvc_t asvc_t %w %b device
0.0 0.0 0.1 0.0 0.0 0.0 0.1 0.4 0 0 lofi1
0.0 0.0 0.2 0.2 0.0 0.0 0.0 0.0 0 0 ramdisk1
7.0 102.9 206.0 2865.2 0.4 0.1 4.0 0.5 10 6 c0t0d0
7.0 102.9 207.0 2865.2 0.4 0.1 4.0 0.5 10 6 c0t1d0
14.0 166.7 413.0 5730.5 39.2 1.0 217.0 5.6 6 14 zones
extended device statistics
r/s w/s kr/s kw/s wait actv wsvc_t asvc_t %w %b device
@sacreman
sacreman / gist:bd221ff1841af63d1838
Created July 8, 2014 13:32
Send Windows perf counters to Graphite
import time
import socket
import pywintypes
import win32pdh
class Win32Performance:
def __init__( self ):
self.counters = []
self.hq = win32pdh.OpenQuery()
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
@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
/*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 / 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):
#!/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)