一、项目介绍
Nightingale 是一套衍生自 Open-Falcon 的互联网监控解决方案,融入了部分滴滴生产环境的最佳实践,灵活易用,稳定可靠。夜莺监控,由滴滴开发和开源,并于 2022 年 5 月 11 日,捐赠予中国计算机学会开源发展委员会(CCF ODC),为 CCF ODC 成立后接受捐赠的第一个开源项目。
功能特点
- 告警引擎重构为推拉结合模式,通过推模式保证大部分策略判断的效率,通过拉模式支持了nodata告警,去除原来的nodata组件,简化系统部署难度
- 引入了服务树,对endpoint进行层级管理,去除原来扁平的HostGroup,同时干掉告警模板,告警策略直接与服务树节点
文章来源(Source):浅时光博客 绑定,大幅提升灵活度和易用性 - 干掉原来的基于数据库的索引库,改成内存模式,单独抽出一个index模块处理索引,避免了原来MySQL单表达到亿级的尴尬局面,索引基于内存之后效率也大幅提升
- 存储模块Graph,引入facebook的Gorilla,即内存TSDB,近期几个小时的数据默认存内存,大幅提升数据查询效率,硬盘存储方式仍然使用rrdtool
- 告警引擎judge模块通过心跳机制做到了故障自动摘除,再也不用担心单个judge挂掉导致部分策略失效的问题,index模块也是采用类似方式保证可用性
- 客户端中内置了日志匹配指标抽取能力,web页面上支持了日志匹配规则的配置,同时也支持读取目标机器特定目录下的配置文件的方式,让业务指标监控更为易用
- 将portal(falcon-plus中的api)、uic、dashboard、hbs、alarm合并为一个模块:monapi,简化了系统整体部署难度,原来的部分模块间调用变成进程内方法调用,稳定性更好
二、部署安装
1、环境描述

- 由于夜莺监控平台采用Go编写,所以需要首先安装Go环境,数据存储方面需要安装MySQL、Redis;前端页面展示需要安装Nginx
- 注:下面安装所以的程序包文件我都存储在
/opt/soft
目录下
2、安装Golang
2.1:下载程序

2.2:解压配置
[root@localhost ~]# mkdir -p /opt/soft/
[root@localhost ~]# cd /opt/soft/
[root@localhost soft]# tar -zxvf go1.14.4.linux-amd64.tar.gz -C /usr/local/
#添加到系统环境变量中
[root@localhost ~]# vim /etc/profile
export GOROOT=/usr/local/go
export GOPATH=/usr/local/gopath
export PATH=$GOROOT/bin:$GOPATH/bin:$PATH:$HOME/bin
[root@localhost ~]# source /etc/profile
[root@localhost ~]# go version
go version go1.14.4 linux/amd64
3、安装Nginx
- 安装方式RPM包,版本1.18
- 下载地址:http://nginx.org/packages/rhel/7/x86_64/RPMS/
3.1:下载安装
[root@localhost ~]# cd /opt/soft/
[root@localhost soft]# rpm -ivh nginx-1.18.0-1.el7.ngx.x86_64.rpm
3.
[root@localhost ~]# systemctl start nginx
[root@localhost ~]# systemctl enable nginx
[root@localhost ~]# firewall-cmd --permanent --zone=public --add-port=80/tcp
[root@localhost ~]# firewall-cmd --reload
4、安装MySQL
- 我这块采用RPM包的方式安装MySQL,MySQL版本为5.7.30
- 下载地址:
4.1:下载程序
[root@localhost ~]# cd /opt/soft/
[root@localhost soft]# wget http://mirror.centos.org/centos/6/os/x86_64/Packages/libaio-0.3.107-10.el6.x86_64.rpm
[root@localhost soft]# wget https://mirrors.tuna.tsinghua.edu.cn/mysql/yum/mysql-5.7-community-el7-x86_64/mysql-community-common-5.7.30-1.el7.x86_64.rpm
[root@localhost soft]# wget https://mirrors.tuna.tsinghua.edu.cn/mysql/yum/mysql-5.7-community-el7-x86_64/mysql-community-libs-5.7.30-1.el7.x86_64.rpm
[root@localhost soft]# wget https://mirrors.tuna.tsinghua.edu.cn/mysql/yum/mysql-5.7-community-el7-x86_64/mysql-community-libs-compat-5.7.30-1.el7.x86_64.rpm
[root@localhost soft]# wget https://mirrors.tuna.tsinghua.edu.cn/mysql/yum/mysql-5.7-community-el7-x86_64/mysql-community-devel-5.7.30-1.el7.x86_64.rpm
[root@localhost soft]# wget https://mirrors.tuna.tsinghua.edu.cn/mysql/yum/mysql-5.7-community-el7-x86_64/mysql-community-client-5.7.30-1.el7.x86_64.rpm
[root@localhost soft]# wget https://mirrors.tuna.tsinghua.edu.cn/mysql/yum/mysql-5.7-community-el7-x86_64/mysql-community-server-5.7.30-1.el7.x86_64.rpm
4.2:安装程序
[root@localhost soft]# rpm -ivh libaio-0.3.107-10.el6.x86_64.rpm
[root@localhost soft]# yum -y install mysql-community-*
4.3:启动程序
[root@localhost soft]# systemctl start mysqld
[root@localhost soft]# systemctl enable mysqld
4.4:重置密码
#重置ROOT密码
[root@localhost ~]# cat /var/log/mysqld.log |grep password
[root@localhost ~]# mysql -uroot -p
Enter password:
mysql> set global validate_password_policy=0;
mysql> set global validate_password_number_count=0;
mysql> set global validate_password_special_char_count=0;
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'dqz123.';
5、安装Redis
5.1:下载程序
#将下载的包存储在/opt/soft目录下
[root@localhost ~]# cd /opt/soft
[root@localhost soft]# wget http://download.redis.io/releases/redis-5.0.6.tar.gz
5.2:安装组件
[root@localhost soft]# yum groupinstall 'Development Tools'
[root@localhost soft]# tar -xf redis-5.0.6.tar.gz -C /usr/local/
5.3:编译安装
[root@localhost soft]# yum -y install gcc make
[root@localhost soft]# cd /usr/local/
[root@localhost local]# mv redis-5.0.6 redis
[root@localhost local]# cd redis
#编译
[root@localhost redis]# make
#安装
[root@localhost redis]# make install PREFIX=/usr/local/redis
#拷贝执行文件到/usr/local/bin下
[root@localhost ~]# cd /usr/local/redis/bin
[root@localhost bin]# cp * /usr/local/bin/
5.4:修改配置
[root@localhost ~]# vim /usr/local/redis/redis.conf






