Sha256: 9d60276d7e4e25b6aa921f9796171cabca3092e32192255bd106b16719f76c3e
Contents?: true
Size: 601 Bytes
Versions: 4
Compression:
Stored size: 601 Bytes
Contents
require "socket" module ExceptionHandling module Sensu LEVELS = { warning: 1, critical: 2 } class << self def generate_event(name, message, level = :warning) status = LEVELS[level] or raise "Invalid alert level #{level}" event = {name: ExceptionHandling.sensu_prefix.to_s + name, output: message, status: status} send_event(event) end def send_event(event) Socket.tcp(ExceptionHandling.sensu_host, ExceptionHandling.sensu_port) do |sock| sock.send(event.to_json, 0) end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems