4.9 FileChanged

Use this Knowledge Script to determine whether a specified file has changed since the last monitoring interval. This script compares the current size, time stamp, and attributes for a file to the size, time stamp, and attribute settings found for the file the last time the script ran.

You can choose to raise an event if the size, time stamp, or attribute indicates the file has been modified, or raise an event if any of these properties indicates the file has not been changed since the last monitoring interval.

Because this script checks the file properties rather than the file content, you can use this script with almost any file type.

Because this script can raise an event if a particular file has changed or when a file you expect to change has not been modified, you can use the script many different ways to monitor your environment.

For example, you might have an application that runs nightly regression tests and generates a report of the results. You can use this script to raise an event when the time stamp for the regression report is not modified, indicating that the test harness might have failed or other problems occurred in producing the expected report. If no event is raised, you can assume that a new report was generated successfully.

In addition, because you can selectively monitor file size, modification time, and attributes, and set severity levels for these properties independently, you can get clearer insight into the changes made to key files and respond accordingly. For example, you can monitor the file modification time for a file and receive a warning or raise an informational event when this property changes. You can raise a critical severity event or receive an e-mail message if a file’s attribute changes to read-only or suddenly becomes writable.

4.9.1 Resource Objects

Windows 2003 Server or later

4.9.2 Default Schedule

The default schedule for this script is Every 24 hours.

4.9.3 Setting Parameter Values

Set the following parameters as needed:

Description

How to Set It

Event Notification

Create event if file size changed?

Select Yes to raise an event if the file size has changed since the last time the job ran. The default is unselected.

Severity - Size changed

Set the event severity level, from 1 to 40, to indicate the importance of an event in which the file size has changed. The default is 15 (yellow event indicator).

Create event if file time changed?

Select Yes to raise an event if the modification time of the file has changed since the last time the job ran. The default is Yes.

Severity - Time changed

Set the event severity level, from 1 to 40, to indicate the importance of an event in which the modification time has changed. The default is 15 (yellow event indicator).

Create event if file attribute changed?

Select Yes to raise an event if an attribute of the file has changed since the last time the job ran. The default is unselected.

Severity - Attribute changed

Set the event severity level, from 1 to 40, to indicate the importance of an event in which the file attribute has changed. The default is 15 (yellow event indicator).

Create event if file does not exist?

Select Yes to raise an event if the file you want to monitor does not exist. By default, events are not raised.

Severity - File does not exist

Set the event severity level, from 1 to 40, to indicate the importance of an event in which the file does not exist. The default is 15 (yellow event indicator).

Severity - Job failure

Set the event severity level, from 1 to 40, to indicate the importance of an event in which the FileChanged job fails unexpectedly. The default is 5 (red event indicator).

Monitoring

File path

Specify the full path to the file you want to monitor. For example: C:\Temp\myfile.txt

Monitor file for...

...changes. Select this option to raise events when there are changes to the file.

...no changes. Select this option to raise events when there are no changes to the file.