最近公司要部署监控,所以一直在研究小米的开源监控系统open-falcon。一切安装好后,启动open-falcon。open-falcon start
[falcon-graph] 373
[falcon-hbs] 388
[falcon-judge] 399
[falcon-transfer] 411
[falcon-nodata] 427
[falcon-aggregator] failed to start
出现了falcon-aggregator启动失败:然后进进入到aggregator查看日志:
cd /root/aggregator/logs/
cat aggregator.log
020/07/12 10:12:43 cfg.go:88: read config file: /root/aggregator/config/cfg.json successfully
2020/07/12 10:12:43 db.go:37: ping db fail: Error 1045: Access denied for user 'root'@'localhost' (using password: NO)
很明显是由于访问数据库失败,原因是密码不对,于是在其配置文件/root/aggregator/config/cfg.json添加了mysql的密码:
cat aggregator/config/cfg.json
"database": {
"addr": "root:Monitor@tcp(127.0.0.1:3306)/falcon_portal?loc=Local&parseTime=true",
"idle": 10,
"ids": [1, -1],
"interval": 55
}
备注:
部分模块依赖连接数据库,如果不修改配置文件,aggregator模块无法启动,graph、hbs、nodata、api、alarm模块开启不报错但是状态为开启失败。
1、vim /home/work/open-falcon/aggregator/config/cfg.json
“addr”: “root:@tcp(127.0.0.1:3306)/falcon_portal?loc=Local&parseTime=true”,
root:和@之间为mysql的root密码,若无则留空
2、vim /home/work/open-falcon/graph/config/cfg.json
“dsn”: “root:@tcp(127.0.0.1:3306)/graph?loc=Local&parseTime=true”,
root:和@之间为mysql的root密码,若无则留空
3、vim /home/work/open-falcon/hbs/config/cfg.json
“database”: “root:@tcp(127.0.0.1:3306)/falcon_portal?loc=Local&parseTime=true”,
root:和@之间为mysql的root密码,若无则留空
4、vim /home/work/open-falcon/nodata/config/cfg.json
“dsn”: “root:@tcp(127.0.0.1:3306)/falcon_portal?loc=Local&parseTime=true&wait_timeout=604800”,
root:和@之间为mysql的root密码,若无则留空
5、vim /home/work/open-falcon/api/config/cfg.json
“faclon_portal”: “root:@tcp(127.0.0.1:3306)/falcon_portal?charset=utf8&parseTime=True&loc=Local”,
“graph”: “root:@tcp(127.0.0.1:3306)/graph?charset=utf8&parseTime=True&loc=Local”,
“uic”: “root:@tcp(127.0.0.1:3306)/uic?charset=utf8&parseTime=True&loc=Local”,
“dashboard”: “root:@tcp(127.0.0.1:3306)/dashboard?charset=utf8&parseTime=True&loc=Local”,
“alarms”: “root:@tcp(127.0.0.1:3306)/alarms?charset=utf8&parseTime=True&loc=Local”,
root:和@之间为mysql的root密码,若无则留空
6、vim /home/work/open-falcon/alarm/config/cfg.json
“addr”: “root:@tcp(127.0.0.1:3306)/alarms?charset=utf8&loc=Asia%2FChongqing”,
root:和@之间为mysql的root密码,若无则留空