- 创建数据目录和日志存储
文章来源(Source):https://www.dqzboy.com 目录
[root@localhost redis]# mkdir -p /data/redis/logs
5.5:系统托管
[root@localhost ~]# vim /usr/lib/systemd/system/redis.service
[Unit]
Description=Redis persistent key-value database
After=network.target
[Service]
ExecStart=/usr/local/redis/bin/redis-server /usr/local/redis/redis.conf --supervised systemd
ExecStop=/bin/kill -s QUIT $MAINPID
ExecRepload=/bin/kill -s HUP $MAINPID
Type=notify
User=root
Group=root
RuntimeDirectory=redis
RuntimeDirectoryMode=0755
[Install]
WantedBy=multi-user.target
5.6:启动服务
[root@localhost ~]# systemctl daemon-reload
[root@localhost ~]# systemctl start redis
[root@localhost ~]# systemctl enable redis
[root@localhost ~]# systemctl status redis
[root@localhost ~]# ps -aux | grep redis
[root@localhost ~]# lsof -i:6379
6、安装夜莺
6.1:编译安装
#安装git
yum install git -y
#创建编译目录
[root@localhost ~]# source /etc/profile
[root@localhost ~]# mkdir -p $GOPATH/src/github.com/didi
[root@localhost ~]# ls $GOPATH
src
#克隆代码
[root@localhost ~]# cd $GOPATH/src/github.com/didi
[root@localhost didi]# git clone https://github.com/didi/nightingale.git
#执行编译
[root@localhost didi]# cd nightingale
[root@localhost nightingale]# ./control build
[root@localhost nightingale]# ./control pack
6.2:导入SQL
[root@localhost ~]# cd /usr/local/gopath/src/github.com/didi/nightingale/
[root@localhost nightingale]# mysql -uroot -p < sql/n9e_hbs.sql
[root@localhost nightingale]# mysql -uroot -p < sql/n9e_mon.sql
[root@localhost nightingale]# mysql -uroot -p < sql/n9e_uic.sql
[root@localhost nightingale]# mysql -uroot -p
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| n9e_hbs |
| n9e_mon |
| n9e_uic |
| performance_schema |
| sys |
+--------------------+
7 rows in set (0.00 sec)
6.3:修改配置
[root@localhost ~]# cd /usr/local/gopath/src/github.com/didi/nightingale/
[root@localhost nightingale]# vim etc/mysql.yml

- 修改Redis密码,默认配置文件为空。而我这里添加了Redis认证密码,所以需要修改夜莺的配置文件
[root@localhost nightingale]# vim etc/monapi.yml

[root@localhost nightingale]# vim etc/judge.yml

- 注:另外在
etc/address.yml
下可以看到各个模块监听的端口,如果与本地其他服务端口冲突了,就需要手工修改一下
6.4:修改Nginx
- 在克隆的夜莺项目的代码下有关于Nginx的配置文件,我们需要拷贝至默认Nginx的配置目录下进行替换和修改
[root@localhost ~]# mv /etc/nginx/nginx.conf{,_bak}
[root@localhost ~]# cp /usr/local/gopath/src/github.com/didi/nightingale/etc/nginx.conf /etc/nginx/
[root@localhost ~]# vim /etc/nginx/nginx.conf


[root@localhost ~]# nginx -t
[root@localhost ~]# nginx -s reload
7、启动夜莺
[root@localhost ~]# cd /usr/local/gopath/src/github.com/didi/nightingale/
[root@localhost nightingale]# ./control start all
[root@localhost nightingale]# ./control status
- 注:一共6个模块均需启动
三、登入使用
- 默认访问账号密码:root/root




是夜莺好用,还是open-falcon好用?看楼主写了 这么多文章,到底哪个好
这2款呢,我们项目上都没用;夜莺是在open falcon的基础上二次开源的,增加的很多功能,个人部署后实践后感觉夜莺更好点
那很冒昧的问一下,项目上用的是普罗米修斯或者扎比克斯?目前现阶段,也是采用扎比克斯
这个我们都用,zabbix监控我们的宿主机,Prometheus监控的我们的容器服务
很完美的结合