当前位置: 首页 > 工具软件 > Nightingale > 使用案例 >

**Nightingale** 部署文档(Linux环境)

东郭翰音
2023-12-01

Nightingale,简称n9e,中文名为“夜莺”。

夜莺是滴滴基础平台联合滴滴云研发和开源的企业级监控解决方案。旨在满足云原生时代企业级的监控需求。Nightingale在产品完成度、系统高可用、以及用户体验方面,达到了企业级的要求,可满足不同规模用户的场景,小到几台服务,大到数十万都可以完美支撑。兼顾云原生和裸金属,支持应用监控和系统监控,插件机制灵活,插件丰富完善,具有高度的灵活性和可扩展性。

在夜莺(Nightingale)的基础上进行了二次开发,支持docker化部署(不推荐),支持GPU指标监控、第三方应用指标监控等。
 

一、配置yum源为清华源

[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# ls
bak2022-04-06  centoss.repo
##centoss.repo可在百度复制清华源的内容
[root@localhost ~]# yum clean all
已加载插件:fastestmirror
正在清理软件源: base extras updates
Cleaning up list of fastest mirrors
Other repos take up 40 M of disk space (use --verbose for details)
[root@localhost ~]# yum makecache 
已加载插件:fastestmirror
Determining fastest mirrors
##配置完成
##安装依赖
[root@localhost ~]# yum -y install gcc-c++
[root@localhost ~]# yum -y install gcc
[root@localhost ~]# yum -y install openssl*
[root@localhost ~]# yum -y install wget
[root@localhost ~]# yum -y install make

二、部署夜莺所需的中间件(mysql、redis、prometheus时序库)

##创建安装mysql目录
[root@localhost ~]# mkdir mysql5
[root@localhost ~]# cd mysql5/
[root@localhost mysql5]# ls
mysql-5.7.29-1.el7.x86_64.rpm-bundle.tar
##解压
[root@localhost mysql5]# tar -xvf mysql-5.7.29-1.el7.x86_64.rpm-bundle.tar
##安装
[root@localhost mysql5]# yum -y localinstall *.rpm
##启动
[root@localhost mysql5]# systemctl start mysqld
##查看初始密码
[root@localhost ~]# cat /var/log/mysqld.log | grep password
2022-04-06T09:51:43.429969Z 1 [Note] A temporary password is generated for root@localhost: w%>J_WG(x6ig
##修改密码
mysql> alter user 'root'@'localhost' identified by 'Asd@123!';
mysql> flush privileges;
##进入/usr/local/目录
[root@localhost ~]# cd /usr/local/
[root@localhost local]# ls
bin  etc  games  go  include  lib  lib64  libexec  nginx  redis-4.0.6.tar.gz  sbin  share  src
##解压
[root@localhost local]# tar -zxvf redis-4.0.6.tar.gz
[root@localhost local]# cd redis-4.0.6/
[root@localhost redis-4.0.6]# ls
00-RELEASENOTES  BUGS  CONTRIBUTING  COPYING  deps  INSTALL  Makefile  MANIFESTO  README.md  runtest  runtest-cluster  runtest-sentinel  sentinel.conf  src  tests  utils
##编译&&安装
[root@localhost redis-4.0.6]# make && make install #如果要安装到指定目录,make PREFIX=绝对路径 install
[root@localhost redis-4.0.6]# cd ..
##拷贝redis.conf到redis 的启动目录下
[root@localhost redis-4.0.6]# cp redis.conf ../bin/
[root@localhost redis-4.0.6]# cd ../bin/
##修改为后台运行
[root@localhost bin]# vim redis.conf
#修改daemonize no 为 yes
daemonize yes
##启动
[root@localhost bin]# ./redis-server redis.conf
##切换目录到/usr/local
[root@localhost ~]# cd /usr/local/
##安装prometheus
[root@localhost local]# tar -zxvf prometheus-2.34.0.linux-amd64.tar.gz
##重命名目录
[root@localhost local]# mv prometheus-2.34.0.linux-amd64 prometheus
##启动(默认端口9090)
[root@localhost local]# cd prometheus/
[root@localhost prometheus]# nohup ./prometheus --config.file=prometheus.yml --enable-feature=remote-write-receiver &
##注意:如果你的9090端口被占用的话,--web.listen-address=0.0.0.0:9009 这个启动参数来修改

三、准备工作已做完,开始安装n9e

##创建安装目录
[root@localhost ~]# cd /usr/local/
[root@localhost local]# mkdir n9e
[root@localhost local]# cd n9e/
##解压
[root@localhost n9e]# tar -zxvf n9e-5.5.0_.tar.gz
[root@localhost n9e]# ls
docker  etc  n9e  pub  
##导入sql
[root@localhost n9e]# cd docker/initsql/
[root@localhost initsql]# ls
a-n9e.sql  b-ibex.sql  c-init.sql
[root@localhost initsql]# mysql -uroot -pAsd@123! < a-n9e.sql
##分别修改server.conf和webapi.conf配置与mysql密码一样
[root@localhost initsql]# cd ../../etc/
[root@localhost etc]# vim server.conf
#Password = "1234" 改为 "Asd@123!"
[root@localhost etc]# vim webapi.conf 
#Password = "1234" 改为 "Asd@123!"
##启动(server默认端口为19000,webapi默认端口为18000)
[root@localhost etc]# cd ..
[root@localhost n9e]# nohup ./n9e server > server.log &
[root@localhost n9e]# nohup ./n9e webapi > webapi.log &

四、安装telegraf监控采集服务(客户端)

##shell脚本安装(在线安装)
[root@localhost local]# vim telegraf.sh
#!/bin/sh
​
version=1.20.4
tarball=telegraf-${version}_linux_amd64.tar.gz
wget https://dl.influxdata.com/telegraf/releases/$tarball
tar xzvf $tarball
​
mkdir -p /opt/telegraf
cp -far telegraf-${version}/usr/bin/telegraf /opt/telegraf
​
cat <<EOF > /opt/telegraf/telegraf.conf
[global_tags]
​
[agent]
  interval = "10s"
  round_interval = true
  metric_batch_size = 1000
  metric_buffer_limit = 10000
  collection_jitter = "0s"
  flush_interval = "10s"
  flush_jitter = "0s"
  precision = ""
  hostname = ""
  omit_hostname = false
​
[[outputs.opentsdb]]
  host = "http://127.0.0.1"  #如果是在被监控端部署,这里的IP写server端
  port = 19000
  http_batch_size = 50
  http_path = "/opentsdb/put"
  debug = false
  separator = "_"
​
[[inputs.cpu]]
  percpu = true
  totalcpu = true
  collect_cpu_time = false
  report_active = true
​
[[inputs.disk]]
  ignore_fs = ["tmpfs", "devtmpfs", "devfs", "iso9660", "overlay", "aufs", "squashfs"]
​
[[inputs.diskio]]
​
[[inputs.kernel]]
​
[[inputs.mem]]
​
[[inputs.processes]]
​
[[inputs.system]]
  fielddrop = ["uptime_format"]
​
[[inputs.net]]
  ignore_protocol_stats = true
​
EOF
​
cat <<EOF > /etc/systemd/system/telegraf.service
[Unit]
Description="telegraf"
After=network.target
​
[Service]
Type=simple
​
ExecStart=/opt/telegraf/telegraf --config telegraf.conf
WorkingDirectory=/opt/telegraf
​
SuccessExitStatus=0
LimitNOFILE=65536
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=telegraf
KillMode=process
KillSignal=SIGQUIT
TimeoutStopSec=5
Restart=always
​
​
[Install]
WantedBy=multi-user.target
EOF
​
systemctl daemon-reload
systemctl enable telegraf
systemctl restart telegraf
systemctl status telegraf
​
##加上可执行权限,执行
[root@localhost local]# chmod +x telegraf.sh
[root@localhost local]# ./telegraf.sh

验证,通过Web浏览器访问页面

ip+18000端口访问,默认用户名和密码为:root/root.2020

 类似资料: