HEX
Server: LiteSpeed
System: Linux s3604.bom1.stableserver.net 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64
User: dmstechonline (1480)
PHP: 7.4.33
Disabled: NONE
Upload Files
File: //lib64/nagios/plugins/check_a2_imunify_service
#!/bin/bash
# A2hosting Inc.

MWP=$(echo "$HOSTNAME" | grep -E 'mw[0-9]')

if [[ -n "$MWP" ]]; then
  echo "check_imunify360 - Managed Wordpress servers do not use Imunify360."
  exit 0
fi

imunify360_webshield_active=$(service imunify360-webshield status 2>/dev/null| awk '/Active: active \(running\)/ {print $2,$3}')
imunify360_active=$(service imunify360 status 2>/dev/null| awk '/Active: active \(running\)/ {print $2,$3}')
imunify360_licensed=$(imunify360-agent rstatus 2>/dev/null)

if [[ "$imunify360_licensed" == "OK" ]] && [[ "$imunify360_active" == "active (running)" ]] && [[ "$imunify360_webshield_active" == "active (running)" ]]; then
  echo "check_imunify360 - Imunify360 and Imunify360-webshield are running and the license is valid."
  exit 0
else
  echo "check_imunify360 - Imunify360 or Imunify360-webshield are either not running, or Imunify360 is not licensed on this server."
  exit 2
fi