
Ks Tan (Asia Vad) asked a question.
Script to monitor presence of new file as Up Condition
Client uses vendor solution, include Cisco, Palo Alto, Checkpoint, to handle the network and firewall device backup configuration and store it at shared folder.
Script below, to check the presence of new file in last 1 day, as Up criteria that the backup is executed correctly.
- 'Script created to monitor presence of new files, to assess timely and correct execution of backup job.
- 'Created by Kstan, Asia Vad.
- Set FSO = CreateObject("Scripting.FileSystemObject")
- ' Please update it to monitor other backup shared folder
- Set Folder = FSO.GetFolder("\\AsiaVADBackupSvr\PaloAlto\")
- Set FileList = Folder.Files
- Numfiles = 0
- For Each File in FileList
- On Error Resume Next
- ' To look for file less than 1 day old.
- ' The logic can be modified to greater sign, to look for files older than X days, or X minutes, if argument change from d to n for minutes, and h for hours.
- If DateDiff("d", File.DateLastModified, Now) < 1 then
- NumFiles = Numfiles + 1
- Else
- End If
- Next
-
- If NumFiles >= 1 Then
- Context.SetResult 0, "New backup files less than 1 day old, present in backup directory. Backup job is done correctly."
- Else
- Context.SetResult 1, "Backup job didn't happen, please check the backup task!"
- End If