Skip to content

Instantly share code, notes, and snippets.

@piavlo
piavlo / client side
Created June 13, 2013 15:28
how to set sensu check defaults and override them per client as needed instead of defining whole check on client side , so ultimately this way the only checks than need to be defined on client side are standalone checks
/etc/sensu/conf.d/checks/thresholds/logstash-elasticsearch.json
{
"client": {
"params": {
"cpu": {
"warning": 80,
"critical": 90
},
"iowait": {
#!/bin/bash
GIT_DIR=$(git rev-parse --git-dir 2>/dev/null)
if [ -z "$GIT_DIR" ]; then
echo >&2 "fatal: hooks/functions: GIT_DIR not set"
exit 1
fi
read oldrev newrev refname
statsd {
tags => [ "apache-accesslog" ]
fields => [ "appname", "latency" ]
host => "statsd"
port => 8125
ignore_older_than => 5
namespace => "apache"
sender => "%{appenv}"
increment => [ "latency.%{appname}.%{latency}" ]
timing => [ "duration.%{appname}", "%{duration}",
#cat /etc/init/statsd.conf
description "StatsD"
author "Etsy"
start on (filesystem and net-device-up)
stop on runlevel [!2345]
respawn
respawn limit 5 30
{
graphitePort: 2003,
graphiteHost: "localhost",
port: 8125,
mgmt_port: 8126,
flushInterval: 10000,
deleteCounters: true,
percentThreshold: [90, 95, 99],
graphite: {
legacyNamespace: false,
cluster:
name: logstash-production
routing.allocation.awareness:
attributes: aws_availability_zone
force.aws_availability_zone.values: eu-west-1a,eu-west-1b
node:
name: somename
master: true
data: true
diff --git a/lib/sensu/client.rb b/lib/sensu/client.rb
index 479c12b..49872f2 100644
--- a/lib/sensu/client.rb
+++ b/lib/sensu/client.rb
@@ -233,12 +233,14 @@ module Sensu
socket.logger = @logger
socket.settings = @settings
socket.amq = @amq
+ socket.queue = @check_request_queue
diff --git a/lib/sensu/client.rb b/lib/sensu/client.rb
@piavlo
piavlo / gist:6556542
Last active December 23, 2015 00:49
explicit sensu extensions example
{
"handlers": {
"relay1": {
"type": "extension",
"command": "/etc/sensu/extensions/handlers/relay.rb"
"endpoints": {
"graphite": {
"host": "127.0.0.1",
"port": 60000
@piavlo
piavlo / gist:6714979
Last active December 24, 2015 00:09
cassnadra heap
http://localhost:8080/render/?height=700&width=1200&from=-6h&title=Cassandra Heap&
lineMode=slope&areaMode=none&drawNullAsZero=false&hideLegend=false&
target=metrics.cassandra.dsc1a.internal.heap.total&
target=metrics.cassandra.dsc1a.internal.heap.used&
target=stacked(group(
sumSeries(metrics.cassandra.dsc1a.internal.PRODUCTION.*.memtable_data_size),
sumSeries(metrics.cassandra.dsc1a.internal.PRODUCTION.*.bloom_filter_space_used),
scale(sumSeries(metrics.cassandra.dsc1a.internal.PRODUCTION.*.key_cache_capacity),869),
sumSeries(metrics.cassandra.dsc1a.internal.OpsCenter.*.memtable_data_size),
sumSeries(metrics.cassandra.dsc1a.internal.OpsCenter.*.bloom_filter_space_used),
@piavlo
piavlo / gist:7139097
Created October 24, 2013 15:17
Adding dynamic mapping to a "extra" key/value container blob
curl -XPUT localhost:9200/apache-accesslog-2013.10.24/apache-accesslog/_mapping -d '{
"apache-accesslog": {
"properties":{
"@fields": {
"properties": {
"extra" : {
"type" : "object",
"dynamic" : "true",
"include_in_all" : true
}