Skip to content

Instantly share code, notes, and snippets.

View kylebrandt's full-sized avatar
🦥
🛠️

Kyle Brandt kylebrandt

🦥
🛠️
View GitHub Profile
@kylebrandt
kylebrandt / example.txt
Created August 10, 2017 20:02
Bosun Host Down
alert host.down {
template = host.down
macro = host.based.contacts
macro = host.generic_info
$notes = Both ny-bosun01 and co-tsdb01 have to agree a host is down
$unit_string = Bosun ping timeout
$query_string = "sum:bosun.ping.timeout{dst_host=*,host=ny-bosun01|co-tsdb01}"
$last_two = sum(t(min(rename(q($query_string, "2m", ""), "host=source,dst_host=host")), "host"))
$previous_four = sum(t(min(rename(q($query_string, "5m", "1m"), "host=source,dst_host=host")), "host"))
$five_to_seven = sum(t(max(rename(q($query_string, "7m", "5m"), "host=source,dst_host=host")), "host"))
@kylebrandt
kylebrandt / gist:536300a5b1d6208394b264736ed76612
Last active October 12, 2017 12:22
Draft of Port-Channel Admin/Oper Alert
template network.nexus.portchannel.bad {
subject = {{.Last.Status}}: {{.Eval .Alert.Vars.upDownByHost | printf "%.f" }} down Port-Channels on {{.Group.host}}
body = `{{ template "header" . }}
{{/* source is http://www.net-snmp.org/docs/mibs/interfaces.html . Oper and Admin are actually different in that Admin only includes up/down/testing. However, 1, 2, 3 of Oper status is the same as the first 3 of admin status, so the same map can be used */}}
{{ $statusReference := makeMap "1" "up" "2" "down" "3" "testing" "4" "unknown" "5" "dormat" "6" "not present" "7" "lowerLayerDown" }}
{{ $joinResult := .LeftJoin .Alert.Vars.adminUpAndOperDown .Alert.Vars.operStatus .Alert.Vars.adminStatus }}
{{ if notNil $joinResult }}
<h2>Port-Channels with Non-Healthy Status</h2>
@kylebrandt
kylebrandt / limb.go
Created November 26, 2017 21:00
drum limb combinations
package main
import (
"fmt"
"math/bits"
"sort"
)
type Limb byte
Apr 18 09:11:11 kbrandtlx kernel: perf: interrupt took too long (4966 > 4957), lowering kernel.perf_event_max_sample_rate to 40250
Apr 18 13:29:38 kbrandtlx kernel: pciehp 0000:00:03.0:pcie004: Slot(5-3): Link Down
Apr 18 13:29:38 kbrandtlx kernel: pcieport 0000:00:03.0: AER: Multiple Uncorrected (Fatal) error received: id=0018
Apr 18 13:29:38 kbrandtlx kernel: pcieport 0000:00:03.0: PCIe Bus Error: severity=Uncorrected (Fatal), type=Transaction Layer, id=0018(Requester ID)
Apr 18 13:29:38 kbrandtlx kernel: pcieport 0000:00:03.0: device [8086:0e08] error status/mask=00004020/00000000
Apr 18 13:29:38 kbrandtlx kernel: pcieport 0000:00:03.0: [ 5] Surprise Down Error (First)
Apr 18 13:29:38 kbrandtlx kernel: pcieport 0000:00:03.0: [14] Completion Timeout
Apr 18 13:29:38 kbrandtlx kernel: pcieport 0000:00:03.0: broadcast error_detected message
Apr 18 13:29:38 kbrandtlx kernel: radeon 0000:06:00.0: device has no AER-aware driver
Apr 18 13:29:38 kbrandtlx kernel: snd_hda_intel 0000:06:00.1: device ha
@kylebrandt
kylebrandt / linelrforecastlr.txt
Created May 30, 2018 16:37
Bosun Expr: linelr based on forecastlr
# Only works for single result in series due to ungroup()
$q = q("sum:hbase.region.percentFilesLocal{host=literal_or(co-tsdb05)}", "20m", "")
$to100 = tod(ungroup(forecastlr($q, 100)))
$line = linelr($q, $to100)
merge($q, $line)
@kylebrandt
kylebrandt / docker.sh
Last active June 8, 2018 14:56
Bosun Data in ES PoC
docker run -d -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:5.5.3 && docker run -d -p 5601:5601 --net=host -e "ELASTICSEARCH_URL=http://localhost:9200" docker.elastic.co/kibana/kibana:5.5.3
@kylebrandt
kylebrandt / ghook.go
Last active October 30, 2018 02:38
Bosun git saving and pulling
package main
import (
"fmt"
"log"
"os"
"path/filepath"
"<replaceme>/bogit/util"
)
@kylebrandt
kylebrandt / gist:85ab9ff0cb4f61394b7796e429ca25dc
Created October 30, 2018 14:48
A Bosun -> Slack Template
slack = `
{{- $attachments := makeSlice -}}
{{- /* Set some slack properties on the attachment */ -}}
{{- $fallback := printf "Alert on %v" .Alert.Vars.url_host -}}
{{- $title := printf "%v: HTTPUnit Check for %v returned error(s)" .Last.Status .Alert.Vars.url_host -}}
{{- $ts := .LastAbnormalTime.Unix -}}
{{- $color := "good" -}}
{{- if .Last.Status.IsWarning -}}
{{- $color = "warning" -}}
@kylebrandt
kylebrandt / i3hangout.md
Last active June 27, 2023 15:50
i3 Hangout / Meet VLC screensharing workaround mutli-monitor

Share an area of your screen by using vlc screen capture, and then sharing the vlc capture window

Make sure the VLC window floats

In i3 config:

for_window [window_role="vlc-video"] floating enable move down 100px;

We float it so the tiling window manager doesn't resize the window and mess up the scale. We also move the window placement down at launch so it easy to drag somewhere mostly offscreen.

@kylebrandt
kylebrandt / bosun.json5
Last active January 25, 2019 20:19
Bosun VSCode Snippets
{
// Place your snippets for bosun here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
// "Print to console": {
// "prefix": "log",
// "body": [
// "console.log('$1');",