Class: CustomPlugin

Inherits:
Object
  • Object
show all
Defined in:
lib/monitor/custom_plugin.rb

Class Method Summary collapse

Instance Method Summary collapse

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_descriptionObject



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_descriptionObject



23
24
25
# File 'lib/monitor/custom_plugin.rb', line 23

def get_event_description()
 return @event_description
end

#get_event_stateObject



15
16
17
# File 'lib/monitor/custom_plugin.rb', line 15

def get_event_state()
 return $status[@event_state]
end

#get_event_state_rawObject



19
20
21
# File 'lib/monitor/custom_plugin.rb', line 19

def get_event_state_raw()
 return @event_state
end

#get_nodeObject



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