First I must say I am sorry that I didn't get my last post correct, there is a typo in the function. Second I am sure this will work.
Create a bat file called getlog.bat there are 2 lines in that file. The program "more" returns the value in fig.log so there is no need to make the execute function more complex.
@echo off
more fiq.log
Create fiq.log and put 95 in it with nothing else, make a function;
Function;
name: getfiq
code: if(array_element(execute("GetLog.bat","","C:\\"),1), array_element(execute("GetLog.bat","","C:\\"),1), "False")
probe;
Name: fique
available: getfiq()<>"False"
error: if(getfiq()<>"False",if(getfiq() < 285, "", concatenate("Warning: Fax server at Capacity = ", getfiq())), "Failed read Fax Capacity")
value: getfiq()
Here is the steps I took to make sure things worked each step of the way.
Put [getfiq()] on a device label and the label shows 0,95,
Since that worked modify the device label to [array_element(getfiq(),1)] and the label shows 95 with out the extra fields.
I moved the array_element into the function to verify that there is still 95 on the label.
getfiq
array_element(execute("GetLog.bat","FIQ.log","C:\\"),1)
So now I want to make it return a value or false. Sorry my previous post had a typo, missing an array_element.
This does put the value of fiq.log on the label or false, delete fiq.log from the disk to test.
getfiq
if(array_element(execute("GetLog.bat","","C:\\"),1), array_element(execute("GetLog.bat","","C:\\"),1), "False")
Now the probe is simple since we are sure we are getting a value or false.
Probe: fique
available: getfiq()<>"False"
error: if(getfiq()<>"False",if(getfiq() < 285, "", concatenate("Warning: Fax server at Capacity = ", getfiq())), "Failed read Fax Capacity")
value: getfiq()
See in the graphic below the device label is updated, the probe is going to fail and send an error and if you delete the log file you will see the failed message.
fique - Probe_2014-10-22_09-16-20.png
Note If the value in fiq.log is 0 the error line of the probe will trigger. To fix this you could modify the function to add 1 to the value then just test for 1 less in the error... This is not tested...
code: if(array_element(execute("GetLog.bat","","C:\\"),1)+1, array_element(execute("GetLog.bat","","C:\\"),1)+1, "False")
error: if(getfiq()<>"False",if(getfiq() < 284, "", concatenate("Warning: Fax server at Capacity = ", getfiq())), "Failed read Fax Capacity")
There ya go
lebowski
You do not have the required permissions to view the files attached to this post.