Skip to content

Instantly share code, notes, and snippets.

#!/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
Created December 28, 2023 12:53
fixing "Use of uninitialized value $t in substitution (s///) at /usr/bin/cfgmaker line 1377"
--- cfgmaker.orig 2014-04-04 09:10:43.000000000 +0400
+++ cfgmaker 2017-07-17 13:57:26.000000000 +0300
@@ -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
Created February 7, 2023 16:27
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
@jazzl0ver
jazzl0ver / test_disk.sh
Created May 12, 2022 12:03 — forked from kvaps/test_disk.sh
Test disk with fio and parse results
#!/bin/sh
run(){
name="$1"
shift
(
set -x
# defailt parameters
fio -name="$name" -filename=$disk -output-format=json -ioengine=libaio -direct=1 -randrepeat=0 "$@" > results/$disk_dashed-$name.json
)
@jazzl0ver
jazzl0ver / move_attachments.php.patch
Created September 8, 2020 12:49
A dirty hack to move MantisBT attachments to disk by 100 at a time. Might be needed to execute it several times. Useful when there're a lot of attachments out there. Don't forget to raise max_execution_time and memory_limit PHP parameters in php.ini.
--- mantisbt-1.3.20/admin/move_attachments.php.orig 2019-09-26 19:42:19.000000000 +0300
+++ mantisbt-1.3.20/admin/move_attachments.php 2020-09-08 15:43:06.000000000 +0300
@@ -175,8 +175,13 @@
# Process projects list
foreach( $p_projects as $t_project ) {
+
+ $start = 0;
+ while ($start <= 1500) {
+ error_log($start);
@jazzl0ver
jazzl0ver / replicate_bucket.py
Created August 20, 2020 16:09
Replicate objects within or between regions in Oracle Cloud Object Storage
#!/usr/bin/env python
#
# The script requires that the OCI CLI be installed
#
#
# Edit these values to configure the script
#
oci_cli_profile_name = 'DEFAULT'
@jazzl0ver
jazzl0ver / ad_backup.bat
Created March 25, 2020 10:48
Backup Windows SystemState along with custom folders to a shared storage
@echo off
rem -- put this script into the task scheduler and redirect output to a log file:
rem -- c:\utils\ad_backup.bat > c:\utils\ad_backup.log 2>&1
rem -- path to remote storage
set SHARE=\\filer-1\sysstates
rem -- what to backup
set PATH2BACKUP=c:\utils C:\Windows\System32\dns\backup