gltail 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +66 -0
- data/Manifest.txt +40 -0
- data/README +51 -0
- data/README.txt +376 -0
- data/Rakefile +19 -0
- data/TODO +9 -0
- data/bin/gl_tail +109 -0
- data/dist/config.yaml +101 -0
- data/lib/gl_tail.rb +68 -0
- data/lib/gl_tail/activity.rb +145 -0
- data/lib/gl_tail/blob_store.rb +43 -0
- data/lib/gl_tail/block.rb +130 -0
- data/lib/gl_tail/config.rb +187 -0
- data/lib/gl_tail/config/configurable.rb +51 -0
- data/lib/gl_tail/config/yaml_parser.rb +94 -0
- data/lib/gl_tail/element.rb +194 -0
- data/lib/gl_tail/engine.rb +266 -0
- data/lib/gl_tail/font.bin +0 -0
- data/lib/gl_tail/font_store.rb +165 -0
- data/lib/gl_tail/http_helper.rb +58 -0
- data/lib/gl_tail/item.rb +17 -0
- data/lib/gl_tail/parser.rb +46 -0
- data/lib/gl_tail/parsers/apache.rb +56 -0
- data/lib/gl_tail/parsers/iis.rb +47 -0
- data/lib/gl_tail/parsers/mysql.rb +29 -0
- data/lib/gl_tail/parsers/nginx.rb +46 -0
- data/lib/gl_tail/parsers/pix-fwsm.rb +50 -0
- data/lib/gl_tail/parsers/postfix.rb +119 -0
- data/lib/gl_tail/parsers/postgresql.rb +42 -0
- data/lib/gl_tail/parsers/pureftpd.rb +30 -0
- data/lib/gl_tail/parsers/qmail.rb +30 -0
- data/lib/gl_tail/parsers/rails.rb +41 -0
- data/lib/gl_tail/parsers/squid.rb +25 -0
- data/lib/gl_tail/parsers/tshark.rb +25 -0
- data/lib/gl_tail/resolver.rb +69 -0
- data/lib/gl_tail/server.rb +46 -0
- data/lib/gl_tail/sources/base.rb +44 -0
- data/lib/gl_tail/sources/local.rb +12 -0
- data/lib/gl_tail/sources/ssh.rb +112 -0
- data/test/test_gl_tail.rb +0 -0
- metadata +114 -0
@@ -0,0 +1,44 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
module GlTail
|
4
|
+
module Source
|
5
|
+
|
6
|
+
class Base
|
7
|
+
include GlTail::Configurable
|
8
|
+
|
9
|
+
attr_accessor :name
|
10
|
+
|
11
|
+
def initialize(config)
|
12
|
+
@config = config
|
13
|
+
end
|
14
|
+
|
15
|
+
attr_reader :parser, :config
|
16
|
+
|
17
|
+
config_attribute :color, 'FIXME', :type => :color
|
18
|
+
|
19
|
+
def parser=(name)
|
20
|
+
if klass = Parser.registry[name.to_sym]
|
21
|
+
@parser = klass.new(self)
|
22
|
+
else
|
23
|
+
raise "Couldnt find a Parser by name: #{name}, try --parsers for a list of available parsers"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def process
|
28
|
+
raise "#{self.class.to_s} does not implement .process"
|
29
|
+
end
|
30
|
+
|
31
|
+
def update
|
32
|
+
raise "#{self.class.to_s} does not implement .update"
|
33
|
+
end
|
34
|
+
|
35
|
+
def add_activity( opts = {} )
|
36
|
+
@config.add_activity( self, opts )
|
37
|
+
end
|
38
|
+
|
39
|
+
def add_event( opts = {} )
|
40
|
+
@config.add_event( self, opts )
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
|
2
|
+
module GlTail
|
3
|
+
module Source
|
4
|
+
|
5
|
+
class Local < Base
|
6
|
+
config_attribute :command, "The Command to run"
|
7
|
+
config_attribute :files, "The files to tail", :deprecated => "Should be embedded in the :command"
|
8
|
+
|
9
|
+
# TODO: code to run comand locally and parse streams
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,112 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
module GlTail
|
4
|
+
module Source
|
5
|
+
|
6
|
+
class SSH < Base
|
7
|
+
config_attribute :command, "The Command to run"
|
8
|
+
config_attribute :files, "The files to tail", :deprecated => "Should be embedded in the :command"
|
9
|
+
config_attribute :host, "The Host to connect to"
|
10
|
+
config_attribute :command, "The Command to run"
|
11
|
+
config_attribute :user, "Username"
|
12
|
+
config_attribute :port, "Port"
|
13
|
+
config_attribute :keys, "Path to the ssh private key to use"
|
14
|
+
config_attribute :password, "Password"
|
15
|
+
|
16
|
+
def init
|
17
|
+
|
18
|
+
@channels = []
|
19
|
+
|
20
|
+
puts "Connecting to #{host}..." if($VRB > 0 || $DBG > 0)
|
21
|
+
|
22
|
+
session_options = { }
|
23
|
+
session_options[:port] = port if port
|
24
|
+
session_options[:keys] = keys if keys
|
25
|
+
session_options[:verbose] = :debug if $DBG > 1
|
26
|
+
|
27
|
+
begin
|
28
|
+
if password
|
29
|
+
session_options[:auth_methods] = [ "password","keyboard-interactive" ]
|
30
|
+
|
31
|
+
@session = Net::SSH.start(host, user, password, session_options)
|
32
|
+
else
|
33
|
+
@session = Net::SSH.start(host, user, session_options)
|
34
|
+
end
|
35
|
+
rescue SocketError => e
|
36
|
+
puts "!!! Could not connect to #{host}. Check to make sure that this is the correct url."
|
37
|
+
puts $! if $DBG > 0
|
38
|
+
exit
|
39
|
+
rescue Net::SSH::AuthenticationFailed => e
|
40
|
+
puts "!!! Could not authenticate on #{host}. Make sure you have set the username and password correctly. Or if you are using SSH keys make sure you have not set a password."
|
41
|
+
puts $! if $DBG > 0
|
42
|
+
exit
|
43
|
+
end
|
44
|
+
|
45
|
+
# FIXME: add support for multiple files (eg. write files accessor)
|
46
|
+
do_tail(files, command)
|
47
|
+
|
48
|
+
@session.connection.process
|
49
|
+
end
|
50
|
+
|
51
|
+
def process
|
52
|
+
@session.connection.process(true)
|
53
|
+
end
|
54
|
+
|
55
|
+
def update
|
56
|
+
@channels.each { |ch| ch.connection.ping! }
|
57
|
+
end
|
58
|
+
|
59
|
+
def parse_line(data)
|
60
|
+
@buffer.gsub(/\r\n/,"\n").gsub(/\n/, "\n\n").each("") do |line|
|
61
|
+
|
62
|
+
unless line.include? "\n\n"
|
63
|
+
@buffer = "#{line}"
|
64
|
+
next
|
65
|
+
end
|
66
|
+
|
67
|
+
line.gsub!(/\n\n/, "\n")
|
68
|
+
line.gsub!(/\n\n/, "\n")
|
69
|
+
|
70
|
+
puts "#{host}[#{user}]: #{line}" if $DBG > 0
|
71
|
+
|
72
|
+
parser.parse(line)
|
73
|
+
end
|
74
|
+
|
75
|
+
@buffer = "" if @buffer.include? "\n"
|
76
|
+
end
|
77
|
+
|
78
|
+
def do_tail( file, command )
|
79
|
+
@session.open_channel do |channel|
|
80
|
+
puts "Channel opened on #{@session.host}...\n" if($VRB > 0 || $DBG > 0)
|
81
|
+
|
82
|
+
@buffer = ""
|
83
|
+
channel.request_pty :want_reply => true
|
84
|
+
|
85
|
+
channel.on_data do |ch, data|
|
86
|
+
@buffer << data
|
87
|
+
parse_line(data)
|
88
|
+
end
|
89
|
+
|
90
|
+
channel.on_success do |ch|
|
91
|
+
channel.exec "#{command} #{file} "
|
92
|
+
end
|
93
|
+
|
94
|
+
channel.on_failure do |ch|
|
95
|
+
ch.close
|
96
|
+
end
|
97
|
+
|
98
|
+
channel.on_extended_data do |ch, data|
|
99
|
+
puts "STDERR: #{data}\n"
|
100
|
+
end
|
101
|
+
|
102
|
+
channel.on_close do |ch|
|
103
|
+
ch[:closed] = true
|
104
|
+
end
|
105
|
+
|
106
|
+
puts "Pushing #{host}\n" if($VRB > 0 || $DBG > 0)
|
107
|
+
@channels.push(channel)
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
File without changes
|
metadata
ADDED
@@ -0,0 +1,114 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
rubygems_version: 0.9.4
|
3
|
+
specification_version: 1
|
4
|
+
name: gltail
|
5
|
+
version: !ruby/object:Gem::Version
|
6
|
+
version: 0.0.7
|
7
|
+
date: 2007-10-27 00:00:00 +02:00
|
8
|
+
summary: View real-time data and statistics from any logfile on any server with SSH, in an intuitive and entertaining way.
|
9
|
+
require_paths:
|
10
|
+
- lib
|
11
|
+
email: mr@fudgie.org
|
12
|
+
homepage: " by Erlend Simonsen <mr@fudgie.org>"
|
13
|
+
rubyforge_project: gltail
|
14
|
+
description: "== FEATURES: * Real-Time OpenGL view * Multiple logfiles on multiple servers * Configurable layout * Multiple logfile parsers (Apache Combined, Rails, IIS, Postfix/spamd/clamd, Nginx, Squid, PostgreSQL, PureFTPD, MySQL, TShark, qmail/vmpop3d) * Custom events * Show rate, total or average * If you can 'tail' it, you can visualize it * Written in Ruby using net-ssh & libopengl-ruby * Free! == RUNNING: gl_tail --help gl_tail --new gl_tail.yaml gl_tail You can press 'f' while running to toggle the attempted frames per second. Or 'b' to change default blob type, and space to toggle bouncing. == REQUIREMENTS: * rubygems 0.9.4 * ruby-opengl 0.40.1 * net-ssh 1.1.2 * opengl/ruby development packages (ruby1.8-dev libgl1-mesa-dev libglu1-mesa-dev libglut3-dev)"
|
15
|
+
autorequire:
|
16
|
+
default_executable:
|
17
|
+
bindir: bin
|
18
|
+
has_rdoc: true
|
19
|
+
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">"
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 0.0.0
|
24
|
+
version:
|
25
|
+
platform: ruby
|
26
|
+
signing_key:
|
27
|
+
cert_chain:
|
28
|
+
post_install_message:
|
29
|
+
authors:
|
30
|
+
- Erlend Simonsen
|
31
|
+
files:
|
32
|
+
- History.txt
|
33
|
+
- Manifest.txt
|
34
|
+
- README
|
35
|
+
- README.txt
|
36
|
+
- Rakefile
|
37
|
+
- TODO
|
38
|
+
- bin/gl_tail
|
39
|
+
- dist/config.yaml
|
40
|
+
- lib/gl_tail.rb
|
41
|
+
- lib/gl_tail/activity.rb
|
42
|
+
- lib/gl_tail/blob_store.rb
|
43
|
+
- lib/gl_tail/block.rb
|
44
|
+
- lib/gl_tail/config.rb
|
45
|
+
- lib/gl_tail/config/configurable.rb
|
46
|
+
- lib/gl_tail/config/yaml_parser.rb
|
47
|
+
- lib/gl_tail/element.rb
|
48
|
+
- lib/gl_tail/engine.rb
|
49
|
+
- lib/gl_tail/font.bin
|
50
|
+
- lib/gl_tail/font_store.rb
|
51
|
+
- lib/gl_tail/http_helper.rb
|
52
|
+
- lib/gl_tail/item.rb
|
53
|
+
- lib/gl_tail/parser.rb
|
54
|
+
- lib/gl_tail/parsers/apache.rb
|
55
|
+
- lib/gl_tail/parsers/iis.rb
|
56
|
+
- lib/gl_tail/parsers/mysql.rb
|
57
|
+
- lib/gl_tail/parsers/nginx.rb
|
58
|
+
- lib/gl_tail/parsers/pix-fwsm.rb
|
59
|
+
- lib/gl_tail/parsers/postfix.rb
|
60
|
+
- lib/gl_tail/parsers/postgresql.rb
|
61
|
+
- lib/gl_tail/parsers/pureftpd.rb
|
62
|
+
- lib/gl_tail/parsers/qmail.rb
|
63
|
+
- lib/gl_tail/parsers/rails.rb
|
64
|
+
- lib/gl_tail/parsers/squid.rb
|
65
|
+
- lib/gl_tail/parsers/tshark.rb
|
66
|
+
- lib/gl_tail/resolver.rb
|
67
|
+
- lib/gl_tail/server.rb
|
68
|
+
- lib/gl_tail/sources/base.rb
|
69
|
+
- lib/gl_tail/sources/local.rb
|
70
|
+
- lib/gl_tail/sources/ssh.rb
|
71
|
+
- test/test_gl_tail.rb
|
72
|
+
test_files:
|
73
|
+
- test/test_gl_tail.rb
|
74
|
+
rdoc_options:
|
75
|
+
- --main
|
76
|
+
- README.txt
|
77
|
+
extra_rdoc_files:
|
78
|
+
- History.txt
|
79
|
+
- Manifest.txt
|
80
|
+
- README.txt
|
81
|
+
executables:
|
82
|
+
- gl_tail
|
83
|
+
extensions: []
|
84
|
+
|
85
|
+
requirements: []
|
86
|
+
|
87
|
+
dependencies:
|
88
|
+
- !ruby/object:Gem::Dependency
|
89
|
+
name: ruby-opengl
|
90
|
+
version_requirement:
|
91
|
+
version_requirements: !ruby/object:Gem::Version::Requirement
|
92
|
+
requirements:
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: 0.40.1
|
96
|
+
version:
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: net-ssh
|
99
|
+
version_requirement:
|
100
|
+
version_requirements: !ruby/object:Gem::Version::Requirement
|
101
|
+
requirements:
|
102
|
+
- - ">="
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: 1.1.2
|
105
|
+
version:
|
106
|
+
- !ruby/object:Gem::Dependency
|
107
|
+
name: hoe
|
108
|
+
version_requirement:
|
109
|
+
version_requirements: !ruby/object:Gem::Version::Requirement
|
110
|
+
requirements:
|
111
|
+
- - ">="
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
version: 1.3.0
|
114
|
+
version:
|