Class: Opstat::Plugins::Webobjects
- Inherits:
-
Task
- Object
- Task
- Opstat::Plugins::Webobjects
- Defined in:
- lib/plugins/webobjects.rb
Instance Method Summary collapse
- #check_prerequisities ⇒ Object
- #default_config ⇒ Object
-
#initialize(name, queue, config) ⇒ Webobjects
constructor
A new instance of Webobjects.
- #parse ⇒ Object
Constructor Details
#initialize(name, queue, config) ⇒ Webobjects
Returns a new instance of Webobjects.
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/plugins/webobjects.rb', line 5 def initialize (name, queue, config) merged_config = default_config.merge(config) super(name, queue, merged_config) oplogger.debug "Plugin config #{merged_config}" @wo_monitor_password = merged_config['wo_monitor_password'] @wo_monitor_host = merged_config['wo_monitor_host'] @wo_monitor_url = merged_config['wo_monitor_url'] @wo_monitor_port = merged_config['wo_monitor_port'] self end |
Instance Method Details
#check_prerequisities ⇒ Object
36 37 38 |
# File 'lib/plugins/webobjects.rb', line 36 def check_prerequisities #NEEDED - curl end |
#default_config ⇒ Object
26 27 28 29 30 31 32 33 34 |
# File 'lib/plugins/webobjects.rb', line 26 def default_config { 'interval' => 60, 'wo_monitor_password' => "password", 'wo_monitor_host' => "127.0.0.1", 'wo_monitor_port' => "666", 'wo_monitor_url' => "/cgi-bin/WebObjects/JavaMonitor.woa/admin/info", } end |
#parse ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/plugins/webobjects.rb', line 16 def parse report = [] curl_cmd ||= '/usr/bin/curl \'http://' + @wo_monitor_host + ':' + @wo_monitor_port + @wo_monitor_url + '?pw=' + @wo_monitor_password + '&type=all\'' + ' 2>/dev/null' output_io = IO.popen(curl_cmd) report = output_io.readlines.join oplogger.debug report output_io.close return report end |