Skip to content

Instantly share code, notes, and snippets.

@alq666
alq666 / gist:3935851
Created October 23, 2012 00:26
Statsd example
irb(main):001:0> require 'statsd'
=> true
irb(main):002:0> s = Statsd.new('localhost', 8125)
=> #<Statsd:0x007fe299833f28 @host="localhost", @port=8125, @prefix=nil, @socket=#<UDPSocket:fd 5>>
irb(main):003:0> s
=> #<Statsd:0x007fe299833f28 @host="localhost", @port=8125, @prefix=nil, @socket=#<UDPSocket:fd 5>>
irb(main):004:0> s.time('test.alq.statsd', :tags => ['abc', 'def']) { puts "abc" }
abc
=> nil
diff --git a/checks/jmx.py b/checks/jmx.py
--- a/checks/jmx.py
+++ b/checks/jmx.py
@@ -474,7 +474,11 @@ class Solr(Jvm):
return self.get_metrics()
-def testprofiling():
+def test_tomcat():
import logging
occurrence_doy notifying daily
1 1 12
1 0 426
2 0 1158
2 1 2
3 0 630
3 1 48
4 0 1398
4 1 76
5 1 8
@alq666
alq666 / by_day.R
Created December 10, 2012 22:30
Alerting Trends
alerts_by_day <- read.csv(‘by_day.csv’)
ggplot(alerts_by_day, aes(day_of_year, daily, color=factor(notifying))) + geom_line()
+ xlab("Day of year")
+ ylab("Service Alerts")
+ ggtitle("Notifying v. silent alerts per day")
+ geom_smooth()
@alq666
alq666 / day_of_week.R
Created December 10, 2012 22:52
Alert distribution by day of week
ggplot(dd_by_hod, aes(occurrence_dow, daily, group=occurrence_dow))
+ geom_boxplot()
+ scale_x_discrete(breaks=seq(0, 6),
labels=c("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"))
+ xlab("Day of the week")
+ ylab("Number of alerts")
+ ggtitle("Daily distribution")
@alq666
alq666 / smartos.sh
Created December 11, 2012 23:21
SmartOS install
DD_API_KEY=... sh -c $(curl -k -L https://gist.github.com/raw/4263294/74de5e96a8ea47a566ed77d3845e9ec051e8e776/dd-agent.sh)
@alq666
alq666 / dd-agent.sh
Created December 11, 2012 23:24
Solaris-friendly agent install
#!/bin/sh
if [ -n "$DD_API_KEY" ]; then
apikey=$DD_API_KEY
fi
if [ -n "$DD_HOME" ]; then
dd_home=$DD_HOME
fi
@alq666
alq666 / chef-handler.rb
Created December 13, 2012 13:07
chef handler
require 'chef/handler/datadog'
chef_handler "Chef::Handler::Datadog" do
source "chef-handler-datadog"
arguments [:api_key => api_key, :application_key => chef_appkey]
supports :report => true, :exception => true
action :nothing
end.run_action(:enable)

Here are simple steps to install Datadog's agent on FC17. These steps are meant to be work-arounds until we officially support Fedora Core.

Steps

If you have /etc/yum.repos.d/datadog.repo, delete that file and run sudo yum makecache

Install python-tornado from FC repositories

sudo yum install python-tornado-2.2.1-1.fc17
package main
import (
"fmt"
"math"
)
const delta = 0.001
func Sqrt(x float64) float64 {