DX Unified Infrastructure Management

 View Only

Tech Tip: Create a Directory watcher to count the number of files in the folder

  • 1.  Tech Tip: Create a Directory watcher to count the number of files in the folder

    Posted Jan 14, 2014 04:16 PM


    Counting the number of files in a folder requires two watchers, a directory Monitor then a threshold monitor.
    I have included steps which include how to configure the monitor directives using the VAIM UI and manually defining the monitor directives in the sysedge.cf.


    Configuring Directory and Threshold watchers using VAIM UI:
    First: Identify the directory you want to monitor.

    Then configure the Directory Monitor using the UI.

    In this example, we will monitor files located in C:\Program Files\CA\SystemEDGE\config\port161 folder.
    Note: If you notice the space between Program Files, in the UI, you do not need to enclose the space.


    Create the Directory Monitor directive
    1. Define watcher in VAIM UI
      Select Monitor Type:        Directory Monitoring
      Log File/Directory Name: C:\Program Files\CA\SystemEDGE\config\port161
      **Note: The agent cannot filter for specific files. All files will be counted that exist in the directory
    2. Save this entry by clicking the Save button

    Create the threshold monitor to count all the files located in the directory


    1. Click on the Threshold Tab, the click on + to add a new entry
      Object Class:      logMonitorEntry [Log file monitors]
      Object Attribute: logMonitorLogFileCount [Number of files/directories monitored]
      Object Instance: c:\Program Files\CA\SystemEDGE\data\port161
    2. Click Save button, Save Policy Button, then Action -> select Apply Policy
      Note: Object Instance entry will be the folder name and location defined in the Monitor Directory directive


    Validate the monitors are created

    Validate in the Explore -> Select Agent -> Summary Tab and validate the threshold entry state is Active.

    Manual create directory and threshold monitor directives in sysedge.cf
    Manually entering Monitor Directory and Threshold Directives in the c:\Program Files\CA\SystemEDGE\data\port161\sysedge.cf file.

    Directory Monitor Directive

    template watch logfile <index> <flags> <file> <regexpr> <descr> <action> <interval> <severity> watch logfile 11 0x4800 'c:\Program Files\CA\SystemEDGE\data\port161' .* '' '' 60 none


    Threshold Monitor Directive

    template monitor oid <oid> <index> <flags> <interval> <stype> <oper> <thresh> <descr> <action> <supIndex> monitor logMonitorEntry 'c:\Program Files\CA\SystemEDGE\data\port161' logMonitorLogFileCount 15 0x0 60 absolute >= 11 'Monitor for Sysedge Port 161 Folder' '' logMonitorEntry 'c:\Program Files\CA\SystemEDGE\data\port161' logMonitorLogFileCount ok