open-falcon监控主机、MySQL与Redis

主机安装agent

1、安装go环境
2、执行脚本
export GOPATH=/shell
mkdir -p $GOPATH/src/github.com/open-falcon
cd $GOPATH/src/github.com/open-falcon
git clone https://github.com/open-falcon/agent.git
cd agent
go get ./...
./control build
sed -i 's/127.0.0.1/192.168.1.201/g'  cfg.example.json   --替换为服务安装的IP地址
./control start

sudo salt '192.168.1.214' cp.get_file salt://tmp/agent.tar /shell/agent.tar
sudo salt '192.168.1.214' cp.get_file salt://tmp/golang-1.7.4-1.el6.x86_64.rpm /tmp/golang-1.7.4-1.el6.x86_64.rpm
sudo salt '192.168.1.214' cp.get_file salt://tmp/golang-bin-1.7.4-1.el6.x86_64.rpm /tmp/golang-bin-1.7.4-1.el6.x86_64.rpm
sudo salt '192.168.1.214' cp.get_file salt://tmp/golang-src-1.7.4-1.el6.noarch.rpm /tmp/golang-src-1.7.4-1.el6.noarch.rpm
sudo salt '192.168.1.214' cmd.run 'rpm -ivh /tmp/golang*'
sudo salt '192.168.1.214' cmd.run 'tar xvf /shell/agent.tar -C /shell/'
修改主机名
sudo salt '192.168.1.214' cmd.run '/shell/src/github.com/open-falcon/agent/control start'

open-falcon监控MySQL

1、数据库新建监控用户
GRANT REPLICATION CLIENT,PROCESS ON *.* TO mymon@'192.168.1.201';
2、执行脚本
export GOPATH=/shell
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
修改配置文件

echo '* * * * * cd $GOPATH/src/github.com/open-falcon/mymon && ./mymon -c etc/mon.cfg' > /etc/cron.d/mymon
open-falcon监控redis

https://github.com/ZhuoRoger/redismon
1、脚本默认主机名登陆并作为endpoints,所以需要/etc/hosts配置
/etc/hosts
192.168.1.81  Redis_Cluster_Slave_81
192.168.1.81  Redis_Cluster_Slave_82
2、可以修改脚本,几个脚本监控N个Redis实例
redismon.conf 
items:
- {cluster_name: Redis_Cluster_Slave_81, password: '', port: 6379}
- {cluster_name: Redis_Cluster_Slave_82, password: '', port: 7379}
修改redis_monitor.py
redis_falcon_monitor = RedisFalconMonitor(redis_clusterName, redis_port,redis_password,redis_clusterName)
redis_clusterName既是endpoint
3、加入到crontab
* * * * *  (cd /shell/redismon/bin/ && python redis_monitor.py > /dev/null)



你可能感兴趣的:(MySQL,系统,数据库监控)