【夜莺监控方案】01-n9e-v5-server部署
文章目录
前言
相关文档如下:
《01-n9e-v5 部署-server》
《01-n9e-v5部署-agent》
《02-容器监控-cadvisor+n9e》
《03-k8s集群监控(上)》
《03-k8s集群监控(下)》
《04-监控redis集群-prometheuse+n9e》
1. 在线一键安装(不推荐)
数据库账号密码、存储位置什么的最好我们还是自己设置一下,除体验外不推荐官方一键安装方式
# curl -s http://116.85.64.82/install_n9e_server.sh|bash
2. 自主安装(推荐)
官方安装脚本
下边是官方给出的一键安装脚本,我们可以根据这个脚本安装
#!/bin/bash
# 安装mysql相关rpm包
yum -y install mariadb*
# 假设机器的/home分区是个SSD的大分区,datadir设置为/home/mysql
# mkdir -p /home/mysql
# chown mysql:mysql /home/mysql
# sed -i '/^datadir/s/^.*$/datadir=\/home\/mysql/g' /etc/my.cnf
# 启动mysql进程
systemctl start mariadb.service
# 将mysql设置为开机自启动
systemctl enable mariadb.service
# 设置mysql root密码
mysql -e "SET PASSWORD FOR 'root'@'localhost' = PASSWORD('1234');"
# 安装 promethues
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
pip install bottle
pip install requests
# install n9e-server
mkdir -p /opt/n9e
cd /opt/n9e
wget 116.85.64.82/n9e-server-5.0.0-rc7.tar.gz
tar zxvf n9e-server-5.0.0-rc7.tar.gz
mysql -uroot -p1234 < /opt/n9e/server/sql/n9e.sql
cp /opt/n9e/server/etc/service/n9e-server.service /etc/systemd/system/
systemctl daemon-reload
systemctl enable n9e-server
systemctl restart n9e-server
systemctl status n9e-server
2.1 mysql
自己安装还是修改上边官方脚本都可以
主要是修改数据目录位置和账号密码两处
2.2 prometheus
按上边官方脚本还是自己按都可以。之后使用再按需要配置
2.3 n9e-server
- 安装
前边这些操作按照官方脚本操作都可以
导入密码的地方不要忘了修改成自己mysql库的用户和密码
# install n9e-server
mkdir -p /opt/n9e
cd /opt/n9e
wget 116.85.64.82/n9e-server-5.0.0-rc7.tar.gz
tar zxvf n9e-server-5.0.0-rc7.tar.gz
mysql -uxxxx -pxxxx < /opt/n9e/server/sql/n9e.sql
cp /opt/n9e/server/etc/service/n9e-server.service /etc/systemd/system/
- 修改配置文件
根据实际情况修改/opt/n9e/server/etc/server.yml
文件,原默认配置如下:
mysql:
addr: "root:1234@tcp(127.0.0.1:3306)/n9e?charset=utf8&parseTime=True&loc=Asia%2FShanghai"
max: 128
idle: 16
debug: false
2.4 启动和开机自启
# systemctl daemon-reload
# systemctl enable n9e-server
# systemctl restart n9e-server
2.5 web查看
web访问 http://IP:8000
默认用户名密码: root/root.2020
3. 配置LDAP
- 修改配置文件
根据实际情况修改/opt/n9e/server/etc/server.yml
文件
ldap:
enable: true
host: ssocto.xxx.com.cn
port: 389
baseDn: "dc=example,dc=org"
# AD: manange@example.org
bindUser: "cn=admin,dc=example,dc=org"
bindPass: "xxxxx"
# openldap: (&(uid=%s))
# AD: (&(sAMAccountName=%s))
authFilter: "(&(uid=%s))"
attributes:
nickname: "cn"
email: "mail"
phone: "mobile"
coverAttributes: false
autoRegist: true
tls: false
startTLS: false
- 重启服务
# systemctl restart n9e-server