夜莺v5 部署
简介
夜莺是新一代国产智能监控系统。对云原生场景、传统物理机虚拟机场景,都有很好的支持。
安装prometheus
作为后端的存储
mkdir -p /opt/prometheus
wget https://s3-gz01.didistatic.com/n9e-pub/prome/prometheus-2.28.0.linux-amd64.tar.gz -O prometheus-2.28.0.linux-amd64.tar.gz
tar xf prometheus-2.28.0.linux-amd64.tar.gz
cp -far prometheus-2.28.0.linux-amd64/* /opt/prometheus/
# service
cat <<EOF >/etc/systemd/system/prometheus.service
[Unit]
Description="prometheus"
Documentation=https://prometheus.io/
After=network.target
[Service]
Type=simple
ExecStart=/opt/prometheus/prometheus --config.file=/opt/prometheus/prometheus.yml --storage.tsdb.path=/opt/prometheus/data --web.enable-lifecycle --enable-feature=remote-write-receiver --query.lookback-delta=2m
Restart=on-failure
RestartSecs=5s
SuccessExitStatus=0
LimitNOFILE=65536
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=prometheus
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl enable prometheus
systemctl restart prometheus
systemctl status prometheus
部署服务端
服务端依赖mysql
数据库,请自行安装,v5
版本的数据库表结构和之前的版本不兼容,所以没法复用之前版本的数据库,这点请注意。
-
下载安装包
mkdir -p /opt/n9e cd /opt/n9e wget 116.85.64.82/n9e-5.0.0-rc1.tar.gz tar zxvf n9e-5.0.0-rc1.tar.gz
-
导入表结构
mysql -uroot -p < /opt/n9e/sql/n9e.sql
-
修改配置
服务端启动的时候会看etc目录下是否有server.local.yml,如果有就用,如果没有,再去找server.yml,即server.local.yml的优先级高于server.yml
cd /opt/n9e/etc vim server.yml
修改server.yml中的数据库连接配置 默认配置的后端存储就是Prometheus,所以不用改动
-
启动进程
cd /opt/n9e cp /opt/n9e/etc/service/n9e-server.service /usr/lib/systemd/system/ systemctl daemon-reload systemctl enable n9e-server systemctl restart n9e-server systemctl status n9e-server
部署客户端
mkdir -p /opt/n9e
tar zcvf n9e-5.0.0-rc1.tar.gz n9e-agentd etc/agentd.yml etc/conf.d etc/service/n9e-agentd.service -C /opt/n9e
cp /opt/n9e/etc/service/n9e-agentd.service /usr/lib/systemd/system/
systemctl daemon-reload
systemctl enable n9e-agentd
systemctl restart n9e-agentd
systemctl status n9e-agentd
nginx
配置
nginx
添加虚拟主机,前端是已经打包好的,放在/opt/n9e/pub
目录下,/api
直接转发的n9e-server
的端口就可以了。
server {
listen 80;
server_name _;
root /opt/n9e/pub;
location / {
root /opt/n9e/pub;
try_files $uri /index.html;
}
location /api/ {
proxy_pass http://127.0.0.1:8000;
}
}
- 原文作者:Linux运维菜
- 原文链接:https://www.opcai.top/post/2021/2021-06/nightingale_v5/
- 版权声明:本作品采用进行许可,非商业转载请注明出处(作者,原文链接),商业转载请联系作者获得授权。