If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Monitoring the growth of a file
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 |
Ads |
#2
|
|||
|
|||
Monitoring the growth of a file
Hi Recardo
"deleting specific extensions" . com wrote in message ... 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 I would suggest you use the GetFileSize function in the Windows API: http://msdn.microsoft.com/en-us/libr...8VS.85%29.aspx Or perhaps better use the last modification time for the file using the GetFileTime function: http://msdn.microsoft.com/en-us/libr...8VS.85%29.aspx Graham. |
#3
|
|||
|
|||
Monitoring the growth of a file
Hi Recardo
"deleting specific extensions" . com wrote in message ... 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 I would suggest you use the GetFileSize function in the Windows API: http://msdn.microsoft.com/en-us/libr...8VS.85%29.aspx Or perhaps better use the last modification time for the file using the GetFileTime function: http://msdn.microsoft.com/en-us/libr...8VS.85%29.aspx Graham. |
#4
|
|||
|
|||
Monitoring the growth of a file
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 = " objEmail.To = " objEmail.Subject = "Something" objEmail.Textbody = "The file text.txt is growing!!!" objEmail.Send Loop -- "Graham" wrote: Hi Recardo "deleting specific extensions" . com wrote in message ... 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 I would suggest you use the GetFileSize function in the Windows API: http://msdn.microsoft.com/en-us/libr...8VS.85%29.aspx Or perhaps better use the last modification time for the file using the GetFileTime function: http://msdn.microsoft.com/en-us/libr...8VS.85%29.aspx Graham. . |
#5
|
|||
|
|||
Monitoring the growth of a file
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 = " objEmail.To = " objEmail.Subject = "Something" objEmail.Textbody = "The file text.txt is growing!!!" objEmail.Send Loop -- "Graham" wrote: Hi Recardo "deleting specific extensions" . com wrote in message ... 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 I would suggest you use the GetFileSize function in the Windows API: http://msdn.microsoft.com/en-us/libr...8VS.85%29.aspx Or perhaps better use the last modification time for the file using the GetFileTime function: http://msdn.microsoft.com/en-us/libr...8VS.85%29.aspx Graham. . |
#6
|
|||
|
|||
Monitoring the growth of a file
In ,
deleting specific extensions . com typed: 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 -- We've already reached tomorrow's yesterday but we're still far away from yesterday's tomorrow. |
#7
|
|||
|
|||
Monitoring the growth of a file
In ,
deleting specific extensions . com typed: 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 -- We've already reached tomorrow's yesterday but we're still far away from yesterday's tomorrow. |
Thread Tools | |
Display Modes | |
|
|