Skip to content

Instantly share code, notes, and snippets.

@jazzl0ver
jazzl0ver / check_disk_spike.sh
Last active April 30, 2025 09:28
Nagios plugin for monitoring all mounted filesystems and detecting abnormal spikes in disk usage
#!/bin/bash
#
# This script monitors all mounted filesystems and detects abnormal spikes
# in disk usage based on historical percentage growth. It calculates the
# median and standard deviation of usage changes over time and reports a
# warning or critical alert if the latest change deviates significantly
# (Z-score based) from typical behavior.
#
@jazzl0ver
jazzl0ver / shrink_reindex.sh
Created April 24, 2025 16:47
Reduce number of shards for Opensearch/Elasticsearch indices in a loop
#!/bin/bash
# OpenSearch endpoint
HOST="https://localhost:9200"
username=admin
read -s -p "Password: " password
echo
# Опционально: если нужна basic auth
@jazzl0ver
jazzl0ver / opensearch_cpu_graph.sh
Created April 21, 2025 15:47
Opensearch/Elasticsearch CPU load per node ascii chart
#!/bin/bash
ENDPOINTS=(
"https://wi-node-1:9200"
"https://wi-node-2:9200"
"https://wi-node-3:9200"
)
INTERVAL=1
MIN_PANEL_HEIGHT=10
LOG_FILE="/tmp/opensearch_cpu_log.txt"
@jazzl0ver
jazzl0ver / logwatch-proxmox.conf
Last active November 29, 2024 10:36
logwatch config for proxmox ve
#
# put this file into /etc/logwatch/conf/
#
Service = "proxmox"
#!/bin/bash
################################################################################
# Script: check_es_system.sh #
# Author: Claudio Kuenzler www.claudiokuenzler.com #
# Purpose: Monitor ElasticSearch Store (Disk) Usage #
# Docs: www.claudiokuenzler.com/monitoring-plugins/check_es_system.php #
# License: GPLv2 #
# GNU General Public Licence (GPL) http://www.gnu.org/ #
# This program is free software; you can redistribute it and/or #
# modify it under the terms of the GNU General Public License #
@jazzl0ver
jazzl0ver / teler.haproxy.yaml
Created February 14, 2024 11:55
teler log setup for haproxy
log_format: |
$x $x $x $remote_addr:$x [$time_local] $x $x $x $x $x $x "$request_method $request_uri $request_protocol" $status {$x} $x $x $x $x $x $x
@jazzl0ver
jazzl0ver / cfgmaker-2.17.patch
Last active April 25, 2025 11:04
fixing "Use of uninitialized value $t in substitution (s///) at /usr/bin/cfgmaker line 1377"
--- cfgmaker.orig 2014-06-10 01:31:00.000000000 +0000
+++ cfgmaker 2025-04-25 11:02:32.424611033 +0000
@@ -16,7 +16,8 @@
# snpo - SNMP Polling
# snpd - SNMP Detail
#@main::DEBUG=qw(base);
-@main::DEBUG=qw(base snpo snpd);
+#@main::DEBUG=qw(base snpo snpd);
+@main::DEBUG=qw();
@jazzl0ver
jazzl0ver / openvpn.cfg
Created August 25, 2023 15:29
Nagios NRPE monitoring of OpenVPN Access Server
command[check_ovpn_users]=read -r users max <<< "$(sudo sacli LicUsage | jq -r '.[]' | paste -d ' ' - -)"; [ $(($max-$users)) -lt 5 ] && echo "CRITICAL: OpenVPN users CRITICAL ($users/$max) | 'ovpn_users'=$users;;$max" || echo "OK: OpenVPN users OK ($users/$max) | 'ovpn_users'=$users;;$max"
[trunk-checker-dst]
exten => _X.,1,ResetCDR
same => n,NoCDR
same => n,Set(DB(trunk_checker/${EXTEN})=${EPOCH})
same => n(end),Busy(2)
[from-trunk-pre]
exten => _X.,1,Set(DIALED_NUM=${EXTEN})
same => n,Goto(cont,1)
exten => _+X.,1,Set(DIALED_NUM=${EXTEN})
@jazzl0ver
jazzl0ver / check_systemd_units.sh
Last active September 18, 2024 14:59
Nagios check for systemd failed units
#!/bin/bash
# Source http://lzone.de/blog/Nagios+Check+for+Systemd+Failed+Units
# Nagios return codes
STATE_OK=0
STATE_WARNING=1
STATE_CRITICAL=2
STATE_UNKNOWN=3
if [ -f /bin/systemctl ]; then