1. 基础环境
1.1. 环境信息
操作系统:Centos7,IP地址:192.168.1.20
1.2. 安装基础工具包
yum install vim wget lrzsz net-tools unzip -y
1.3. 配置yum源为阿里云
yum list | grep epel-release
yum install epel-release -y
wget -O /etc/yum.repos.d/epel-7.repo mirrors.aliyun.com/repo/epel-7…
yum clean all
yum makecache
2. 下载安装包
2.1. nightingale6.0下载地址
2.2. categraf下载地址
2.3. fe(前端)下载地址
3. 安装Nightingale
3.1. 安装prometheus
#创建文件夹,下载安装包
mkdir -p /opt/prometheus wget s3-gz01.didistatic.com/n9e-pub/pro… -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 </etc/systemd/system/prometheus.service
[Unit]
Description="prometheus"
Documentation=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.2. 安装mysql
yum -y install mariadb*
systemctl enable mariadb
systemctl restart mariadb
mysql -e "SET PASSWORD FOR 'root'@'localhost' = PASSWORD('1234');"
3.3. 安装redis
yum install -y redis
systemctl enable redis
systemctl restart redis
3.4. 安装n9e
#新建文件夹 mkdir -p /opt/n9e && cd /opt/n9e
#上传n9e-v6.0.0-ga.1.0.1-linux-amd64.tar.gz到当前目录,解压
tar zxvf n9e-v6.0.0-ga.1.0.1-linux-amd64.tar.gz
#还原mysql数据库表
mysql -uroot -p1234 < n9e.sql
#运行
nohup ./n9e &> n9e.log &
#查看日志 tail -f n9e.log
#查看进程 ps -aux | grep n9e
3.5. 注册为系统服务
#编写service
vim /usr/lib/systemd/system/n9e.service
内容如下:
`[Unit]
Description=n9e
After=network.target
[Service]
Type=simple
User=root
ExecStart=/opt/n9e/n9e
WorkingDirectory=/opt/n9e/
Restart=on-failure
[Install]
WantedBy=multi-user.target`
#重载配置
systemctl daemon-reload
#启动、停止n9e服务
systemctl start n9e
systemctl status n9e
systemctl stop n9e
#配置开机启动
systemctl enable n9e
4. 安装Categraf
4.1. 本机安装
cd /opt
#上传categraf-v0.2.35-linux-amd64.tar.gz到当前目录,解压
tar zxvf categraf-v0.2.35-linux-amd64.tar.gz
mv categraf-v0.2.35-linux-amd64 categraf
4.2. 测试
cd /opt/categraf
./categraf --test
4.3. 其他命令
./categraf --test --inputs system:mem
./categraf --help
./categraf
./categraf --configs /path/to/conf-directory
./categraf --inputs system:mem
4.4. nohup后台启动服务
nohup ./categraf &> stdout.log &
4.5. 修改配置文件
示例如下(新版n9e监听端口为17000)
vim /opt/categraf/conf/config.toml
4.6. 注册为系统服务
#编写service
vim /usr/lib/systemd/system/categraf.service
内容如下:
`[Unit]
Description=categraf
After=network.target
[Service]
Type=simple
User=root
ExecStart=/opt/categraf/categraf
WorkingDirectory=/opt/categraf/
Restart=on-failure
[Install]
WantedBy=multi-user.target`
#重载配置
systemctl daemon-reload
#启动、停止categraf服务
systemctl start categraf
systemctl status categraf
systemctl stop categraf
#配置开机启动
systemctl enable categraf
5. 使用Nightingale平台
5.1. 访问地址
5.2. 账号密码
root/root.2020
5.3. 查看categraf检测信息
点击仪表盘==》内置大盘==》linux,点击大盘[Linux Host by Categraf]查看即可
5.4. 添加大盘到业务组(示例)
#点击仪表盘==》内置大盘==》linux,点击克隆[HOST by Node Exporter],选择业务组,确定即可
#点击仪表盘==》监控大盘==》大盘名称,查看即可
5.5. 配置查询数据源
prometheus示例URL:http://192.168.1.20:9090
elasticsearch示例URL:http://192.168.1.15:9200
victoria-metrics示例URL:http://192.168.1.15:8428
jaeger示例URL:http://192.168.1.15:16686
5.6. 配置jaeger链路追踪
系统配置==》数据源添加==》URL==》http://192.168.1.15:16686 ==》启用数据源
点击链路追踪即可查看