Module: Roma::CommandPlugin::PluginGui
- Includes:
- Roma::CommandPlugin
- Defined in:
- lib/roma/plugin/plugin_gui.rb
Instance Method Summary collapse
-
#ev_gather_logs(s) ⇒ Object
gather_logs [start_date(YYYY-MM-DDThh:mm:ss)] <end_date(YYYY-MM-DDThh:mm:ss)>.
-
#ev_get_routing_history(s) ⇒ Object
get_routing_history.
-
#ev_show_logs(s) ⇒ Object
show_logs.
Methods included from Roma::CommandPlugin
Instance Method Details
#ev_gather_logs(s) ⇒ Object
gather_logs [start_date(YYYY-MM-DDThh:mm:ss)] <end_date(YYYY-MM-DDThh:mm:ss)>
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/roma/plugin/plugin_gui.rb', line 24 def ev_gather_logs(s) if s.length < 2 || s.length > 3 return send_data("CLIENT_ERROR number of arguments (#{s.length-1} for 2-3)\r\n") end start_date = s[1] end_date = s[2] end_date ||= 'current' if @stats.gui_run_gather_logs return send_data("CLIENT_ERROR gathering process is already going\r\n") end begin @stats.gui_run_gather_logs = true Roma::AsyncProcess::queue.push(Roma::AsyncMessage.new('start_get_logs', [start_date, end_date])) send_data("STARTED\r\n") rescue @stats.gui_run_gather_logs = false @rttable.logs = [] send_data("CLIENT_ERROR\r\n") end end |
#ev_get_routing_history(s) ⇒ Object
get_routing_history
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/roma/plugin/plugin_gui.rb', line 10 def ev_get_routing_history(s) routing_path = get_config_stat["config.RTTABLE_PATH"] contents = "" Dir.glob("#{routing_path}/*").each{|fname| contents << File.read(fname) if !FileTest::directory?(fname) && fname =~ /#{@stats.ap_str}\.route*/ } routing_list = contents.scan(/[-\.a-zA-Z\d]+_[\d]+/).uniq.sort routing_list.each{|routing| send_data("#{routing}\r\n") } send_data("END\r\n") end |
#ev_show_logs(s) ⇒ Object
show_logs
50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/roma/plugin/plugin_gui.rb', line 50 def ev_show_logs(s) if @stats.gui_run_gather_logs send_data("Not finished gathering\r\n") else @rttable.logs.each_with_index{|log, index| send_data("#{log}\r\n") sleep @stats.stream_show_wait_param if index % 10 == 0 } send_data("END\r\n") @rttable.logs.clear end end |