Class: CustomPlugin
- Inherits:
-
Object
- Object
- CustomPlugin
- Defined in:
- lib/monitor/custom_plugin.rb
Class Method Summary collapse
Instance Method Summary collapse
- #get_event_description ⇒ Object
- #get_event_state ⇒ Object
- #get_event_state_raw ⇒ Object
- #get_node ⇒ Object
-
#initialize(node = nil) ⇒ CustomPlugin
constructor
A new instance of CustomPlugin.
-
#set_state(state, description = nil) ⇒ Object
state is one of “CRITICAL”, “MAJOR”, “MINOR”,“WARNING”, “NORMAL”, “UNMANAGED”, “UNKNOWN”.
Constructor Details
#initialize(node = nil) ⇒ CustomPlugin
Returns a new instance of CustomPlugin.
3 4 5 6 7 8 9 |
# File 'lib/monitor/custom_plugin.rb', line 3 def initialize(node=nil) #index in $status @event_state=nil @event_description=nil @node=node monitor() end |
Class Method Details
.show_description ⇒ Object
42 43 44 45 46 47 48 49 |
# File 'lib/monitor/custom_plugin.rb', line 42 def CustomPlugin::show_description() dialog = Gtk::MessageDialog.new($win, Gtk::Dialog::MODAL, Gtk::MessageDialog::INFO, Gtk::MessageDialog::BUTTONS_OK, description()) dialog.signal_connect('response') { dialog.destroy } dialog.show end |
Instance Method Details
#get_event_description ⇒ Object
23 24 25 |
# File 'lib/monitor/custom_plugin.rb', line 23 def get_event_description() return @event_description end |
#get_event_state ⇒ Object
15 16 17 |
# File 'lib/monitor/custom_plugin.rb', line 15 def get_event_state() return $status[@event_state] end |
#get_event_state_raw ⇒ Object
19 20 21 |
# File 'lib/monitor/custom_plugin.rb', line 19 def get_event_state_raw() return @event_state end |
#get_node ⇒ Object
11 12 13 |
# File 'lib/monitor/custom_plugin.rb', line 11 def get_node() return @node end |
#set_state(state, description = nil) ⇒ Object
state is one of “CRITICAL”, “MAJOR”, “MINOR”,“WARNING”, “NORMAL”, “UNMANAGED”, “UNKNOWN”
31 32 33 34 35 36 37 38 39 40 |
# File 'lib/monitor/custom_plugin.rb', line 31 def set_state(state, description=nil) @event_state=$status.index(state) if @event_state == nil #init @event_state to UNKNOWN @event_state=$status.size()-1 end if description != nil @event_description=description end end |