centos 7.9+mysql 5.7+nightingale v6.0+redis安装

centos 7.9+mysql 5.7+nightingale v6.0+redis安装

  • 前言
    • nightingale的架构
  • nightingale v6.0安装
    • 安装victoriametrics作为数据源
    • 安装prometheus作为数据源

前言

官方地址:https://github.com/ccfos/nightingale。
中国地址:https://flashcat.cloud/docs/。
centos 7.9+mysql 5.7+nightingale v6.0+redis安装_第1张图片

nightingale的架构

当监控端与被监控端网络状况良好时,使用中心汇聚式部署方案。centos 7.9+mysql 5.7+nightingale v6.0+redis安装_第2张图片
当监控端与被监控端网络状况较差时,使用边缘下沉式混杂部署方案。
centos 7.9+mysql 5.7+nightingale v6.0+redis安装_第3张图片

  • mysql:存放全部配置类信息(告警规则、屏蔽规则、订阅规则、监控大盘、人员信息、权限信息)和告警事件。
  • redis:存放验证信息(jwt的token、机器的元信息、心跳信息)。
  • TSDB:存放由插件采集而来的时序数据。

nightingale v6.0安装

# cat /etc/redhat-release 
CentOS Linux release 7.9.2009 (Core)

systemctl stop firewalld && systemctl disable firewalld
setenforce 0 && sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config && getenforce
yum update
yum install epel-release wget ntp ntpdate -y
ntpdate cn.pool.ntp.org
crontab -e
* */1 * * * /usr/sbin/ntpdate cn.pool.ntp.org

rpm -qa | grep -i mariadb
mariadb-libs-5.5.68-1.el7.x86_64
rpm -e --nodeps mariadb-libs-5.5.68-1.el7.x86_64
# 编辑软件源
vim /etc/yum.repos.d/mysql-community.repo
[mysql57-community]
name=MySQL 5.7 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/7/$basearch/
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

sudo yum install mysql-community-server -y
systemctl start mysqld.service
# 查看mysql初始密码
cat /var/log/mysqld.log | grep password
netstat -lntp | grep 3306
mysql -uroot -p
mysql> set password for root@localhost = password('Cfxy!1234');

yum install -y redis
systemctl enable redis && systemctl restart redis
netstat -lntp | grep 6379

mkdir -p /opt/n9e && cd /opt/n9e
wget https://download.flashcat.cloud/n9e-v6.0.0-ga.6-linux-amd64.tar.gz
tar zxvf n9e-v6.0.0-ga.6-linux-amd64.tar.gz


mysql -uroot -p < n9e.sql
vi etc/config.toml
DSN="root:Cfxy!1234@tcp(127.0.0.1:3306)/n9e_v6?charset=utf8mb4&parseTime=True&loc=Local&allowNativePasswords=true"

nohup ./n9e &> n9e.log &
netstat -lntp | grep 17000
# 打开浏览器访问地址:http://192.168.40.101:17000/login。用户名:root,密码:root.2020

cd /opt
wget https://download.flashcat.cloud/categraf-v0.3.1-linux-amd64.tar.gz
tar zxvf categraf-v0.3.1-linux-amd64.tar.gz
mv categraf-v0.3.1-linux-amd64 categraf && cd categraf
vi conf/config.toml
hostname = "n9e_local"
url = "http://127.0.0.1:17000/prometheus/v1/write"
[heartbeat]
enable = true

# report os version cpu.util mem.util metadata
url = "http://127.0.0.1:17000/v1/n9e/heartbeat"


sudo cp conf/categraf.service /etc/systemd/system/ && sudo systemctl daemon-reload && systemctl enable categraf && systemctl start categraf
ps -aux | grep categraf

cp conf/categraf.service ./n9e.service
vi n9e.service
[Unit]
Description="nightingale"
After=network.target

[Service]
Type=simple

ExecStart=/opt/monitor/n9e/n9e
WorkingDirectory=/opt/monitor/n9e

Restart=on-failure
SuccessExitStatus=0
LimitNOFILE=65536
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=categraf


[Install]
WantedBy=multi-user.target

cp n9e.service /etc/systemd/system/ && sudo systemctl daemon-reload && systemctl enable n9e &&systemctl start n9e
# 打开浏览器访问地址:http://192.168.40.101:17000/login
# ./categraf --test --debug

centos 7.9+mysql 5.7+nightingale v6.0+redis安装_第4张图片

安装victoriametrics作为数据源

官方地址:https://victoriametrics.com/
centos 7.9+mysql 5.7+nightingale v6.0+redis安装_第5张图片
centos 7.9+mysql 5.7+nightingale v6.0+redis安装_第6张图片
centos 7.9+mysql 5.7+nightingale v6.0+redis安装_第7张图片

cd /opt/
wget https://github.com/VictoriaMetrics/VictoriaMetrics/releases/download/v1.90.0/victoria-metrics-linux-amd64-v1.90.0.tar.gz
tar zxvf victoria-metrics-linux-amd64-v1.90.0.tar.gz
nohup ./victoria-metrics-prod &> stdout.log &
ss -lntp | grep 8428
cd /opt/n9e/
vi etc/config.toml
[[Pushgw.Writers]]
# Url = "http://127.0.0.1:8480/insert/0/prometheus/api/v1/write"
# Url = "http://127.0.0.1:9090/api/v1/write"
Url = "http://127.0.0.1:8428/api/v1/write"

pkill n9e
nohup ./n9e &> n9e.log &

centos 7.9+mysql 5.7+nightingale v6.0+redis安装_第8张图片
centos 7.9+mysql 5.7+nightingale v6.0+redis安装_第9张图片
centos 7.9+mysql 5.7+nightingale v6.0+redis安装_第10张图片
centos 7.9+mysql 5.7+nightingale v6.0+redis安装_第11张图片

安装prometheus作为数据源

GitHub网址:https://github.com/prometheus/prometheus
centos 7.9+mysql 5.7+nightingale v6.0+redis安装_第12张图片
centos 7.9+mysql 5.7+nightingale v6.0+redis安装_第13张图片

cd /opt
wget https://github.com/prometheus/prometheus/releases/download/v2.43.1/prometheus-2.43.1.linux-amd64.tar.gz
tar zxvf prometheus-2.43.1.linux-amd64.tar.gz
cd prometheus-2.43.1.linux-amd64
nohup ./prometheus --config.file=prometheus.yml &> stdout.log &
ss -lntp | grep prometheus
# 配置n9e
vim /opt/n9e/etc/config.toml
[[Pushgw.Writers]]
# Url = "http://127.0.0.1:8480/insert/0/prometheus/api/v1/write"
Url = "http://127.0.0.1:9090/api/v1/write"

cd /opt/n9e/
pkill n9e
nohup ./n9e &> n9e.log &

centos 7.9+mysql 5.7+nightingale v6.0+redis安装_第14张图片centos 7.9+mysql 5.7+nightingale v6.0+redis安装_第15张图片
最后点击保存并测试。

你可能感兴趣的:(#,nightingale,运维)