I know how to alert on if a file exists via vfs.file.exists[file] and if how to alert if a file is older than a certain threshold (vfs.file.time[/your/file] and {TemplateName:vfs.file.time[/your/file].now(0)} - {TemplateName:vfs.file.time[/your/file].last(0)}>900).
I'm trying to work out how to alert only if a file exists and is older than 15 minutes. The situation is I'm monitoring for a lock file that is created when a script runs and deleted at the completion of the script. I want to alert only if the file exists and is older than 15 minutes as that would indicate the script has crashed before cleaning up the lock file is no longer running because of this.
The script is run every 60 seconds and may only run for 10-15 seconds so there's a good chance that the lock file won't exist when the check is performed. If the file doesn't exist, then I would expect the threshold above would come back with a result equal to the unix time of now since the second value in the formula would be zero. This would trigger the threshold which is not the desired result as the lack of a lock file is normal.
Basically, I only want to alert if both file exists AND the file age is greater than 900 seconds. Is it possible to create an alert only if both conditions are met?
I'm trying to work out how to alert only if a file exists and is older than 15 minutes. The situation is I'm monitoring for a lock file that is created when a script runs and deleted at the completion of the script. I want to alert only if the file exists and is older than 15 minutes as that would indicate the script has crashed before cleaning up the lock file is no longer running because of this.
The script is run every 60 seconds and may only run for 10-15 seconds so there's a good chance that the lock file won't exist when the check is performed. If the file doesn't exist, then I would expect the threshold above would come back with a result equal to the unix time of now since the second value in the formula would be zero. This would trigger the threshold which is not the desired result as the lack of a lock file is normal.
Basically, I only want to alert if both file exists AND the file age is greater than 900 seconds. Is it possible to create an alert only if both conditions are met?
Comment