Top Level Namespace
Defined Under Namespace
Classes: String
Instance Method Summary collapse
Instance Method Details
#nice_status(status) ⇒ Object
101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/logstash/inputs/nagioscheck.rb', line 101 def nice_status(status) case status when 0 return "OK" when 1 return "WARNING" when 2 return "CRITICAL" when 3 return "UNKNOWN" else return "INVALID STATUS" end end |
#parse_performance(perf) ⇒ Object
117 118 119 120 121 122 123 124 125 126 127 128 |
# File 'lib/logstash/inputs/nagioscheck.rb', line 117 def parse_performance(perf) # As per https://github.com/nagios-plugins/nagios-plugin-perl/blob/master/lib/Nagios/Monitoring/Plugin/Performance.pm value = /[-+]?[\d\.,]+/ value_re = /#{value}(?:e#{value})?/ value_with_negative_infinity = /#{value_re}|~/ regex = /^'?([^'=]+)'?=(#{value_re})([\w%]*);?(#{value_with_negative_infinity}\:?#{value_re}?)?;?(#{value_with_negative_infinity}\:?#{value_re}?)?;?(#{value_re})?;?(#{value_re})?/o regex.match(perf) end |