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/vz7_check_a2_license.sh
#!/bin/bash
#
# Script to monitor vz7 license status
# Ref SYSENG-1618
#

vzlicinfo=$(vzlicview|grep -iE "expiration|status")
expire_time=$(date -d "$(echo "$vzlicinfo"|awk -F"=" '/expiration=/ {print $2}'|tr -d '\"')" +%s)
lic_status=$(echo "$vzlicinfo"|awk -F"=" '/status=/ {print $2}'|tr -d '\"')

if [ "${lic_status}" != "ACTIVE" ]; then
  printf "vz7lic_check - License is not active\n"
  exit 2
else
  seconds_to_expiry=$((${expire_time} - $(date +%s)))
  # 604800s = 7days
  if [ "${seconds_to_expiry}" -lt 604800 ]; then
    days_to_expiry=$((${seconds_to_expiry}/86400))
    printf "vz7lic_check - License is about to expire in ${days_to_expiry} days\n"
    exit 1
  else
    printf "vz7lic_check - License is active \n"
    exit 0
  fi
fi