Support Support Downloads Knowledge Base Juniper Support Portal Community

Knowledge Base

Search our Knowledge Base sites to find answers to your questions.

Ask All Knowledge Base Sites All Knowledge Base Sites JunosE Defect (KA)Knowledge BaseSecurity AdvisoriesTechnical BulletinsTechnotes Sign in to display secure content and recently viewed articles

How to use a script to monitor the SRX status every day/hour/minute/second



Article ID: KB21679 KB Last Updated: 23 Aug 2011Version: 1.0
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:
  1. Create a montor script for auto-run in /var/tmp as echo:

    echo `date "+%Y-%m-%d %H:%M:%S"`

    echo "cli show security monitoring fpc 1: "
    /usr/sbin/cli show security monitoring fpc 1

    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"
  2. Add the execute attribute for this script:

    chmod +x /var/tmp/
    ls -l
    -rwxr-xr-x 1 root wheel 417 Aug 8 03:41

  3. Edit the crontab to auto-run the script every minute and write the log file:

    crontab -e
    */1 * * * * sh /var/tmp/ >> /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.

Comment on this article > Affected Products Browse the Knowledge Base for more articles related to these product categories. Select a category to begin.

Getting Up and Running with Junos

Getting Up and Running with Junos Security Alerts and Vulnerabilities Product Alerts and Software Release Notices Problem Report (PR) Search Tool EOL Notices and Bulletins JTAC User Guide Customer Care User Guide Pathfinder SRX High Availability Configurator SRX VPN Configurator Training Courses and Videos End User Licence Agreement Global Search