monit-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Test output of a script


From: Andrew Holt
Subject: Test output of a script
Date: Tue, 18 Sep 2012 10:10:03 +0100

Hi,

I’m sure this has been asked before, but I can’t find an answer :)

I have a script that reads a temperature sensor and outputs the result to stdout.

I want to test the result and take an action if the the reading is above or below a threshold

I currently set the exits status as a workaround, but I’m looking for a more general solution I have:

check program testscript with path "/root/Scripts/tst.sh" with timeout 100 seconds
    if status < 0 then alert
    if status > 22 then exec '/usr/local/bin/hot.sh'
    if status < 17 then exec '/usr/local/bin/cold.sh'


It would be more useful if I could do something like:

check program testscript with path "/root/Scripts/tst.sh" with timeout 100 seconds
    if atoi(stdout) < 0 then alert
    if stdout) > 22 then exec '/usr/local/bin/hot.sh'
    if stdout < 17 then exec '/usr/local/bin/cold.sh'

Of course you may have a better way . . . . 


=============================
Andrew Holt


De Omnibus Dubitandum
=============================




reply via email to

[Prev in Thread] Current Thread [Next in Thread]