달력

1

« 2025/1 »

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31

특정 폴더(Parameter 1)의 파일 수가 일정 수(Parameter 2)를 넘지 않는지에 대한 모니터

Monitor -> New -> Scripting -> Timed Script Two State Monitor

Parameter
"
<Folder Name>" <Number Of Files>

사용자 삽입 이미지













State Expression

For Unhealthy Expression Property[@Name='State'] Equals BAD
For Healthy Expresion Property[@Name='State'] Equals GOOD

------------------------------------------------------------

Check.Folder.vbs

On Error Resume Next

Dim oAPI, oBag, objFSO, objFldr

Set oAPI = CreateObject("MOM.ScriptAPI")
Set oBag = oAPI.CreateTypedPropertyBag(StateDataType)
Set oArgs = WScript.Arguments

MessageText = ""

If oArgs.Count < 1 Then
Call oAPI.LogScriptEvent("Check.Folder.vbs", 500, 0, "Script aborted. Not enough parameters provided.")
WScript.Quit -1
End If

strFldr = oArgs(0)
NumberOfFiles = int(oArgs(1))
Set objFSO=CreateObject("Scripting.FileSystemObject")
Set objFldr=objFSO.GetFolder(strFldr)

If objFldr.Files.Count > NumberOfFiles Then
strReturn = "Number of Files in " & strFldr& " is greater than " & NumberOfFiles
                Call oBag.AddValue("State","BAD")
                Call oBag.AddValue("ret",strReturn)
Else
                Call oBag.AddValue("State","GOOD")
End If
Call oAPI.Return(oBag) 

:
Posted by 커널64