使用collectd与visage收集kvm虚拟机性能实时图形

软件功能:

通过collectd软件来监控收集kvm虚拟机的性能数据,包含cpu,memory、磁盘IO、网络流量等

通过visage软件将收集到的数据绘制图形。


安装:

系统环境:ubuntu12.04

collectd

首先、在collectd官网下载collectd包collectd-5.4.0

安装collectd依赖包

apt-get install bison flex autoconf pkg-config libtool libgcrypt11-dev librrd-dev
安装完毕后,到collectd-5.4.0文件夹下编译源代码并安装

./configure --prefix=/ --exec-prefix=/usr  --enable-cpu --enable-network --enable-libvirt --enable-logfile --enable-rrdtool  --enable-rrdcached
make&&make install

改动配置

mkdir /etc/collect
mv /etc/collectd.conf /etc/collect
vi /etc/collect/collectd.conf
在collectd.conf文件里改动内容

LoadPlugin syslog
LoadPlugin logfile

<Plugin logfile>
        LogLevel info
        File STDOUT
        Timestamp true
        PrintSeverity false
</Plugin>

<Plugin syslog>
        LogLevel info
</Plugin>

LoadPlugin cpu
LoadPlugin df
LoadPlugin disk
LoadPlugin interface
LoadPlugin irq
LoadPlugin libvirt
LoadPlugin load
LoadPlugin memory
LoadPlugin network
LoadPlugin processes
LoadPlugin rrdcached
LoadPlugin rrdtool
LoadPlugin users

<Plugin network>
#       # client setup:
        Server "192.168.0.12" "25826"          //客户端配置收集数据的服务端 IP +port
        Server "192.168.0.16" "25826" 
#       <Server "239.192.74.66" "25826">
#               SecurityLevel Encrypt
#               Username "user" 
#               Password "secret" 
#               Interface "eth0" 
#       </Server>
#       TimeToLive "128" 
#
#       # server setup:
        Listen "192.168.0.16" "25826"            //collectd作为收集服务端须要打开listen IP + port
#       <Listen "239.192.74.66" "25826">
</Plugin>

<Plugin libvirt>
        Connection "qemu:///system" 
        RefreshInterval 60
#       Domain "name" 
        BlockDevice "/:hdc/" 
#       InterfaceDevice "name:device" 
        IgnoreSelected true
        HostnameFormat uuid
        InterfaceFormat "address" 
</Plugin>

在安装文件夹下将collectd运行文件复制到/ect/init.d/文件夹下然后启动collectd

service collectd start


visage

安装visage依赖包

apt-get install -y build-essential librrd-ruby ruby ruby-dev rubygems
安装visage软件

apt-get install gem
gem install visage-app
启动visage

visage-app start
启动后訪问visage-app的web界面

http://visage-app-server:9292

错误解答:


启动visage-app报错:

root@PS-8:/# visage-app start
/var/lib/gems/1.8/gems/visage-app-2.1.0/lib/visage-app/types.rb:19:in `initialize': No such file or directory - /usr/share/collectd/types.db (Errno::ENOENT)
    from /var/lib/gems/1.8/gems/visage-app-2.1.0/lib/visage-app/types.rb:19:in `new'
    from /var/lib/gems/1.8/gems/visage-app-2.1.0/lib/visage-app/types.rb:19:in `build'
    from /var/lib/gems/1.8/gems/visage-app-2.1.0/lib/visage-app/types.rb:10:in `initialize'
    from /var/lib/gems/1.8/gems/visage-app-2.1.0/lib/visage-app.rb:34:in `new'
    from /var/lib/gems/1.8/gems/visage-app-2.1.0/lib/visage-app.rb:34
    from /var/lib/gems/1.8/gems/visage-app-2.1.0/lib/visage-app/config.rb:6:in `use'
    from /var/lib/gems/1.8/gems/visage-app-2.1.0/lib/visage-app.rb:31
    from /var/lib/gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:1273:in `configure'
    from /var/lib/gems/1.8/gems/visage-app-2.1.0/lib/visage-app.rb:30
    from /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
    from /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in `require'
    from /var/lib/gems/1.8/gems/visage-app-2.1.0/bin/visage-app:17
    from /usr/local/bin/visage-app:19:in `load'
    from /usr/local/bin/visage-app:19
ollectd编译安转types.rb默认在文件夹/share/collectd/文件夹下,将types.rb文件复制到/usr/share/collectd文件夹下,并将collectd.conf配置文件里设置參数:
TypesDB "/usr/share/collectd/types.db" 
然后再启动collectd和visage-app


visage-app收集不到数据

在visage-app界面上查看不到server?
visage-app启动默认是在文件夹/var/lib/collectd/rrd文件夹下去收集server,可是collectd编译安装数据默认在/var/lib/collectd/文件夹下。在collectd.conf配置文件里设置參数:
BaseDir     "/var/lib/collectd/rrd" 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值