V1rus Private
User / IP
:
216.73.217.108
Host / Server
:
190.92.174.125 / aerosofthealthcare.com
System
:
Linux s3739.bom1.stableserver.net 4.18.0-513.24.1.lve.2.el8.x86_64 #1 SMP Fri May 24 12:42:50 UTC 2024 x86_64
Cmd
|
Upload
|
Mass Deface
|
Create
|
Sym
:
/
lib64
/
nagios
/
plugins
/
Viewing: check_icinga_hosts.sh
#!/bin/bash usage() { echo " check_icinga_hosts - Icinga check for number of services" echo "" echo " Usage: check_icinga_hosts -w <warning threshold> -c <critical threshold> [ -h ]" echo "" echo " -w Service count at which a warning is triggered" echo " -c Service count at which a critical is triggered" echo " -h Show this page" echo "" } cmdopts() { if ( `test 0 -lt $#` ) then while getopts w:c:h myarg "$@" do case $myarg in h|\?) usage exit;; w) WARNING=$OPTARG;; c) CRITICAL=$OPTARG;; *) usage exit;; esac done else usage exit fi } cmdopts $@ # Get the host count from Icinga2 HOST_COUNT=$(icinga2 daemon -C | grep "information/ConfigItem: Instantiated" | grep "Services" | awk '{print $6}') # Check if we got a valid number if [[ "$HOST_COUNT" =~ ^[0-9]+$ ]]; then if [ "$HOST_COUNT" -ge "$CRITICAL" ] then echo "CRITICAL: Icinga Services count is at $HOST_COUNT (threshold: $CRITICAL)"; exit 2; elif [ "$HOST_COUNT" -ge "$WARNING" ] then echo "WARNING: Icinga Services count is at $HOST_COUNT (threshold: $WARNING)"; exit 1; else echo "OK: Icinga Services count is at $HOST_COUNT"; exit 0; fi else echo "UNKNOWN: Could not determine services count" exit 3 fi
Coded With 💗 by
HanzOFC