Nightingale是一套衍生自Open-Falcon的互联网监控解决方案,融入了滴滴的最佳实践,由于改动太大,优化太多,产品上已经无法与Open-Falcon平滑兼容,故而单开一个项目。
本文主要讲述滴滴Nightingale通过源码编译安装,喜欢的小伙伴可以访问https://n9e.didiyun.com/docs/了解更多关于Nightingale的介绍。
1.关闭防火墙
[root@localhost ~]#systemctl stop firewalld
[root@localhost ~]#systemctl disable firewalld
[root@localhost ~]#systemctl status firewalld
2.安装golang //已安装可忽略,自行对应配置
[root@localhost ~]#wget https://studygolang.com/dl/golang/go1.12.7.linux-amd64.tar.gz
[root@localhost ~]#tar -zxvf go1.12.7.linux-amd64.tar.gz -C /usr/local/
[root@localhost ~]#vim /etc/profile //为GO设置全局环境变量,在最后添加一行
export PATH=$PATH:/usr/local/go/bin
[root@localhost ~]#source /etc/profile
[root@localhost ~]#go version
3.安装mysql //已安装可忽略,自行对应配置
[root@localhost ~]#yum install mariadb mariadb-server -y
[root@localhost ~]#systemctl start mariadb.service //启动mysql
[root@localhost ~]#systemctl enable mariadb.service //添加开机自启动
[root@localhost ~]#systemctl status mariadb.service //查看mysql状态
[root@localhost ~]#mysqladmin -uroot -p password 123456 //设置mysql密码为123456
4.安装redis //已安装可忽略,自行对应配置
[root@localhost ~]#yum install -y redis
[root@localhost ~]#systemctl enable redis //添加开机自启动
[root@localhost ~]#systemctl start redis //启动redis
[root@localhost ~]#systemctl status redis //查看redis状态
5.安装nginx //已安装可忽略,自行对应配置
[root@localhost ~]#yum install nginx -y
[root@localhost ~]#systemctl enable nginx //添加开机自启动
[root@localhost ~]#systemctl start nginx //启动nginx
[root@localhost ~]#systemctl status nginx //查看nginx状态
6.安装Nightingale
[root@localhost ~]#yum install git -y //安装git命令,已经安装可忽略
[root@localhost ~]#cd /home/
[root@localhost home]##git clone https://github.com/didi/nightingale.git n9e //克隆安装包到n9e目录,若更改配置目录,后续配置则需手动更改
[root@localhost home]##cd n9e
[root@localhost n9e]#export GO111MODULE=on //启用 Go Modules 功能,服务器若可以翻墙访问golang可忽略此操作
[root@localhost n9e]#export GOPROXY=https://goproxy.io //配置 GOPROXY 环境变量,服务器若可以翻墙访问golang可忽略此操作
[root@localhost n9e]#./control build
[root@localhost n9e]#./control pack
初始化数据库
[root@localhost n9e]#mysql -uroot -p < sql/n9e_hbs.sql
[root@localhost n9e]#mysql -uroot -p < sql/n9e_mon.sql
[root@localhost n9e]#mysql -uroot -p < sql/n9e_uic.sql
导入nginx配置文件
[root@localhost n9e]#cp -rp etc/nginx.conf /etc/nginx/
[root@localhost n9e]#systemctl restart nginx
修改配置文件
[root@localhost n9e]#vim etc/mysql.yml //修改mysql访问的用户名和密码
启动各模块进程
[root@localhost n9e]#./control start all
[root@localhost n9e]#ps -ef|grep n9e //查看进程启动成功
如下6个进程存在则启动成功7.添加开机自启动
[root@localhost n9e]#chmod 754 etc/service/n9e-*
[root@localhost n9e]#cp -rp etc/service/* /etc/systemd/system/
[root@localhost n9e]#systemctl enable n9e-index
[root@localhost n9e]#systemctl enable n9e-judge
[root@localhost n9e]#systemctl enable n9e-monapi
[root@localhost n9e]#systemctl enable n9e-transfer
[root@localhost n9e]#systemctl enable n9e-tsdb
[root@localhost n9e]#systemctl enable n9e-collector
8.登录Nightingale
我的实例IP为192.168.32.10,输入服务器IP访问 http://192.168.32.10 ,用户名和密码默认为root
登录如下,初步搭建完成
9.collector部署
collector的部署依赖的文件是n9e-collector二进制、etc/collector.yml、etc/address.yml,修改address.yml配置对应的服务端地址,把这3个文件打个包,分发到目标机器上启动就可以
[root@localhost n9e]#tar -zcvf n9e-collector.tar.gz n9e-collector etc/collector.yml etc/address.yml拷贝n9e-collector.tar.gz到需要监控的服务器上
客户端操作:
[root@localhost ]#mkdir /home/n9e/
[root@localhost ]#tar -zxvf n9e-collector.tar.gz -C /home/n9e/
[root@localhost ]#./n9e-collector