Skip to content

Instantly share code, notes, and snippets.

View SuperQ's full-sized avatar

Ben Kochie SuperQ

View GitHub Profile
@SuperQ
SuperQ / kubeApiServer_values.yaml
Last active June 8, 2022 13:49
Drop excessive cAdvisor metrics from kube-prometheus-stack helm chart.
# Taken from https://bugzilla.redhat.com/show_bug.cgi?id=1801154
kubeApiServer:
serviceMonitor:
metricRelabelings:
- action: drop
regex: apiserver_request_duration_seconds_bucket;(0.15|0.25|0.3|0.35|0.4|0.45|0.6|0.7|0.8|0.9|1.25|1.5|1.75|2.5|3|3.5|4.5|6|7|8|9|15|25|30|50)
sourceLabels:
- __name__
- le
@SuperQ
SuperQ / internet_check.sh
Created September 23, 2020 08:36
A script to check internet connectivity with the node_exporter textfile
#!/usr/bin/env sh
if curl -s -f -o /dev/null https://www.google.com; then
echo "node_internet_connected 1"
else
echo "node_internet_connected 0"
fi
@SuperQ
SuperQ / junos exapmle
Last active July 8, 2019 18:00
Fix Telegraf mysql commands metric names
metric_relabel_configs:
- source_labels:
- __name__
regex: 'mysql_com_(.+)'
target_label: command
- __name__
regex: 'mysql_com_(.+)'
target_label: __name__
replacement: mysql_commands_total
@SuperQ
SuperQ / url_sd_config.sh
Created July 27, 2018 13:15
Prometheus json/yaml URL to file_sd_config downloader.
#!/bin/bash
#
# Description: Download a URL and write out a file_sd_config.
# Author: Ben Kochie <superq@gmail.com>
set -o pipefail
if [[ $# -ne 2 || $1 == "-h" ]] ; then
echo "usage $(basename $0) <url> <sd file>"
exit
groups:
- name: Threshold-Alerts
rules:
- record: load_threshold
expr: "100"
- record: load_threshold
expr: "10"
labels:
node_type: tiny
- record: load_threshold
@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
@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
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 / generator.yml
Created July 20, 2017 10:36
snmp_exporter keepalived-mib
modules:
keepalived:
walk:
- vrrpInstanceTable
@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