⚝
One Hat Cyber Team
⚝
Your IP:
160.79.111.104
Server IP:
162.254.39.145
Server:
Linux premium289.web-hosting.com 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64
Server Software:
LiteSpeed
PHP Version:
8.2.28
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
proc
/
self
/
root
/
lib64
/
nagios
/
plugins
/
nccustom
/
View File Name :
check_safe_logger.sh
#!/bin/bash log_host="127.0.0.1" log_port="514" log_path=$(systemctl cat hc-safe-logger|grep -i "LOG_DIRECTORY"|awk -F'=' '{gsub(/"/,"",$3); print $3}') [[ -z "${log_path}" ]] && log_path="/var/log/nc_audit/hc-safe-logger" # check process if ! (pidof hc-safe-logger > /dev/null 2>&1); then echo "CRITICAL! hc-safe-logger: Process doesn't exist." exit 2 fi # check connection if ! (nc -zu "${log_host}" "${log_port}"); then echo "CRITICAL! hc-safe-logger: Connection refused." exit 2 fi # check new records logger --server "${log_host}" --port "${log_port}" -p local0.info "check hc-safe-logger" -t "HEALTH_CHECK" && sleep 3 files=$(find "${log_path}" -mmin -59 -type f) if [[ -z "${files}" ]]; then echo "CRITICAL! hc-safe-logger: No records in log from last hour." exit 2 fi # all check passed echo "OK. hc-safe-logger: Healthy." exit 0