Skip to content

Instantly share code, notes, and snippets.

@omerhasan
omerhasan / pagerduty_munin.py
Created October 3, 2011 23:55 — forked from samuel/pagerduty_munin.py
PagerDuty script for Munin
#!/usr/bin/env python
try:
import json
except ImportError:
import simplejson as json
import sys
from pagerduty import PagerDuty
def parse(txt):
@omerhasan
omerhasan / dhcpd.conf
Created April 16, 2012 20:43 — forked from tomoconnor/dhcpd.conf
snippet to show usage of dhcp-event (don't forget to set apparmor to allowing (complain) mode)
subnet 192.168.0.0 netmask 255.255.255.0 {
range 192.168.0.100 192.168.0.200;
option broadcast-address 192.168.0.255;
option routers 192.168.0.1;
on commit {
set ClientIP = binary-to-ascii(10, 8, ".", leased-address);
set ClientMac = binary-to-ascii(16, 8, ":", substring(hardware, 1, 6));
log(concat("Commit: IP: ", ClientIP, " Mac: ", ClientMac, "Hostname: ", host-decl-name));
execute("/usr/local/bin/dhcp-event", "commit", ClientIP, ClientMac, host-decl-name);
}
@omerhasan
omerhasan / ebs_raid.rb
Created May 22, 2012 01:25 — forked from tnine/ebs_raid.rb
Ebs raid mounting. Links to this jira issue http://tickets.opscode.com/browse/CHEF-2275
include Opscode::Aws::Ec2
#Auto locates and attached ebs devices based on the data bag they reside in. The following test cases need to be performed
# Create multiple resources with new node: PASS
#
# Re-attach multiple resources after a reboot: PASS
#
# Create resources across 2 runs. First run creates first raid set, second run re-attaches then creates: PASS
#
@omerhasan
omerhasan / analyze_haproxy_performance.pl
Created June 27, 2012 23:44 — forked from kamermans/analyze_haproxy_performance.pl
HAProxy log analyzer to show response latency distribution from the console
#!/usr/bin/perl
# HAProxy Performance Statistics
# by Steve Kamerman
#
# To use, pipe your HAProxy log with timing information (like "0/0/1/1/3 200") to
# this script. It will output min, max, med, avg and a latency distribution graph.
#
# Info on timing logging in HAProxy: http://code.google.com/p/haproxy-docs/wiki/TimingEvents
#