lib/riemann/babbler/support/plugin_helpers.rb in riemann-babbler-1.0.8.8 vs lib/riemann/babbler/support/plugin_helpers.rb in riemann-babbler-1.1.0pre2

- old
+ new

@@ -41,29 +41,10 @@ # статус 0, вывода stdout нет '' end end - def file_grep(filename, regexp, max_lines=100) - readed_lines = 0 - lines = Array.new - begin - Timeout::timeout(plugin_timeout) do - File::Tail::Logfile.open(file, :backward => 0) do |log| - log.tail do |line| - readed_lines += 1 - lines << line if line.match?(regexp) - return lines if readed_lines >= max_lines - end - end - end - rescue => e - helper_error("#{e.class} #{e}\n#{e.backtrace.join "\n"}") - end - return lines - end - def tcp_port_aviable?(ip, port) begin Timeout::timeout(plugin_timeout) do begin s = TCPSocket.new(ip, port) @@ -72,12 +53,11 @@ rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH return false end end rescue Timeout::Error - return false end - false + return false end # http rest def rest_get(url) begin