Monitoring the growth of a file

  • Thread starter deleting specific extensions
  • Start date
D

deleting specific extensions

Hello guys!
I would like to know if it is possible to monitor the growth of a file. For
example, I have a file that each hour it is modified and then I have to know
if this file is growing because if it is not, I have a problem.
I was trying to configure it on Operations Manager but it is not possible.
This script would be run each hour and if the file doesn´t grows send me a
e-mail.
Anyone can help me?
Thanks.

Ricardo Ito
 
R

Ricardo Ito

I found some scripts and merged as a result:

--
strComputer = "computername"
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\cimv2")

Set colMonitoredEvents = objWMIService.ExecNotificationQuery _
("SELECT * FROM __InstanceModificationEvent WITHIN 10 WHERE " _
& "TargetInstance ISA 'CIM_DataFile' and " _
& "TargetInstance.Name='c:\\temp\\text.txt'")

Do
Set objLatestEvent = colMonitoredEvents.NextEvent
Set objEmail = CreateObject("CDO.Message")
objEmail.From = "(e-mail address removed)"
objEmail.To = "(e-mail address removed)"
objEmail.Subject = "Something"
objEmail.Textbody = "The file text.txt is growing!!!"
objEmail.Send
Loop
--
 
T

Twayne

In deleting specific extensions
Hello guys!
I would like to know if it is possible to monitor the growth of a
file. For example, I have a file that each hour it is modified and
then I have to know if this file is growing because if it is not, I
have a problem.
I was trying to configure it on Operations Manager but it is not
possible. This script would be run each hour and if the file doesn´t
grows send me a e-mail.
Anyone can help me?
Thanks.

Ricardo Ito

You could schedule a .bat to run hourly and pipe the output of a DIR command
to a file. ' >>' is the append symbols so the old data isn't overwritten.
Quckest and easiest I know of. And if you know how to use filters in the
CLI, you could log just the filesize you want instead of all of the dir
command.
Is it a file you can move to a different folder?

Twayne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top