Showing results for 
Search instead for 
Did you mean: 
Create Post

Custom Windows File Age and Count Monitor.apm-template

This windows vbs script obtains the number of files in a directory and the age of the oldest (or youngest) file. This template was originally developed to monitor FTP folders to verify that files were being transferred out of the source directory. It has since been used repeatedly in our environment for numerous purposes.

It returns two statistical values:

  1. AGE - this is the age of the oldest/youngest file in MINUTES
  2. COUNT - this is the number of files in the folder

It returns two messages:

  1. AGE - "Oldest file is ${FILENAME} and was last modified on: ${DATETIME}"
  2. COUNT - "${COUNT} ${EXT} files were found in the directory."
    • If the File Extension input is not used the value will not appear in the message.

The script takes 5 input values.

  • ${IP} - This Solarwinds variable will use the IP Address of the node being polled.
  • "\D$\Folder" - This is the network path to the folder. Use a single '\' at the beginning and do not use an ending '\'
  • ${USER} - This Solarwinds variable will use the username of the selected monitoring credential for the component.
  • ${PASSWORD} - This Solarwinds variable will use the password of the selected monitoring credential for the component
  • "TXT" - This is the file extension to limit the script to. This value is case sensitive. Use CAPS if unsure.

With in the script are two commented lines that mark code that can be commented out to ignore the file extension check and use all files in the folder. There is also a comment to mark where and how to change this script to find the youngest file in the folder.

((IMPROVEMENT LIST: 1) Build IF ${EXT} is blank logic to prevent the need to comment code. 2) build oldest/youngest logic into script input value ))

Labels (1)

Imported this template today, and it looks great. Tests fine. All tested on the same node using the same credentials:

However when I apply the template to the same Node I'm testing it on, the monitor stays in Unknown state and appears to be stuck in an initial poll. It's been like this for a couple hours.


I've tried changing out the credentials, adjusting the polling times. Everything tests without issue. Not sure what I've done wrong.

Version history
Revision #:
1 of 1
Last update:
‎02-24-2015 05:27 PM
Updated by: