Class: AlertDesigner::Formatters::Nagios::NagiosDefinition
- Inherits:
-
OpenStruct
- Object
- OpenStruct
- AlertDesigner::Formatters::Nagios::NagiosDefinition
- Defined in:
- lib/alertdesigner/formatters/nagios.rb
Overview
Generic Nagios definition class
Constant Summary collapse
- TEMPLATE =
<<-EOS.freeze define <%= type %>{ <% properties.each do |key, value| %> <%= key %> <%= value %> <% end %> } EOS
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.get_command(name, cmd) ⇒ Object
35 36 37 38 39 40 41 42 |
# File 'lib/alertdesigner/formatters/nagios.rb', line 35 def self.get_command(name, cmd) fmt_command = NagiosDefinition.new fmt_command.type = "command" fmt_command.properties = {} fmt_command.properties["command_name"] = name fmt_command.properties["command_line"] = cmd fmt_command end |
.get_service(check, check_template) ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/alertdesigner/formatters/nagios.rb', line 25 def self.get_service(check, check_template) fmt_check = NagiosDefinition.new fmt_check.type = "service" fmt_check.properties = check.attributes fmt_check.properties["use"] = check_template fmt_check.properties["service_description"] = check.description fmt_check.properties["check_command"] = check.command fmt_check end |
Instance Method Details
#render ⇒ Object
21 22 23 |
# File 'lib/alertdesigner/formatters/nagios.rb', line 21 def render ERB.new(TEMPLATE, 0, "<>").result(binding) end |