Community discussions

MikroTik App
 
asimoneau
just joined
Topic Author
Posts: 1
Joined: Wed Sep 08, 2010 11:11 pm

File exist Probe

Tue Mar 11, 2014 10:55 pm

Hi, ive been enjoying The Dude for a long time and this is what i am trying to do.

I want to monitor the number of files in a specific folder.

I want to know if i have mail in the spool folder or undeliverable folder of IIS server.
Id like to show in my Dude map the numbers of files in a specific folder.

ex: c:\inetpub\mailroot\queue...........5 files

so i will be able to see if the number goes up like 100 files it means there is a problem with my server.
I will be using this to monitor other server too (coldfusion...) this is not specific to IIS.

Im trying a combination of script to make it happen but no luck yet..

Also is there a way to make the content of a file appear on the appearance of a device ?
Lets say i have a text file with a couple numbers in it....can i GET the content and put it on my map ?

Thanks a lot
 
lebowski
Forum Guru
Forum Guru
Posts: 1619
Joined: Wed Aug 27, 2008 5:17 pm

Re: File exist Probe

Wed Mar 12, 2014 3:36 pm

This is certainly doable, file counts could be the result of a simple batch job.

Search the forum for execute. Note v4 command works slightly different from v3. Build a very simple example and put it on a label (on the appearance) and go from there.

executes program, returns array of three elements - return code, standard output, standard error. return code is -1 if error occurs. Only first parameter mandatory. First paramerter - command, second - parameters, third - path, forth - input string to pass to program, fifth - timeout in seconds (default 5.0)

NOTE The dude logic is not perfect sometimes -1 is not false when you need -1 to be false add one to it. When building a probe use 0 for error not -1.

For testing put stuff like this on a label, create your own test files... v4.3b examples.
[array_element(execute("test.bat","tests1.txt","c:\\"),1)]
[execute("test.bat","test.txt","c:\\")]

Lebowski

Who is online

Users browsing this forum: No registered users and 57 guests