Skip to content

Instantly share code, notes, and snippets.

View kylebrandt's full-sized avatar
🦥
🛠️

Kyle Brandt kylebrandt

🦥
🛠️
View GitHub Profile
@kylebrandt
kylebrandt / gist:14acacd867d67382629a
Created March 1, 2016 18:55
tsdbrelay cli options
/opt/tsdbrelay/tsdbrelay -b ny-bosun01:8080 -t localhost:4242 -l 0.0.0.0:5252 -denormalize=os.cpu__host,os.mem.used__host,os.net.bytes__host,os.net.bond.bytes__host,os.net.other.bytes__host,os.net.tunnel.bytes__host,os.net.virtual.bytes__host -r co-bosun:80 -redis ny-bosun01:6389 -db 0
@kylebrandt
kylebrandt / gist:733572edb66c27894f22
Created March 1, 2016 18:59
ny bosun haproxy config
global
chroot /var/lib/haproxy
daemon
group haproxy
log 127.0.0.1 local0
maxconn 4000
pidfile /var/run/haproxy.pid
stats socket /var/lib/haproxy/stats
user haproxy
@kylebrandt
kylebrandt / gist:91bd77288bdd526fa7df
Last active March 3, 2016 00:25
Bosun Elastic Expression Query Example, Per Minute
$minute = 5
$bucketSize = "${minute}m"
$index = esls("logstash")
$keyField = "logsource"
$filter = esquery("message", "scollector")
escount($index, $keyField, $filter, $bucketSize, "1d", "") / $minute
$metric = "sum:5m-avg:rate{counter,,1}:__ny-nexus02.os.net.bytes{host=ny-nexus02,iname=Ethernet3/1}"
$monthToDate = mtod(-4)
$commit = 150
$mtdAgo = epoch()-$monthToDate
$q = q($metric, tod($mtdAgo), "") * 8
$mtdAgo > d("1d") && percentile($q, .95) / 1e6 > $commit*.70
@kylebrandt
kylebrandt / Backup Cronjob
Created May 20, 2016 16:31
Redis Config, Version, Backup for Stack Overflow's Bosun Instance
0 * * * * cp -a /var/lib/redis/bosun-redis.rdb '/mnt/bosun_backup/bosun_redis_'$(date +\%Y-\%m-\%d-\%H).rdb && find '/mnt/bosun_backup/' -maxdepth 1 -name 'bosun_*.rdb' -ctime '+2' -delete
## Hmpf, ctime makes no since, just noticed, but whatever.
@kylebrandt
kylebrandt / notes.md
Created June 17, 2016 16:49
Release notes

0.5.0 Release Notes

Bosun

This is our first non-preview release in 9 months and includes significant changes since 0.4.0. Future releases should be at a quicker pace since this release involved a complete refactor of Bosun's internal storage.

  • We have moved Bosun's internal storage from purely in-memory (that was seralized to bolt) to redis/ledis and refactored the code to be more incident based. In 0.4.0 the dashboard could take 10-30 seconds to load at times. It now should not take more than a second under normal conditions, and should be even faster in a future release. This also results in faster startup times for Bosun and other performance improvements
  • Deprecated the logstash queries and replaced them with more generic elastic functions. This supports different time formats, index naming schemes, and adds more search possibilities
  • Added support for basic series operations. Before wit
@kylebrandt
kylebrandt / hook.go
Last active July 13, 2016 19:07
hook for bosun conf file saving to push to git
package main
import (
"fmt"
"log"
"os"
"os/exec"
"path/filepath"
)
@kylebrandt
kylebrandt / bosun-hiera-config.json
Created August 8, 2016 14:40
Bosun Puppet Example ( :: in fname is dir )
{
"classes": [
"bosun",
],
"bosun::quiet": false,
"bosun::httplisten": ":8080",
"bosun::timeanddate": [ 202, 75, 179, 136 ],
"bosun::hostname": "bosun.example.com",
"bosun::shorturlkey": "2220abb99ef14ebaa2a9c12afd8185e1",
"bosun::rulefilepath": "/opt/bosun/config/prod.conf",
@kylebrandt
kylebrandt / Overview
Created February 2, 2017 21:05
Previewing Puppet ERB Files with JSON Datasource from Commandline
Based on the idea in this SO answer: http://stackoverflow.com/a/30037886/107156
1) Create a ruby file to contain the variables
2) when running erb, important that file as a library
Notes:
- The .rb file must have all variables that you call methods on (i.e. `any?`) or you will get a nilClass error.
- The switch to -r doesn't have the .rb extension on it, but the file does
@kylebrandt
kylebrandt / _.xkb_symbols_local
Created February 24, 2017 23:03
keyboard remappings with xkb
partial modifier_keys
xkb_symbols "kycracra" {
modifier_map Mod3 { Super_L, Super_R };
key <SUPR> { [ NoSymbol, Super_L ] };
modifier_map Mod3 { <SUPR> };
key <HYPR> { [ NoSymbol, Hyper_L ] };
modifier_map Mod4 { <HYPR> };