How to submit adhoc Graphite data

Python

import socket
host = ‘graphite.server.com’
port = 2003
sock = socket.socket()
sock.connect((host,port))
sock.send(data)
sock.close()
Perl
use IO::Socket::INET;
my $sock = new IO::Socket::INET( PeerAddr => ‘graphite.server.com’, PeerPort => ‘2003’, Proto => ‘tcp’);
$sock or die “no socket: $!”;
$sock->send($data);
close($sock);
Where data is
metric.name.object value epochtimestamp (newline)
metric.name.object2 value epochtimestamp (newline)
and that 2 values sent within the same precision will overwrite with the most recent one.
I.E. If your precision is 1 minute and you send
thing.one.count 5 1354216764
And 10 sec later
thing.one.count 2 1354216774
Graphite will report 2 for 1:19 on the day I wrote this (as opposed to 7).
Remember to reach out to your friendly graphite admin before sending any data

Fish Tank

I picked out a nice fishtank for my birthday present with my wife’s blessing.  Here are the pics all set up!

fistank_miles fishtank_light

 

Miles is 3ft tall now to give you an idea of size.

AppDynamics and Capistrano Tricks

We stood up a new performance environment last week and took some lessons learned and assistance that allowed us to get this up and running in record time.  We did have a series of one off tasks (that will get added into the kick off process) but that we needed to solve now… Capistrano to the rescue!

Except of course we had the original definition of the environment, plus all the changes and add-ons were in Jira somewhere and we set of to scrape together the complete server list until we remembered that all of our hosts were instrumented with AppDynamics (and incidentally GLU or even Graphite can be used for this if they have app/server info)

# Capfile using AppDynamics
require ‘rubygems’
require ‘json’
require ‘open-uri’

default_run_options[:pty] = true
set :sshkey, “id_rsa”
ssh_options[:keys] = [File.join(ENV[“HOME”], “.ssh”, “#{sshkey}”)]

doc = open(‘http://appdynamics.server.com/controller/rest/applications/new_perf_env/nodes?&output=JSON‘, :http_basic_authentication=>[‘User@Customer1′,’Password’]).read
parsed = JSON.parse(doc)
mname = Hash.new
parsed.each do |hash|
if hash.has_key? ‘machineName’
mname[hash[‘machineName’]] = 1
end
end
mname.each do |name,value|
server “#{name}”, :server
end

desc “get hostname as root for no reason whatsoever”
task :hostname, :max_hosts => 100,:on_error => :continue do
run “#{sudo} hostname”
end

Won an Award

The “Need for speed award” from AppDynamics. Our team instrumented our production environment and stood up an on premise HA controller in 2 weeks.

appdynamics

Some tools of the trade (what do I use and why)

Application monitoring, investigation and alerting:
AppDynamics
New Relic
JMX Trans

One off environment administration:
Capistrano

Configuration management:
cfengine
Ansible

Performance Testing:
Jmeter

Render Testing:
PhantomJS
Selenium

CI/CD and job scheduling:
Jenkins
Bamboo

Application level configuration management:
Glu

Graphing everything:
Graphite