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
- 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
- Access the LOG application menu as described in Accessing Menu Commands, InfoBoxes, and Online Help.
- Select Add Instance.
- 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. - Click Accept.
- 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.
- In the File Type options, select
Script
. - Define the default settings for the search criterion.
- Click Next.
- 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.
- Enter
0-byte file found:
as String1. - Click Next.
- In the Configure Search Criteria: instanceName: Override Default Settings dialog box, click Next.
- 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
Log in or register to comment.