单机部署夜莺监控5.1

Linux大区 1年前 (2022) 导航君
5 0 0

环境版本

• centos7
• mysql5.7
• redis5
• prometheus-2.28.0

centos7 简单初始化

yum install wget lrzsz -y
systemctl  stop firewalld
systemctl  disable firewalld
yum install iptables-services -y  ##配置防火墙再启动
echo "unset MAILCHECK" >> /etc/profile
source /etc/profile
chmod +x /etc/rc.d/rc.local
echo "ulimit -SHn 102400" >> /etc/rc.local
cat >> /etc/security/limits.conf << EOF
* soft nofile 65535
* hard nofile 65535
EOF
sed -i 's#SELINUX=enforcing#SELINUX=disabled#' /etc/selinux/config
setenforce 0
echo 10 > /proc/sys/vm/swappiness

安装Prometheus

安装promethues作为存储

mkdir  /data/soft -p
cd /data/soft
wget https://github.com/prometheus/prometheus/releases/download/v2.32.1/prometheus-2.32.1.linux-amd64.tar.gz
## 或者网盘下载链接: https://caiyun.139.com/m/i?185C6zFvvPfHp  提取码:cJSP  
tar xf prometheus-2.32.1.linux-amd64.tar.gz
mv  prometheus-2.32.1.linux-amd64  prometheus

配置Prometheus启动服务

cat >/etc/systemd/system/prometheus.service  <<EOF
[Unit]
Description="prometheus"
Documentation=https://prometheus.io/
After=network.target
[Service]
Type=simple
ExecStart=/data/soft/prometheus/prometheus  --config.file=/data/soft/prometheus/prometheus.yml --storage.tsdb.path=/data/soft/prometheus/data --web.enable-lifecycle --enable-feature=remote-write-receiver --query.lookback-delta=2m  --storage.tsdb.retention=90d
Restart=on-failure
RestartSecs=5s
SuccessExitStatus=0
LimitNOFILE=65536
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=prometheus
[Install]
WantedBy=multi-user.target
EOF
#保存历史数据,默认为15天。
#在启动脚本里更改--storage.tsdb.retention=90d可以延长,或者启动时带上这个参数即可

启动prometheus

systemctl daemon-reload
systemctl enable prometheus
systemctl restart prometheus
systemctl status prometheus

安装Redis5

yum install -y https://repo.ius.io/ius-release-el7.rpm
yum install -y redis5
systemctl  start redis
systemctl enable redis

安装mysql5.7

在本博客可以搜索到

安装n9e夜莺

开始安装

mkdir -p /data/soft/n9e
cd /data/soft/n9e
wget https://github.com/didi/nightingale/releases/download/v5.1.0/n9e-5.1.0.tar.gz
## 或者网盘下载 链接: https://caiyun.139.com/m/i?185CDQrtTe7to  提取码:EPNW  
tar xf n9e-5.1.0.tar.gz 
mysql -uroot -p123456 < docker/initsql/a-n9e.sql

配置

sed -i "s#1234#123456#g" etc/server.conf 
sed -i "s#1234#123456#g" etc/webapi.conf
## 生成32位随机数
## cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n1
## gBiP5fwu63QXCqAY9tmxwQ5HNXhLoJ1N
## cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n1
## zMEgjbh4zYrUniQNDOHKdARghuqqkV1B
sed -i '/^SigningKey/c SigningKey = "gBiP5fwu63QXCqAY9tmxwQ5HNXhLoJ1N"'  etc/webapi.conf
sed -i '/^user001/c user001 = "zMEgjbh4zYrUniQNDOHKdARghuqqkV1B"'  etc/webapi.conf

启动配置

sed -i "s#/root/gopath/src/n9e/n9e#/data/soft/n9e/n9e#g" etc/service/n9e-server.service 
sed -i "s#/root/gopath/src/n9e#/data/soft/n9e#g" etc/service/n9e-server.service 
sed -i "s#/root/gopath/src/n9e/n9e#/data/soft/n9e/n9e#g" etc/service/n9e-webapi.service 
sed -i "s#/root/gopath/src/n9e#/data/soft/n9e#g" etc/service/n9e-webapi.service 
cp etc/service/n9e-server.service /etc/systemd/system/
cp etc/service/n9e-webapi.service  /etc/systemd/system/
systemctl daemon-reload
systemctl enable n9e-server
systemctl restart n9e-server
systemctl status n9e-server
systemctl enable n9e-webapi
systemctl restart n9e-webapi
systemctl status n9e-webapi
## server默认会监听在19000端口,webapi会监听在18000端口

登录

 ​http://ip:18000
默认账号root 密码root.2020
单机部署夜莺监控5.1

版权声明:导航君 发表于 2022年6月26日 上午8:22。
转载请注明:单机部署夜莺监控5.1 | 第八网址导航

相关文章

暂无评论

暂无评论...