Skip to content

Instantly share code, notes, and snippets.

View SuperQ's full-sized avatar

Ben Kochie SuperQ

View GitHub Profile
@SuperQ
SuperQ / gist:8188367b48c3fe8a5d0526ddaf45b376
Created October 31, 2016 16:01
Primitive init.d cgroup handler
cgroup=SERVICE
if [ ! -d /cgroup/${cgroup} ] ; then
mkdir -p /cgroup/${cgroup}
fi
echo 3 > /cgroup/${cgroup}/memory.move_charge_at_immigrate
echo $$ > /cgroup/${cgroup}/cgroup.procs
echo 32M > /cgroup/${cgroup}/memory.limit_in_bytes
@SuperQ
SuperQ / LICENSE.md
Created April 24, 2017 14:34 — forked from matthiasr/LICENSE.md
Exporting chef-client metrics to Prometheus

The MIT License (MIT)

Copyright © 2017 SoundCloud Ltd.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE

@SuperQ
SuperQ / generator.yml.patch
Last active December 13, 2017 14:04
snmp_exporter label adder
diff --git a/generator/generator.yml b/generator/generator.yml
index faef3fc..4783862 100644
--- a/generator/generator.yml
+++ b/generator/generator.yml
@@ -2,22 +2,11 @@ modules:
# Default IF-MIB interfaces table with ifIndex.
if_mib:
walk: [sysUpTime, interfaces, ifXTable]
- # Interfaces if ifAlias is unique.
- if_mib_ifalias:
@SuperQ
SuperQ / prometheus.yml
Created May 30, 2017 13:14
Blackbox ICMP
- job_name: 'blackbox-icmp'
metrics_path: /probe
params:
module: [icmp]
static_configs:
- targets:
- 8.8.8.8
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
@SuperQ
SuperQ / prometheus.yml
Last active July 11, 2017 08:07
Basic static Prometheus config
scrape_configs:
- job_name: freeswitch
metrics_path: /
static_configs:
- targets:
- freeswitch1:6780
- freeswitch2:6780
@SuperQ
SuperQ / generator.yml
Created July 20, 2017 10:36
snmp_exporter keepalived-mib
modules:
keepalived:
walk:
- vrrpInstanceTable
@SuperQ
SuperQ / snmp.yml
Created August 21, 2017 21:42
ServerTech Sentry3-MIB multi-index lookup example
servertech_sentry3:
walk:
- 1.3.6.1.4.1.1718.3.2.2.1 # infeedEntry
metrics:
- name: infeedStatus
oid: 1.3.6.1.4.1.1718.3.2.2.1.5
type: gauge
indexes:
- labelname: towerIndex
type: gauge
@SuperQ
SuperQ / gist:a0a6cff60d899b49812d7b9ff9be3b19
Created November 3, 2017 16:42
Comet metric name fuckery
metric_relabel_configs:
- source_labels: [__name__]
target_label: channel
regex: ch(\d+).+
- source_labels: [__name__]
target_label: __name__
regex: ch\d+(.+)
replacement: ch${1}
@SuperQ
SuperQ / snmp.yml
Last active November 9, 2017 16:29
jnxOperatingCPU
juniper_cpu:
walk:
- 1.3.6.1.4.1.2636.3.1.13.1
metrics:
- name: jnxOperatingCPU
oid: 1.3.6.1.4.1.2636.3.1.13.1.8
type: gauge
help: The CPU utilization in percentage of this subject - 1.3.6.1.4.1.2636.3.1.13.1.8
indexes:
- labelname: jnxOperatingContentsIndex
groups:
- name: Threshold-Alerts
rules:
- record: load_threshold
expr: "100"
- record: load_threshold
expr: "10"
labels:
node_type: tiny
- record: load_threshold