Is there a way to monitor the number of files in a folder that start with a specific file name?
I have a request to monitor a folder and look for the number of files that start with Order then the date, so this folder could look like:
Normally the File Count would work great, but for the purpose of this monitoring check I only care about the files named Orderxxxxxxxx.txt and not Invoice or Error. We want to be able to track when Order files are placed into this folder and when they are moved out of the folder when they are processed. Being able to get the number of files as a statistic would be helpful, since if they exceed a certain amount it could also tell us that the transfer process is not working or falling behind.
I am still stuck on APM 3.5 sadly so if there is a custom script it would have to be VBScript.
VBScript isn't normally my thing, but I was able to google enough to throw this together for you. Change the srcDirectory to suit your purpose.
' Script : count-orders.vbs
' Purpose: Count number of order files in the source path and
' report that as the statistic for SAM.
' Author : Steven "MrXinu" Klassen <firstname.lastname@example.org>
Dim fso, count, srcDirectory, folder, file
Set fso = CreateObject("Scripting.FileSystemObject")
srcDirectory = "C:\Your\Path\Here"
Set folder = fso.GetFolder(srcDirectory)
count = 0
For Each file in folder.files
If Left(fso.GetFileName(file), 5) = "Order" Then
count = count + 1
WScript.Echo "Statistic: " & count
SolarWinds solutions are rooted in our deep connection to our user base in the THWACK® online community. More than 150,000 members are here to solve problems, share technology and best practices, and directly contribute to our product development process. Learn more today by joining now.