Skip to content

Instantly share code, notes, and snippets.

View mfournier's full-sized avatar

Marc Fournier mfournier

View GitHub Profile
source_url "https://raw.githubusercontent.com/cachix/devenv/95f329d49a8a5289d31e0982652f7058a189bfca/direnvrc" "sha256-d+8cBpDfDBj41inrADaJt+bDWhOktwslgoP5YiGJ1v0="
use devenv
global
[...]
defaults
[...]
resolvers haproxy-dns
nameserver dns-server 8.8.8.8:53
[...]
accepted_payload_size 8192
@mfournier
mfournier / dns.txt
Created January 8, 2018 16:22
haproxy A & AAAA DNS queries
No. Time Packet size Source address Source port Destination address Destination port
1 16:37:53.123628 113 10.42.63.232 37165 169.254.169.250 53 Standard query 0xb3fd A hello-world.dockercloud.rancher.internal OPT
Frame 1: 113 bytes on wire (904 bits), 113 bytes captured (904 bits)
Linux cooked capture
Internet Protocol Version 4, Src: 10.42.63.232, Dst: 169.254.169.250
User Datagram Protocol, Src Port: 37165, Dst Port: 53
Domain Name System (query)
[Response In: 4]
Transaction ID: 0xb3fd
lb:
scale: 1
load_balancer_config:
haproxy_config:
defaults: |-
mode http
option httplog
log-tag haproxy-SOME_PROJECT_NAME
backend b_stats
stats enable
@mfournier
mfournier / rancher-inventory.sh
Created July 1, 2016 12:35
rancher inventory
#!/bin/sh -xe
CREDS="$RANCHER_ACCESS_KEY:$RANCHER_SECRET_KEY"
for host in $(curl -su "$CREDS" "$RANCHER_URL/physicalHosts?limit=1000" | jq -r ".data[].links.hosts"); do
#echo "$host"
curl -su "$CREDS" $host | jq -r "{
hostname: .data[].data.fields.hostname,
storageDriver: .data[].data.fields.info.diskInfo.dockerStorageDriver,
ipAddress: .data[].data.fields.publicEndpoints[0].ipAddress,
2016-04-20 10:12:04 mfournier FWIW, I've updated a couple of production riemann's to master about a week ago, so far so good !
2016-04-20 10:13:07 mfournier only noticeable change: when querying the index returns an unreasonable amount of results, the server seems to interrupt the query and logs this error:
2016-04-20 10:13:08 mfournier riemann.transport.tcp - forcefully closing
2016-04-20 10:13:08 mfournier connection from #object[java.net.InetSocketAddress 0x35977b02 /192.168.200.10:35946] . Client might be
2016-04-20 10:13:09 mfournier not reading acks fast enough or network is broken
2016-04-20 10:13:17 mfournier s/error/warning/
2016-04-20 10:14:46 mfournier so this seems the right thing to do from the server perspective, but clients (tried the ruby lib & riemann-c-client) don't expect this and don't provide useful error messages (yet).
2016-04-20 12:01:34 insitu oh, I am the one responsible for that
2016-04-20 12:02:21 insitu mfournier: I had some OOME errors in riemann caused by misbehaving clients
time="2016-04-22T13:48:08Z" level=info msg="Loading configuration file /etc/prometheus-confd/prometheus.yml" source="main.go:202"
time="2016-04-22T13:48:08Z" level=info msg="Loading series map and head chunks..." source="storage.go:318"
time="2016-04-22T13:48:09Z" level=warning msg="Persistence layer appears dirty." source="persistence.go:702"
time="2016-04-22T13:48:09Z" level=warning msg="Starting crash recovery. Prometheus is inoperational until complete." source="crashrecovery.go:39"
time="2016-04-22T13:48:09Z" level=warning msg="To avoid crash recovery in the future, shut down Prometheus with SIGTERM or a HTTP POST to /-/quit." source="crashrecovery.go:40"
time="2016-04-22T13:48:09Z" level=info msg="Scanning files." source="crashrecovery.go:54"
time="2016-04-22T13:48:09Z" level=info msg="10000 files scanned." source="crashrecovery.go:76"
time="2016-04-22T13:48:10Z" level=info msg="20000 files scanned." source="crashrecovery.go:76"
time="2016-04-22T13:48:10Z" level=info msg="File scan complete. 25756 serie
@mfournier
mfournier / gist:ced6aa70397334af53db1f1b3a77e440
Created April 16, 2016 09:46
collectd ipmi precache filter
LoadPlugin target_replace
LoadPlugin ipmi
PreCacheChain "PreCache"
<Chain "PreCache">
<Rule "remove_ipmi_special_chars">
<Match "regex">
Plugin "^ipmi$"
</Match>
(deftest pgsql-xlog_pos
(let [index (:index (inject! [
{:pgsql_master "false"
:host "some_slave"
:service "postgresql-template1/gauge-xlog_pos-absolute/value"
:pgsql_defined_master_address "some_master-public-address"
:plugin "postgresql"
:tags ["collectd"]
:metric 48579391504
:ttl 20
@mfournier
mfournier / scan-processes.awk
Created February 26, 2016 11:47
sudo lsof | awk -f scan-processes.awk
{
if ($4 ~ /^DEL$/) {
sub(".#prelink#.*", "", $8)
mappings[$8]++
processes[$1]++
}
}
END {
for (j in mappings) {