open-falcon监控实施

1.mysql

1.1准备环境打包

go env   #查看go的变量环境
mkdir -p $GOPATH/src/github.com/open-falcon
cd $GOPATH/src/github.com/open-falcon
git clone https://github.com/open-falcon/mymon.git
 
cd mymon
go get ./...
go build -o mymon

2.添加定时任务

#mysql monitoring
* * * * * cd /home/src/github.com/open-falcon/mymon && ./mymon -c etc/mon.cfg

3.环境配置详解

[default]
    log_file=mymon.log # 日志路径和文件名
    # Panic 0
    # Fatal 1
    # Error 2
    # Warn 3
    # Info 4
    # Debug 5
    log_level=4 # 日志级别
 
    falcon_client=http://127.0.0.1:1988/v1/push # falcon agent连接地址
 
    #自定义endpoint
    endpoint=127.0.0.1 #若不设置则使用OS的hostname
 
    [mysql]
    user=root # 数据库用户名
    password= # 数据库密码
    host=127.0.0.1 # 数据库连接地址
    port=3306 # 数据库端口

仅供参考,具体配置,根据自己环境修改

2.redis监控

2.1下载源码添加hosts

git clone https://github.com/ZhuoRoger/redismon.git
vim /etc/hosts
127.0.0.1 redis

2.2 修改配置文件

[root@web02 /home/src/github.com/redismon/conf]# vim redismon.conf 
items:
- {cluster_name: redis, password: '', port: 6379}
#- {cluster_name: Redis_Cluster_Slave_82, password: '', port: 7379
修改redis_monitor.py
[root@web02 /home/src/github.com/redismon/bin]# vim redis_monitor.py
redis_falcon_monitor = RedisFalconMonitor(redis_clusterName, redis_port,redis_password,redis_clusterName)  
redis_clusterName既是endpoint 
加入定时任务
#redis montions
*/1 * * * * python /home/src/github.com/redismon/bin/redis_monitor.py

2.3 可能的报错及解决方法

import yaml ImportError: No module named yaml

解决:yum  install python-yaml



  File "/home/src/github.com/redismon/bin/redis_monitor.py", line 8, in <module>

  import requests

  ImportError: No module named requests    #缺少requests,直接安装即可

解决: yum install python-requests -y



File "redis_monitor.py", line 9, in <module>
 import redis
ImportError: No module named redis

解决: yum install -y  python-redis

3.mongodb监控

3.1 准备环境下载源码

mkdir -p $GOPATH/src/github.com/open-falcon
cd $GOPATH/src/github.com/open-falcon

git clone https://github.com/ZhuoRoger/mongomon.git

3.2 修改配置

cd mongomon/conf

[root@lb02 /home/src/github.com/open-falcon/mongomon/conf]# cat mongomon.conf 
items:

-  {port: 234567 , user: "flah",password: user: "123456"}

3.3 启动

cd $GOPATH/src/github.com/open-falcon/mongomon/bin/  &&  python  mongodb_monitor.py

4. LVS监控

4.1环境准备

rpm -qa |grep libnl3.x86_64

yum install -y libnl3.x86_64  #环境需要

mkdir -p $GOPATH/src/github.com/open-falcon/
cd $GOPATH/src/github.com/open-falcon/

git clone https://github.com/mesos-utility/lvs-metrics.git

cd $GOPATH/src/github.com/open-falcon/lvs-metrics
make bin

猜你喜欢

转载自blog.csdn.net/wanchaopeng/article/details/80824685
今日推荐