java 监控 vsphere_使用open-falcon监控vSphere

转  http://blog.51cto.com/wangzhijian/2094165

一、环境准备

yum -y install redis mariadb-server

# yum install-y python-virtualenv python-devel mariadb-devel openldap-devel

# yum groupinstall"Development tools"# systemctl start redis

# systemctl status redis

# systemctl start mariadb

# systemctl status mariadb

二、初始化MySQL表结构

git clone https://github.com/open-falcon/scripts.git

# cd falcon-plus/scripts/mysql/db_schema/

# mysql -h 127.0.0.1 -u root -p < 1_uic-db-schema.sql

# mysql -h 127.0.0.1 -u root -p < 2_portal-db-schema.sql

# mysql -h 127.0.0.1 -u root -p < 3_dashboard-db-schema.sql

# mysql -h 127.0.0.1 -u root -p < 4_graph-db-schema.sql

# mysql -h 127.0.0.1 -u root -p < 5_alarms-db-schema.sql

三、创建工作目录并下载解压文件

wget https://codeload.github.com/open-falcon/falcon-plus/tar.gz/v0.2.1 -O open-falcon-v0.2.1.tar.gz

# export FALCON_HOME=/etc

# export WORKSPACE=$FALCON_HOME/open-falcon

# mkdir -p $WORKSPACE

# tar -zxvf open-falcon-v0.2.1.tar.gz -C $WORKSPACE

四、启动open-falcon

# cd /etc/open-falcon

# ./open-falcon start ##启动open-falcon

# ./open-falcon check ##检查所有模块的启动状况

falcon-graph UP 2920falcon-hbs UP 2929falcon-judge UP 2938falcon-transfer UP 2946falcon-nodata UP 2951falcon-aggregator UP 2959falcon-agent UP 2965falcon-gateway UP 2972falcon-api UP 2980falcon-alarm UP 2986

五、安装并启用dashboard

# cd /etc/open-falcon

# git clone https://github.com/open-falcon/dashboard.git

# yum -y install python-pip python-wheel

# pip install--upgrade pip

# pip install-r pip_requirements.txt -i https://pypi.douban.com/simple

# cd dashboard

# ./control start

# ./control status

falcon-dashboard now is running, pid=3040

注1:dashboard的配置文件为:"rrd/config.py",请根据实际情况修改。

注2:dashbord没有默认创建任何账号包括管理账号,需要自行通过页面注册账号。想拥有管理全局的超级管理员账号,需手动注册用户名为root的账号。

六、安装vsphere-monitor

# git clone https://github.com/freedomkk-qfeng/vsphere-monitor.git

# yum install -y python-virtualenv

# cd vsphere-monitor

# virtualenv ./env

# ./env/bin/pip install -r requirement.txt

七、配置并运行vsphere-monitor

# vim config.py

#coding=utf-8# falcon

endpoint= "vcenter" # 上报给 open-falcon 的 endpoint

push_api= "http://127.0.0.1:6060/api/push"# 上报的 http api 接口

interval= 60# 上报的 step 间隔

# vcenter

host= "192.168.100.111"# vcenter 的地址

user= "administrator@zhi.local"# vcenter 的用户名

pwd= "abcdef"# vcenter 的密码

port= 443# vcenter 的端口

# esxi

esxi_names=[] # 需要采集的 esxi ,留空则全部采集

# datastore

datastore_names=[] # 需要采集的 datastore ,留空则全部采集

# vm

vm_enable=True # 是否要采集虚拟机信息

vm_names=[] # 需要采集的虚拟机,留空则全部采集

# env/bin/python /root/vsphere-monitor/vsphere-monitor.py ##运行vsphere-monitor

# crontab-e ##添加定时任务

# crontab-l ##列出定时任务0-59/1 * * * * /root/vsphere-monitor/env/bin/python /root/vsphere-monitor/vsphere-monitor.py

八、监控图如下

39e1b1c7d551493047a4c7974c601ef4.png

bbf6f1c6235a1147e15fd6a9bd38f821.png

524c071674675a9d86e7e95eb7e61db3.png

3356ee28e5a3cbeec543f2f9ea0488e3.png

f9d91956430f134fdd65043d529be8fe.png

c84b56b5562961c549f97a601eebef5f.png

50e3022d9da0824c260e6d4f7e3f087b.png

6b601e0e3689cc4dca2a0cffa9394ad8.png

e25a2a5199964369fc07d282555ee76f.png

a3d08af6a6b186c1caf93e8bb64381c4.png

65f6ca513d101ed98da2f94c3906ba64.png

5a7a582e1ef6cb7007c8a6f87424239d.png

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值