guglpon.blogg.se

File monitor
File monitor




file monitor

I could not find any good examples on the web for how to pass a property from a monitor, to a condition detection in a Recovery. The condition detection is a simple expression: Then, it will call another VBscript which will copy the file locally for us. FIRST, it will include a condition detection, to ensure that for all the “unhealthy” monitors, we will only attempt a recovery action IF the required folder is present, just the file is missing. That part is quite simple – and will generate an alert with context:

file monitor

I will create an expression for unhealthy, stating that if either the folder or file is missing, this is bad:Īnd expression for healthy requires BOTH to exist: This is a very reuseable monitor for other purposes: I will pass two parameters to this script – the directory and the filename I am looking for. WScript.Echo " File doesn't exist " oAPI.AddItem(oBag) ' File does not exist, submit property bag and exit Call oBag.AddValue( " FileExists ", " No " ) ' File exists, submit property bag and exit Call oBag.AddValue( " FileExists ", " Yes " ) ' Verify the file exists If (fso.FileExists(FilePath)) Then WScript.Echo " Folder doesn't exist " oAPI.AddItem(oBag) ' Folder does not exist, submit property bag and exit Call oBag.AddValue( " FolderExists ", " No " )Ĭall oBag.AddValue( " FileExists ", " No " ) ' Folder exists, submit property bag and continue Call oBag.AddValue( " FolderExists ", " Yes " ) ' Verify the path to the file exists xists If (fso.FolderExists(folder)) Then ' Instantiate MOM API Set oAPI = CreateObject( " MOM.ScriptAPI " ) ' Instantiate File System Object Set fso = CreateObject( " Scripting.FileSystemObject " )

file monitor

' Retrieve parameters folder = CStr(oArgs.Item( 0 ))įilePath = folder & " \" & file WScript.Echo folder ' OpsMgr related variables Dim oArgs, oAPI, oBag ' Declare Variables ' File-related variables Dim fso, folder, file, FilePath ' Intended for use with OpsMgr two state script monitor. ' COMMENT: Verifies a target file (including path) exists. ' AUTHOR: Pete Zerger, MVP (Cloud and Datacenter Admin) ' DATE : ' ' VBScript Source File - Created with SAPIEN Technologies PrimalScript 2009 ' Here is my customized version of Pete’s script: This monitor will run a VBscript, which we adapted from Pete Zerger’s script at We will start with a simple monitor example, which will use the. The AD management pack will automatically deploy this MSI if and when it is needed, but the MP expects the OOMADS.MSI to be in that specific directly above. This might leave several active directory domain controllers without these necessary scripting objects deployed. However, if the agent is manually installed, we do not copy this file, it is copied only if the agent is pushed from the SCOM console. The context of this example is for a scenario, where we expect the OOMADS.MSI file (Active Directory Helper Objects) to be placed in a specific directoy on the agent: C:\Program Files\Microsoft Monitoring Agent\Agent\HelperObjects If the file does not exist, we can run a recovery to copy the file there from a network location. This is going to be an example of making a two state monitor to check for the existence of a file on an agent managed server.






File monitor