This article provides information on how to use a script to monitor the SRX status every day/hour/minute/second.
In many scenarios, customers need to periodically check the performance of the SRX device. This helps customers in debugging and troubleshooting.
Cron is a tool which is used for periodically executing commands in the FreeBsd system. We can create a script, which includes certain monitor commands for SRX, and use a crontab to periodically run the scripts. Here is an example to run a script every minute:
echo `date "+%Y-%m-%d %H:%M:%S"` echo echo "cli show security monitoring fpc 1: " /usr/sbin/cli show security monitoring fpc 1 echo echo "cprod -A node1.fpc1.pic0 -c show usp flow session summary: " /usr/sbin/cprod -A node1.fpc1.pic0 -c "show usp flow session summary"
chmod +x /var/tmp/test.sh ls -l test.sh -rwxr-xr-x 1 root wheel 417 Aug 8 03:41 test.sh
crontab -e */1 * * * * sh /var/tmp/test.sh >> /var/tmp/test.log ---->*/1 means 1 minute interval, 2nd * means every hour, 3rd * means which day in a month, 4th * means which month, 5th * means which week day in a week.