cancel
Showing results for 
Search instead for 
Did you mean: 
Create Post
Level 9

Monitoring for an export file change

Hi,

Please see the following request.:

We would like to setup a monitoring in Solarwinds for the FX Export job that runs on one of our DB servers.
The job creates a log file every time it runs, and does not when it fails. We need a SolarWinds alert and addition to the victor ops to notify if there is no file generated in the last 5 mins.

Details of the File:
Location of the file: e:\Alaric\FX_Export_Files\logs
Filename: FXexport.YYYYMMDD.hhmmss.log (i.e. FXexport.20200123-21400.log)
Run Frequency: Daily from 0600 -00:00 every 5 mins

Which of the following would provide the best result? (Attached image)

I was thinking File Age Monitor? So how would you enter the File Path? e:\Alaric\FX_Export_Files\logs\FXexport. ?

Would I need a wild card as there are more than one file type in there? The ones we are after are always named FXexport.YYYYMMDD.hhmmss.log. How would I use a wildcard here?

Thanks

Terry

0 Kudos
3 Replies
Level 9

Found an answer myself.

Just edit the values where appropriate:

# You may want to adjust these

$fullPath = "C:\the filepath"

$numdays = 0

$numhours = 0

$nummins = 0

function ShowOldFiles($path, $days, $hours, $mins)

{$idx = 0

    $files = @(get-childitem $path -include *.* | where {($_.LastWriteTime -lt (Get-Date).AddDays(-$days).AddHours(-$hours).AddMinutes(-$mins)) -and ($_.psIsContainer -eq $false)})

    if ($files -ne $NULL)

    {

        for ($idx = 0; $idx -lt $files.Length; $idx++)

        {

            $file = $files[$idx]

            #write-host ("Old: " + $file.name + $file.lastwritetime) -Fore Red

        }

    } write-host ("Statistic: " + $idx)

  write-host "Message: Whatever the result is to be"

          

}

ShowOldFiles $fullPath $numdays $numhours $nummins

0 Kudos

It seems that the above did not work, as it cannot detect the E: Drive. I went to SW Support with this and I was told that as far as he knew you couldn't monitor the E: Drive? This seems wrong to me.

0 Kudos

I'm assuming that this folder is not on your Orion server?  If not, then you need to run the PowerShell script in "Remote Host" mode:

KMSigma_0-1583762872379.png

Or, you can run it in "Local Host" mode, if you run it via the Agent.

"Shoot for the stars to reach the moon"
0 Kudos