Skip to content

Instantly share code, notes, and snippets.

@dmytro
Created December 12, 2012 08:00
Show Gist options
  • Save dmytro/4265948 to your computer and use it in GitHub Desktop.
Save dmytro/4265948 to your computer and use it in GitHub Desktop.
RAG Checks for Nagios
def rag
rag = -1
res = @connection.send(@key[:name]).send(@key[:function].to_sym)
thresholds = @key[:rag].reverse
thresholds.each_index do |idx|
val = thresholds[idx]
rag = idx if res.send(@key[:operator].to_sym, val)
end
{
:service_description => "#{@bucket}: #{@key[:name]}",
:host_name => hostname,
:plugin_output => res,
:return_code => rag
}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment