可视化日志--glTail.rb

可视化日志--glTail.rb

Real-time visualization of server traffic, events and statistics with Ruby, SSH and OpenGL

FEATURES

  • Real-Time
  • 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, chipmunk & ruby-opengl
  • Free! (GPLv2)

环境:CentOS6.5/7.0 x64

ruby版本过低在安装net-ssh和opengl时会报错,
ERROR:  Error installing net-ssh:
        net-ssh requires Ruby version >= 2.0.
ERROR:  Error installing opengl:
        opengl requires Ruby version >= 1.9.2.
一.升级ruby
yum -y remove ruby
yum -y install gcc gcc-c++
tar -xvf ruby-2.2.3.tar.gz -C /usr/local/src
cd /usr/local/src/ruby-2.2.3
./configure && make -j4 && make install
ln -s /usr/local/bin/ruby /usr/bin/
ln -s /usr/local/bin/gem /usr/bin/
root@server3:ruby-2.2.3#ruby  -v
ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-linux]
root@server3:ruby-2.2.3#gem -v
2.4.5.1
提示:单独升级gem
cd rubygems
ruby setup.rb

二.更新ruby源
gem sources --add https://ruby.taobao.org/ --remove https://rubygems.org/

三.安装glTail.rb
yum -y install freeglut-devel gtkglext-devel (centos6)
gem install opengl glu glut net-ssh net-ssh-gateway  chipmunk file-tail ruby-opengl tail
git clone
https://github.com/Fudge/gltail.git

四.配置
1.创建gateway软链接
ln -s /usr/local/lib/ruby/gems/2.2.0/gems/net-ssh-gateway-1.2.0/lib/net/sshgateway.rb /usr/local/lib/ruby/gems/2.2.0/gems/net-ssh-3.0.1/lib/net/ssh
注意:net-ssh-gateway己装后仍然出现如下错误时,请做相应的链接
可视化日志--glTail.rb

2.注销KILL trap行
vim ./bin/gl_tail +102
 #trap("KILL") { exit }
注意: 不注该行会报不能trap SIGKILL的错误
可视化日志--glTail.rb

3.修改配置文件
cp config.yaml{,.bak}
vim config.yaml
    host: server3.example.com
        user: root
        password: root
        command: tail -f -n0
        files: /var/log/nginx/access_log
通常需要指定上面几行认证信息即可
如果想通过密钥认证,请修改如下两行  
    password: secret
    keys: /root/.ssh/id_rsa
提示:比如颜色定义或是否跳跃等,请自行修改config.yaml(auto_clean: true ,etc)

五.快捷键及使用
用法:./bin/gl_tail config.yaml

f #切换每秒显示的帧
b #改变默认的blog类型
空格  #切换跳跃
shift +f #全屏
You can also press 'f' while running to toggle the attempted frames per second. Or 'b' to change default blob type, and space to toggle bouncing.
To enable fullscreen mode, press shift + f, or set fullscreen: true in the config section of your config.yaml.

可视化日志--glTail.rb

可视化日志--glTail.rb

可视化日志--glTail.rb

可视化日志--glTail.rb
可视化日志--glTail.rb

可视化日志--glTail.rb

可视化日志--glTail.rb

posted @ 2015-10-15 21:01  李庆喜  阅读(260)  评论(0编辑  收藏  举报