Skip to content

Instantly share code, notes, and snippets.

🔨
If I had a hammer

Kyle Brandt kylebrandt

🔨
If I had a hammer
Block or report user

Report or block kylebrandt

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View kernel.txt
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 / limb.go
Created Nov 26, 2017
drum limb combinations
View limb.go
package main
import (
"fmt"
"math/bits"
"sort"
)
type Limb byte
@kylebrandt
kylebrandt / gist:536300a5b1d6208394b264736ed76612
Last active Oct 12, 2017
Draft of Port-Channel Admin/Oper Alert
View gist:536300a5b1d6208394b264736ed76612
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>
View example.txt
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 / _.xkb_symbols_local
Created Feb 24, 2017
keyboard remappings with xkb
View _.xkb_symbols_local
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> };
@kylebrandt
kylebrandt / Overview
Created Feb 2, 2017
Previewing Puppet ERB Files with JSON Datasource from Commandline
View Overview
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 / bosun-hiera-config.json
Created Aug 8, 2016
Bosun Puppet Example ( :: in fname is dir )
View bosun-hiera-config.json
{
"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 / hook.go
Last active Jul 13, 2016
hook for bosun conf file saving to push to git
View hook.go
package main
import (
"fmt"
"log"
"os"
"os/exec"
"path/filepath"
)
View notes.md

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 / Backup Cronjob
Created May 20, 2016
Redis Config, Version, Backup for Stack Overflow's Bosun Instance
View Backup Cronjob
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.
You can’t perform that action at this time.