kostya / eye

Process monitoring tool. Inspired from Bluepill and God.
MIT License
1.19k stars 89 forks source link

How to send restart signal if my check is true? #218

Closed abigoroth closed 6 years ago

abigoroth commented 6 years ago

hi.. I have check as below

class MyCheck < Eye::Checker::Custom

  def get_value
    tmp = eval(`cat /home/system/dnsvault/ws_ping.txt`)
    last_ping = tmp["message"]
    puts ((Time.now - Time.at(last_ping)) > 60)
    (Time.now - Time.at(last_ping)) > 60
  end

  def good?(value)
    value !~ /haha/
  end

end

and in my config like this

check :my_check, every: 10.seconds

how can I send restart signal if my check is true?

kostya commented 6 years ago

all checks by default send :restart, when good? method returns false, you can change it by:

check :my_check, every: 10.seconds, :fires => :stop

you good? method seems bad, it should check value from get_value function.

abigoroth commented 6 years ago

thanks kostya <3 . tons of love from Malaysia.