一、server端部署
1、安装mariadb
yum -y install mariadb*
systemctl enable mariadb.service --now
mysql -e "SET PASSWORD FOR 'root'@'localhost' = PASSWORD('1234');"
2、安装prometheus
创建 prometheus 安装脚本install_prometheus_server.sh
# install 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
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
3、安装 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/
4、安装prometheus
chmod +x install_prometheus_server.sh
sh install_prometheus_server.sh
5、修改配置文件
根据实际情况修改 /opt/n9e/server/etc/server.yml文件,原默认配置如下:
# prometheus的配置
- name: prome01
url: http://localhost:9090/api/v1/write #promentheus地址和断口
remoteTimeoutSecond: 5
remoteRead:
- name: prome01
url: http://localhost:9090/api/v1/read #promentheus地址和断口
remoteTimeoutSecond: 5
#mysql的配置
mysql:
addr: "root:1234@tcp(127.0.0.1:3306)/n9e?charset=utf8&parseTime=True&loc=Asia%2FShanghai"
max: 128
idle: 16
debug: false
6、启动服务及设置开机自启动
systemctl daemon-reload
systemctl enable n9e-server --now
默认登录信息 http://IP:8000 用户名:root 密码 root.2020
二、客户端安装
1、安装脚本
#!/bin/bash
# install n9e-agentd
mkdir -p /opt/n9e
cd /opt/n9e
wget 116.85.64.82/n9e-agentd-5.0.0-rc8.tar.gz
tar zxvf n9e-agentd-5.0.0-rc8.tar.gz
cp /opt/n9e/agentd/systemd/n9e-agentd.service /etc/systemd/system/
systemctl enable n9e-agentd.service --now
systemctl status n9e-agentd.service
2、修改配置文件 /opt/n9e/agentd/etc/agentd.yaml endpoints参数改为n9e server地址端口。
endpoints:
- http://xx.xx.xx.xx:8000
3、启动服务
systemctl daemon-reload
systemctl enable n9e-agentd
systemctl restart n9e-agentd
systemctl status n9e-agentd
三、exporter 安装
1、kafka_exporter
#!/bin/bash
#下载
wget https://github.com/danielqsj/kafka_exporter/releases/download/v1.2.0/kafka_exporter-
tar -zxvf kafka_exporter-1.2.0.linux-amd64.tar.gz
mv kafka_exporter-1.2.0.linux-amd64 /opt/
ln -s /opt/kafka_exporter-1.2.0.linux-amd64 /usr/local/kafka_exporter
#启动
nohup /usr/local/kafka_exporter/kafka_exporter --kafka.server=121.89.2xx.xx:9092 --kafka.version=1.1.0 --log.level=info > kafka_exporter.log --web.listen-address=0.0.0.0:9308 --sasl.enabled --sasl.username="kafka" --sasl.password"=xxxxxxx" &
2、redis_exporter
3、blackbox_export