class LogMonitor::WebPostAlerter
Public Instance Methods
alert()
click to toggle source
# File lib/log_monitor/alerter.rb, line 140 def alert begin Net::HTTP.post_form(URI.parse(@url), { checker: 'logmonitor-webpost-log', body: "#{ @alert_body }"}) rescue => e $stderr.puts "LogMonitor error" $stderr.puts e.message 2.times $stderr.puts end clear_alert end
check_words()
click to toggle source
# File lib/log_monitor/alerter.rb, line 151 def check_words is_alert = false @words.each do | word | if @alert_body.match(/#{word}/) && !@alert_body.include?('logmonitor-webpost-log') is_alert = true break end end if is_alert alert end clear_alert end
set_webpost(config)
click to toggle source
# File lib/log_monitor/alerter.rb, line 136 def set_webpost(config) @url = config end