Module: Icinga2::Converts
- Included in:
- Client
- Defined in:
- lib/icinga2/converts.rb
Class Method Summary collapse
- .formatService(name) ⇒ Object
- .stateToColor(state, is_host = false) ⇒ Object
- .stateToString(state, is_host = false) ⇒ Object
Class Method Details
.formatService(name) ⇒ Object
70 71 72 73 |
# File 'lib/icinga2/converts.rb', line 70 def self.formatService( name ) service_map = name.split('!', 2) service_map.join( ' - ' ) end |
.stateToColor(state, is_host = false) ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/icinga2/converts.rb', line 39 def self.stateToColor( state, is_host = false ) if( is_host == true ) state = case state when 0 'green' when 1 'red' else 'blue' end else state = case state when 0 'green' when 1 'yellow' when 2 'red' when 3 'purple' else 'blue' end end return state end |
.stateToString(state, is_host = false) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/icinga2/converts.rb', line 7 def self.stateToString( state, is_host = false ) if( is_host == true ) state = case state when 0 'Up' when 1 'Down' else 'Undefined' end else state = case state when 0 'OK' when 1 'Warning' when 2 'Critical' when 3 'Unknown' else 'Undefined' end end return state end |