Skip to content

Instantly share code, notes, and snippets.

View vvuksan's full-sized avatar

Vladimir Vuksan vvuksan

View GitHub Profile
@vvuksan
vvuksan / gist:1124364
Created August 4, 2011 02:19
Using Logstash to generate log metrics
input { whatever }
filter { grok { pattern => "%{COMBINEDAPACHELOG}" } } output { statsd { increment => "apache.status.%{response}" } }
@vvuksan
vvuksan / README
Created August 16, 2011 22:01
LXC (Linux Containers Installation)
This works under Ubuntu 10.10. I tried under 10.04 LTS but the Ubuntu templates are not there. Investigating.
[ Leaving this link here for reference in case I need to do apt-get upgrade. @ohloh recommends it
http://sourceforge.net/mailarchive/message.php?msg_id=26885493 ]
To make things easy have libvirt installed ie.
sudo apt-get install libvirt-bin
Otherwise you will need to set up bridges, iptables, dnsmasq.
@vvuksan
vvuksan / parser.py
Created November 18, 2011 22:37
Ganglia XDR packet parser
from socket import *
from xdrlib import Packer, Unpacker
# Set the socket parameters
host = "localhost"
port = 1234
buf = 1024
addr = (host,port)
slope_str2int = {'zero':0,
@vvuksan
vvuksan / gist:1390034
Created November 23, 2011 21:55
Intel SSD drives perf
Two INTEL SSDSA2CW300G3 in RAID 0 array
> tiotest -t 8 -f 2048 -r 500 -b 4096 -d /mnt/test
Tiotest results for 8 concurrent io threads:
,----------------------------------------------------------------------.
| Item | Time | Rate | Usr CPU | Sys CPU |
+-----------------------+----------+--------------+----------+---------+
| Write 16384 MBs | 39.3 s | 416.452 MB/s | 298.5 % | 229.5 % |
| Random Write 16 MBs | 0.3 s | 53.267 MB/s | 35.4 % | 134.0 % |
| Read 16384 MBs | 3.1 s | 5348.594 MB/s | 4770.1 % | 1515.4 % |
@vvuksan
vvuksan / gist:1941115
Created February 29, 2012 14:08
Ganglia alert on trend
<?php
$rrd_file = "/var/lib/ganglia/rrds/Test Cluster/localhost.localdomain/load_one.rrd";
$command = "/usr/bin/rrdtool xport --start '-600s' --end '-30s' ";
$command .= " --daemon unix:/tmp/rrdcached.limited.sock ";
$command .= "DEF:'sum'='" . $rrd_file . ":sum':AVERAGE XPORT:sum:metric_value VDEF:D2=sum,LSLSLOPE ";
$command .= "VDEF:H2=sum,LSLINT CDEF:avg2=sum,POP,D2,COUNT,*,H2,+ XPORT:avg2:trend";
@vvuksan
vvuksan / gist:3100171
Created July 12, 2012 19:03
JMX collection using command line JMX client
#!/bin/bash
if [ $# -ne 3 ]; then
echo "You need to supply both JMX host and port and metric. Exiting ..."
exit 1
fi
JAVA_BIN="/usr/bin/java"
JMX_CMDLINE="/opt/ganglia/cmdline-jmxclient-0.10.3.jar"
GMETRIC_BIN="/usr/bin/gmetric -d 180"
@vvuksan
vvuksan / gist:4425024
Last active December 10, 2015 10:59
time.apple.com NYE 2013 issues
# date
Tue Jan 1 02:46:29 UTC 2013
# ntpdate -q time.apple.com
server 17.171.4.13, stratum 16, offset -0.994684, delay 0.03630
server 17.151.16.22, stratum 16, offset -0.994590, delay 0.10086
server 17.151.16.21, stratum 16, offset -0.995015, delay 0.10132
server 17.151.16.20, stratum 15, offset -0.995329, delay 0.10136
server 17.151.16.23, stratum 15, offset -0.995040, delay 0.10164
server 17.171.4.33, stratum 15, offset -0.994484, delay 0.03622
server 17.171.4.34, stratum 16, offset -0.994793, delay 0.03615
@vvuksan
vvuksan / gist:6002154
Created July 15, 2013 18:18
Code Anywhere random errors
$ curl -v http://www.codeanywhere.net
* About to connect() to www.codeanywhere.net port 80 (#0)
* Trying 168.61.33.86...
* Connected to www.codeanywhere.net (168.61.33.86) port 80 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.29.0
> Host: www.codeanywhere.net
> Accept: */*
>
< HTTP/1.1 200 OK
#!/usr/bin/env ruby
# coding: UTF-8
# install_phantomjs.rb
#
# download, build, and install PhantomJS for Raspberry Pi
#
# * tested: PhantomJS 1.9.7 / Raspbian (Wheezy)
#
# created on : 2014.02.13
@vvuksan
vvuksan / gist:7f60f5552c2b96f39b16
Created December 27, 2014 16:21
Packet loss to Digital Ocean JFK
$ mtr -c 20 -r -w -z x.x.x.x
Start: Sat Dec 27 11:19:47 2014
HOST: xxxxxx Loss% Snt Last Avg Best Wrst StDev
<snip>
3. AS11426 gig10-0-0-424.rlghnca-rtr2.nc.rr.com 0.0% 20 19.2 25.6 10.6 73.2 13.1
4. AS11426 cpe-024-025-062-150.ec.res.rr.com 0.0% 20 14.2 14.3 10.8 36.4 5.3
5. AS11426 be31.chrcnctr01r.southeast.rr.com 0.0% 20 16.7 20.6 16.7 23.5 1.8
6. AS7843 bu-ether34.atlngamq46w-bcr00.tbone.rr.com 0.0% 20 28.5 24.7 20.6 33.9 3.6
7. AS7843 bu-ether21.atlngamq47w-bcr01.tbone.rr.com 0.0% 20 27.6 25.7 22.2 32.8 3.0
8. AS7843 107.14.17.190 0.0% 20 25.0 24.0 20.1 61.9 9.0