#!/bin/bash
#################################################
#
#      Filename: monitor_usdnagent_stat.sh
#
#        Author: mark.tang@ucloud.cn
#   Description: check USDNAgent stat
#        Create: Feb 18 17:41:25 CST 2022
# Last Modified: Feb 18 17:41:25 CST 2022
#################################################
ps -ef | grep -i usdnagent | grep -v grep 1>/dev/null 2>&1
is_usdnagent_runnig=`echo $?`

if [ "$is_usdnagent_runnig" -ne 0 ];then
    echo '[{"value":0,"tags":""}]'
    exit 0
fi

check_port=`netstat -lntp | grep 7990`
if [ -z "$check_port" ]
then
    echo '[{"value":0,"tags":""}]'
    exit 0
else
    echo '[{"value":1,"tags":""}]'
    exit 0
fi
