*Here's a very simple sample script (from *
http://www.systemcentercentral.com/forums-archive/topic/monitoring-log-file-size/
)

Set ObjFso = CreateObject(“Scripting.FileSystemObject”)
Set objFile = objFSO.GetFile(“C:\tmp\myfile.txt”)
varSize = objFile.Size

Dim oAPI, oBag
If varSize > 148480 Then
Set oAPI = CreateObject(“MOM.ScriptAPI”)
Set oBag = oAPI.CreatePropertyBag()
Call oBag.AddValue(“Status”,”Bad”)
Call oBag.AddValue(“Size”, varSize)
Call oAPI.Return(oBag)
Else
Set oAPI = CreateObject(“MOM.ScriptAPI”)
Set oBag = oAPI.CreatePropertyBag()
Call oBag.AddValue(“Status”,”Ok”)
Call oAPI.Return(oBag)
End If

*and the tutorial on how to use it *
How to create a Script-based 2-State Monitor
http://www.systemcentercentral.com/download/how-to-create-a-script-based-2-state-monitor/

Regards,

Pete Zerger, MCT, MVP (System Center Cloud and Datacenter Management)
Founder, System Center Central: http://www.systemcentercentral.com
Founder System Center Virtual User Group




On Thu, Aug 15, 2013 at 11:57 AM, Brandy Reid <[email protected]> wrote:

> Hi IT Forum,****
>
> ** **
>
> Does anyone have a SCOM 2012 script they can share for monitoring file
> sizes on Windows Servers?****
>
> ** **
>
> The one I’m using isn’t generating an alert in the console..****
>
> ** **
>
> Set objFSO = CreateObject(“Scripting.FileSystemObject”)****
>
> Set objFile =
> objFSO.GetFile(“C:\Users\whoami\AppData\Local\Microsoft\Microsoft.EnterpriseManagement.Monitoring.Console\momcache.mdb”)
> ****
>
> varSize = objFile.Size****
>
> ** **
>
> Dim oAPI, oBag****
>
> If varSize > 1024 Then****
>
> Set oAPI = CreateObject(“MOM.ScriptAPI”)****
>
> Set oBag = oAPI.CreatePropertyBag()****
>
> Call oBag.AddValue(“Status”,”Bad”)****
>
> Call oBag.AddValue(“Size”, varSize)****
>
> Call oAPI.Return(oBag)****
>
> Else****
>
> Set oAPI = CreateObject(“MOM.ScriptAPI”)****
>
> Set oBag = oAPI.CreatePropertyBag()****
>
> Call oBag.AddValue(“Status”,”Ok”)****
>
> Call oAPI.Return(oBag)****
>
> End If****
>
>                             ****
>
> Thanks,****
>
> Brandy****
>
> * *
>
> *Brandy Reid* <[email protected]>****
>
> ** **
>
> *MCSE / MCDBA*
>
> * *
>
> *Systems Administrator*
>
> * *
>
> *IT-Automation and Monitoring*
>
> * *
>
> *Phone 901-227-3061  Fax 901-227-1001*
>
> * *
>
> *http://www.linkedin.com/in/brandyreid*<http://www.linkedin.com/in/brandyreid>
> **
>
> * *
>
> * *
>
> * *
>
> [image: Description: Description: M:\Graphics\100 years.jpg]**
>
> *Baptist Memorial Health Care* <http://www.baptistonline.org/>****
>
> * *
>
> *Smart Medicine. Inspired Care. And the awards*
>
> *to prove it.  Recognized as a Top 50 Healthcare Network.*****
>
> ** **
>
> *Opinions expressed above are not necessarily those of BMHCC*
>
> ** **
>
> This message and any files transmitted with it may contain legally
> privileged, confidential, or proprietary information. If you are not the
> intended recipient of this message, you are not permitted to use, copy, or
> forward it, in whole or in part without the express consent of the sender.
> Please notify the sender of the error by reply email, disregard the
> foregoing messages, and delete it immediately.
>
>
> P *Please consider the environment before printing this email...*
>
>
>



<<image001.jpg>>

Reply via email to