5,466 views
Monitor file age with Operations Manager 2007 (vbscript monitor)
In this post, I will explain one of the techniques to monitor the age of a given file, using vbscript and Operations Manager 2007
This is what the script looks like :
Option Explicit Dim oArgs Dim objFile ‘replace single slashes with double slashes Set oBag = oAPI.CreatePropertyBag() |
This is how it works
Open the authoring pane in OpsMgr and go to monitors
Find the Windows Computers (or any other scope that contains computer objects). Create a new unit monitor (Script based, two state monitor) and save the monitor in your custom management pack. Specify a good name, make sure to leave the monitor disabled for now (uncheck the "Monitor is enabled" checkbox at the bottom). We only want to run this script on one server, so we will create an override for this server lateron.
Quick note before continuing : you’ll have to create a monitor for each file that you want to watch. So you can put the name of the server and the name of the file in the monitor name field.
Configure the schedule (e.g. once per day)
Define the script filename (don’t forget the .vbs extension) and set a timeout. This is a just a simple script, so 1 minute will be fine.
Click "Parameters" and enter the absolute path to the file that you want to monitor. (between double quotes)
Paste the entire script from the table above in the Script: field
Expressions :
Unhealthy :
Parameter Name : Property[@Name=’DaysAgo’]
Operator : is greater than
Value :
(Note : as you can see in the script, if the file is not found, the script will return 9999… it’s up to you how you want to deal with that. You can write another monitor that checks for the presence of the file and look at the 9999 value… )
Healthy :
Parameter Name : Property[@Name=’DaysAgo’]
Operator : is less than or equal to
Value :
Finish the monitor by allowing the monitor to create an alert. In the alert description field, you can specify some text :
The file is $Data/Context/Property[@Name=’DaysAgo’]$ days old, which is older than …. days
Save the monitor
Edit the monitor again and create an override for the server that contains the file you want to look at.
Enable the monitor for that server, and wait until it kicks it.
© 2008, Peter Van Eeckhoutte (corelanc0d3r). All rights reserved.
Similar/Related posts:
2 Responses to Monitor file age with Operations Manager 2007 (vbscript monitor)
Corelan Training
Check out our schedules page here and sign up for one of our classes now!
Donate
Your donation will help funding server hosting.
Corelan Team Merchandise
Corelan on Slack
You can chat with us and our friends on our Slack workspace: