Shell script 100: 7 monitoring serve port

Be in before arrange of upside of system of a Linux Ntop serves, because the configuration of the service compares difference, basically be memory smaller, the service port of Ntop can be hanged occasionally, the reason is from the discharge of switching equipment mirror full to load arrives in Redis, redis memory extinct bring about a service unusual. The article before the deploy about Ntop can look how simple deploy Ntop comes monitoring data flow

Wrote a small script so, will judge port unusual, restart next service, script is simpler.

Shell script 100: 7 monitoring serve port

Script information:

# ! / Bin/bash

NTOP_PORT=`netstat -lpnt | Grep 3000 | Awk '{print $4}' | Awk -F " :" '{print $NF}'`

If [$NTOP_PORT -eq "3000" ];then

Echo "ntopng Already Running `date` "

Else

/ Etc/init.d/redis Restart

Sleep 5

/ Usr/local/ntopng/bin/ntopng /usr/local/ntopng/etc/ntopng.conf &

Fi

Shell script 100: 7 monitoring serve port

未经允许不得转载:News » Shell script 100: 7 monitoring serve port