• 0

how to monitor a UNC path to make sure a new file is added to the folder at 10am everyday.


A Olvera
 Share

Question

4 answers to this question

Recommended Posts

  • 0

Alex I do something similar. I wrote a powershell script that performs the check for me. Now you have two ways to do this.

One is to run the powershell script on the server(s) in question via scheduled task and have it write to the event log if the file is not there. Logic Monitor will pick this up and report it. This works pretty good if you are only needing to do this a small number of servers.

The second is to have your powershell accept the server name on a command line and return some value if the server does not contain the file in question. Then create a datasource based on the powershell script and have it pass the Host name to the script and error if the return value is x. This works well if you have lots of systems you want to check. The downside is I am not sure you can schedule it to run exactly at 10:00 in this method. You easily can have it run one a day though.

Link to comment
Share on other sites

  • 0

I don't specifically have a ready made one, but if you make a DS that "AppliesTo" a system.hostname=="oneOfYourCollectors" (make sure it's in the same domain as the resource with the UNC path you want to check).  Then something like:

if ( test-path "\\servername\C$\Path\To\File.txt" ) { write-output "1" } else { write-output "0" }

as a powershell script should do the trick.

Link to comment
Share on other sites

  • 0

My ability to edit the previous post timed out (annoying)... here's the final thing I was going for:

if (get-date -format HH -eq 10) {
  if ( test-path "\\servername\C$\Path\To\File.txt" ) {
    write-output "1"
  } else {
    write-output "0"
  }
}

Just checks the 24hr Hour to see if it's 10.  Have it fire once an hour.

Edited by Cole McDonald
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share