简介

夜莺是新一代国产智能监控系统。对云原生场景、传统物理机虚拟机场景,都有很好的支持。

安装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版本的数据库表结构和之前的版本不兼容,所以没法复用之前版本的数据库,这点请注意。

  1. 下载安装包

    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
    
  2. 导入表结构

    mysql -uroot -p < /opt/n9e/sql/n9e.sql
    
  3. 修改配置

    服务端启动的时候会看etc目录下是否有server.local.yml,如果有就用,如果没有,再去找server.yml,即server.local.yml的优先级高于server.yml

    cd /opt/n9e/etc
    vim server.yml 
    

    修改server.yml中的数据库连接配置 默认配置的后端存储就是Prometheus,所以不用改动

  4. 启动进程

    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;
    }
}