监控服务器状态,夜莺( nightingale)方案介绍

前提

选择一台服务器,部署一个监控服务端,然后在各个windows或者linux中部署数据采集节点。

类似如下结构

在这里插入图片描述

目前我这边采用的技术是

https://flashcat.cloud/product/nightingale/

Nightingale 的解决方案

1 部署内容

服务端(服务端为 centos7 为例子)需要部署的清单:
prometheus(新版本不需要了)
mysql
redis
n9e

客户端需要部署的清单:
linux版本categraf
windwos版本categraf

2 开始进行部署

本次演示的采用 CentOS7 操作系统,其中 mysql redis 可以复用已经安装好的

2.1 部署prometheus(新版本不需要了)

下载安装包:
https://github.com/prometheus/prometheus/releases/download/v2.28.0/prometheus-2.28.0.linux-amd64.tar.gz

选择一台服务器
上传安装包
prometheus-2.28.0.linux-amd64.tar.gz

执行以下命令

mkdir -p /opt/prometheus
tar xf prometheus-2.28.0.linux-amd64.tar.gz
cp -far prometheus-2.28.0.linux-amd64/*  /opt/prometheus/

执行安装文件

# 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

Prometheus访问端口为:9090

2.2 部署mysql

可复用现有的,或参考博主文档

2.3 部署redis

可复用现有的,或参考博主文档

2.4 部署n9e并导入n9e数据库

cd /opt
wget https://github.com/ccfos/nightingale/releases/download/v7.0.0/n9e-v7.0.0-linux-amd64.tar.gz

mkdir -p /opt/n9e
tar -C /opt/n9e -xzf n9e-v7.0.0-linux-amd64.tar.gz

配置mysql和redis的路径

cd /opt/n9e/etc
vi config.toml

创建n9e_v6数据库
将n9e.sql导入 n9e_v6数据库中

cd /opt/n9e
nohup ./n9e &> n9e.log &
# 注意,如果有异常,请查看 n9e.log 文件

访问端口 17000

IP:17000 账号 root 密码 root.2020

在这里插入图片描述

4、监控linux服务器

下载并解压文件

cd /opt/softwarePackage
wget https://github.com/flashcatcloud/categraf/releases/download/v0.3.76/categraf-v0.3.76-linux-amd64.tar.gz
tar -C /opt/categraf -xzf categraf-v0.3.76-linux-amd64.tar.gz
cd /opt/categraf/conf
vi config.toml
# 编辑配置文件

启动

nohup ./categraf &> stdout.log &

4.1 在管控台修改标签

查看上报过来的监控对象
在这里插入图片描述

因为目前是采用服务器hostname进行标识的,有时候不好分辨,所以需要打备注一下

5、监控windowd服务器

wget https://github.com/flashcatcloud/categraf/releases/download/v0.3.76/categraf-v0.3.76-windows-amd64.zip
unzip categraf-v0.3.76-windows-amd64.zip

修改配置文件

conf/config.toml

启动
categraf.exe

6、导入监控大盘

在这里插入图片描述
在这里插入图片描述

7、配置报警

以邮箱告警为例子

先配置邮件地址

在这里插入图片描述
在这里插入图片描述

配置告警规则

在这里插入图片描述
当服务器失联的时候,会进行告警并发送邮件

在这里插入图片描述

  • 19
    点赞
  • 18
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值