| Server IP : 104.21.58.74 / Your IP : 216.73.216.213 Web Server : LiteSpeed System : Linux s12482.usc1.stableserver.net 5.14.0-570.32.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Aug 6 11:30:41 EDT 2025 x86_64 User : snownico ( 1231) PHP Version : 8.2.31 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /lib64/nagios/plugins/ |
Upload File : |
#!/bin/bash
# check_nimbus - check nimbus core services and statuses
# Requirements: n/a
# Author: Tsvetan Gerov <[email protected]>
# Version 0.3
# Initialize flags and error message
CRTIICAL=false
WARNING=false
ERROR_MESSAGE=""
# Check all PHP FPM services
check_fpm(){
INSTALLED_PHP=$(ls /usr/bin/php[0-9]*)
for PHP in $INSTALLED_PHP; do
FPM=$(echo "$(basename $PHP)-fpm.service")
if ! systemctl is-active $FPM >/dev/null 2>&1; then
CRTIICAL=true
ERROR_MESSAGE+="$FPM is down, "
fi
done
}
# Check Platform Agent
check_agent(){
local NAME="platform-agent.service"
if ! systemctl is-active $NAME >/dev/null 2>&1; then
CRTIICAL=true
ERROR_MESSAGE+="$NAME is down, "
fi
}
# Check Platform Metrics service
check_platform-metrics(){
local NAME="platform-metrics.service"
if ! systemctl is-active $NAME >/dev/null 2>&1; then
CRTIICAL=true
ERROR_MESSAGE+="$NAME is down, "
fi
}
# Check Platform Metrics Schedule service
check_platform-metrics-schedule(){
local NAME="platform-metrics-schedule.service"
if ! systemctl is-active $NAME >/dev/null 2>&1; then
CRTIICAL=true
ERROR_MESSAGE+="$NAME is down, "
fi
}
# Check ElasticSearch
check_elastic(){
CODE=$(curl 127.0.0.1:9200 -s -o /dev/null -w "%{http_code}")
if [ $CODE -ne "200" ]; then
CRTIICAL=true
ERROR_MESSAGE+="ElasticSearch is down, "
fi
}
# Check Redis
check_redis(){
if ! redis-cli ping >/dev/null 2>&1; then
CRTIICAL=true
ERROR_MESSAGE+="Redis is down, "
fi
}
# Perform checks
if ls /usr/bin/php[0-9]* 1>/dev/null 2>&1; then
check_fpm
fi
if [ -f "/etc/systemd/system/platform-agent.service" ]; then
check_agent
fi
if [ -f "/etc/systemd/system/platform-metrics.service" ]; then
check_platform-metrics
fi
if [ -f "/etc/systemd/system/platform-metrics-schedule.service" ]; then
check_platform-metrics-schedule
fi
if [ -f "/usr/share/elasticsearch/bin/elasticsearch" ]; then
check_elastic
fi
if [ -f "/usr/bin/redis-server" ]; then
check_redis
fi
# Return final state
if [ "$CRTIICAL" = true ]; then
echo "[CRTIICAL] ${ERROR_MESSAGE%, }"
exit 2
elif [ "$WARNING" = true ]; then
echo "[WARNING] ${ERROR_MESSAGE%, }"
exit 1
else
echo "[OK] All services are running correctly."
exit 0
fi