monit-general
[Top][All Lists]
Advanced

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

Re: Test output of a script


From: Andrew Holt
Subject: Re: Test output of a script
Date: Fri, 21 Sep 2012 13:24:43 +0100


Can anybody help with this one ?


On 18 Sep 2012, at 10:10, Andrew Holt wrote:

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
=============================



--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general

=============================

Andrew Holt
email: address@hidden

Those who will not reason, are bigots, those who cannot, are fools, and those who dare not, are slaves.

George Gordon, Lord Byron


=============================





reply via email to

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