Example for monitoring a script file on UNIX- Monitoring a file system for zero-byte files

This example describes how you can use the script output monitoring feature of the BMC PATROL for Log Management to monitor a UNIX file system for files with a size of zero bytes. As this example shows, you can find either all the zero-byte files on the file system or just zero-byte files of a particular type.

To monitor a file system for zero-byte files

  1. Write a script called find_zero_size_filesthat contains the following lines:
    • To find all zero-byte files, include these lines:

      #!/bin/sh
      find $dir -size 0c -exec echo 0-byte file found: {} \; 2>/dev/null
    • To find zero-byte files of type *.js, *.html, and *.gif, include these lines:

      #!/bin/sh
      find /tmp -name "*.js" -size 0c -exec echo 0-byte file found: {} \; 2>/dev/null
      find /tmp -name "*.html" -size 0c -exec echo 0-byte file found: {} \; 2>/dev/null
      find /tmp -name "*.gif" -size 0c -exec echo 0-byte file found: {} \; 2>/dev/null
  2. Access the LOG application menu as described in Accessing Menu Commands, InfoBoxes, and Online Help.
  3. Select Add Instance.
  4. In the Add Instance dialog box, enter a label for the script output, such as ZeroFiles.
    The log icon label must be 50 characters or less and cannot contain any spaces.
  5. Click Accept.
  6. In the Add File for Label: instanceName dialog box, enter the full path to the find_zero_size_files script, in the File/Pipe Name text box. Arguments are not supported.
  7. In the File Type options, select Script.
  8. Define the default settings for the search criterion.
  9. Click Next.
  10. In the Configure Search Criteria: instanceName: Define Search Criterion dialog box, in the Search Criterion area, enter an identification label for the search criterion in the Search Identifier text box.
  11. Enter 0-byte file found: as String1.
  12. Click Next.
  13. In the Configure Search Criteria: instanceName: Override Default Settings dialog box, click Next.
  14. In the Configure Search Criteria: instanceName: Summary dialog box, click Finish.
    The Configure Search Criteria: instanceName: Summary dialog box closes and the PATROL KM for Log Management starts monitoring the script output that you added. The KM alarms if any zero-byte files are found on the file system.
Was this page helpful? Yes No Submitting... Thank you

Comments