在CentOS 8 / RHEL 8上安装Sensu Go监视工具

这是续集。
您可以通过以下链接以PDF格式下载本文,以为我们提供支持。

将指南下载为PDF


这是续集。

这是续集。
这是续集。

Sensu是一个开源监视工具,可以监视公共,私有,混合云和基于容器的基础架构环境。 Sensu旨在成为一个简单,可扩展和灵活的框架,使您可以根据业务需求自定义监视。本指南描述了在CentOS 8 / RHEL 8 Linux机器上安装Sensu Go监视工具。

Sensu架构

Sensu在服务器-客户端模型上运行,其中所有受监视的系统都运行sensu客户端软件。该客户端应用程序负责执行本地检查,管理客户端订阅和注册以及执行Sensu服务器请求的检查。

在CentOS 8 / RHEL 8上安装Sensu Go

Sensu监视工具分为三个主要部分。

Sensu架构图

步骤1:在CentOS 8 / RHEL 8上安装Sensu后端

添加后端存储库。

curl -s https://packagecloud.io/install/repositories/sensu/stable/script.rpm.sh | sudo bash

如果存储库安装成功,则输出将是:

Complete!
Generating yum cache for sensu_stable...
Importing GPG key 0x0A3F7426:
 Userid     : "https://packagecloud.io/sensu/stable (https://packagecloud.io/docs#gpg_signing) <[email protected]>"
 Fingerprint: CB16 05C4 E988 C91F 4382 49E3 A5BC 3FB7 0A3F 7426
 From       : https://packagecloud.io/sensu/stable/gpgkey
Generating yum cache for sensu_stable-source...

The repository is setup! You can now install packages.
..

添加存储库后,在CentOS 8 / RHEL 8上安装Sensu后端。

sudo yum install sensu-go-backend

接受安装提示。

Dependencies resolved.
========================================================================================================================================================
 Package                                 Architecture                  Version                                Repository                           Size
========================================================================================================================================================
Installing:
 sensu-go-backend                        x86_64                        5.20.1-12427                           sensu_stable                         14 M

Transaction Summary
========================================================================================================================================================
Install  1 Package

Total download size: 14 M
Installed size: 38 M
Is this ok [y/N]: y

步骤2:在CentOS 8 / RHEL 8上配置Sensu后端

从文档中复制配置模板。

sudo curl -L https://docs.sensu.io/sensu-go/latest/files/backend.yml -o /etc/sensu/backend.yml

根据自己的喜好进行编辑:

sudo vi /etc/sensu/backend.yml

这是我的配置:

---
# Sensu backend configuration

# backend configuration
state-dir: "/var/lib/sensu/sensu-backend"
cache-dir: "/var/cache/sensu/sensu-backend"
config-file: "/etc/sensu/backend.yml"
debug: false
log-level: "debug" # available log levels: panic, fatal, error, warn, info, debug

##
# agent configuration
##
agent-port: 8081

##
# api configuration
##
api-listen-address: "[::]:8080" # listen on all IPv4 and IPv6 addresses
#api-url: "http://localhost:8080"

##
# dashboard configuration
##
#dashboard-cert-file: "/path/to/ssl/cert.pem"
#dashboard-key-file: "/path/to/ssl/key.pem"
dashboard-host: "[::]" # listen on all IPv4 and IPv6 addresses
dashboard-port: 3000

##
# ssl configuration
##
#cert-file: "/path/to/ssl/cert.pem"
#key-file: "/path/to/ssl/key.pem"
#trusted-ca-file: "/path/to/trusted-certificate-authorities.pem"
#insecure-skip-tls-verify: false

##
# store configuration
##
#etcd-advertise-client-urls: "http://localhost:2379"
#etcd-cert-file: "/path/to/ssl/cert.pem"
#etcd-client-cert-auth: false
#etcd-initial-advertise-peer-urls: "http://127.0.0.1:2380"
#etcd-initial-cluster: "default=http://127.0.0.1:2380"
#etcd-initial-cluster-state: "new" # new or existing
#etcd-initial-cluster-token: "sensu"
#etcd-key-file: "/path/to/ssl/key.pem"
#etcd-listen-client-urls: "http://127.0.0.1:2379"
#etcd-listen-peer-urls: "http://127.0.0.1:2380"
#etcd-name: "default"
#etcd-peer-cert-file: "/path/to/ssl/cert.pem"
#etcd-peer-client-cert-auth: false
#etcd-peer-key-file: "/path/to/ssl/key.pem"
#etcd-peer-trusted-ca-file: "/path/to/ssl/key.pem"
#etcd-trusted-ca-file: "/path/to/ssl/key.pem"
#no-embed-etcd: false
#etcd-cipher-suits
#  - TLS_EXAMPLE

有关配置选项的完整列表,请参见 后端参考..

启动Sensu后端服务。

sudo systemctl enable --now  sensu-backend

检查服务状态。

systemctl status sensu-backend
● sensu-backend.service - The Sensu Backend service.
   Loaded: loaded (/usr/lib/systemd/system/sensu-backend.service; enabled; vendor preset: disabled)
   Active: active (running) since Tue 2020-05-19 21:45:05 CEST; 14s ago
 Main PID: 2194 (sensu-backend)
    Tasks: 11 (limit: 26213)
   Memory: 25.8M
   CGroup: /system.slice/sensu-backend.service
           └─2194 /usr/sbin/sensu-backend start -c /etc/sensu/backend.yml

May 19 21:45:11 cent8.computingforgeeks.com sensu-backend[2194]: {"backend_id":"861176a0-1874-4007-be62-c41f1b048dfe","component":"metricsd","level":"d>
May 19 21:45:12 cent8.computingforgeeks.com sensu-backend[2194]: {"backend_id":"861176a0-1874-4007-be62-c41f1b048dfe","component":"metricsd","level":"d>
May 19 21:45:13 cent8.computingforgeeks.com sensu-backend[2194]: {"backend_id":"861176a0-1874-4007-be62-c41f1b048dfe","component":"metricsd","level":"d>
May 19 21:45:16 cent8.computingforgeeks.com sensu-backend[2194]: {"component":"cache","level":"debug","msg":"rebuilding the cache for resource type *v2>
May 19 21:45:16 cent8.computingforgeeks.com sensu-backend[2194]: {"component":"cache","level":"debug","msg":"rebuilding the cache for resource type *v2>
May 19 21:45:16 cent8.computingforgeeks.com sensu-backend[2194]: {"component":"cache","level":"debug","msg":"rebuilding the cache for resource type *v2>
May 19 21:45:16 cent8.computingforgeeks.com sensu-backend[2194]: {"component":"tessend","level":"debug","metric_name":"auth_provider_count","metric_val>
May 19 21:45:16 cent8.computingforgeeks.com sensu-backend[2194]: {"backend_id":"861176a0-1874-4007-be62-c41f1b048dfe","component":"metricsd","level":"d>
May 19 21:45:17 cent8.computingforgeeks.com sensu-backend[2194]: {"backend_id":"861176a0-1874-4007-be62-c41f1b048dfe","component":"metricsd","level":"d>
May 19 21:45:18 cent8.computingforgeeks.com sensu-backend[2194]: {"backend_id":"861176a0-1874-4007-be62-c41f1b048dfe","component":"metricsd","level":"d>

步骤3:初始化Sensu后端

接下来,您需要为Sensu管理员设置用户名和密码。通过运行以下命令来初始化Sensu后端:

export SENSU_BACKEND_CLUSTER_ADMIN_USERNAME=admin
export [email protected]
sensu-backend init 

命令执行输出:

{"component":"backend.seeds","level":"info","msg":"seeding etcd store with intial data","time":"2020-05-19T21:50:07+02:00"}

如果要响应用户名和密码提示,也可以以交互方式运行sensu-backend init命令。

sensu-backend init --interactive

欲获得更多信息 后端后端初始化,请参阅 后端参考 文档。

步骤4:访问Sensu仪表板

Sensu Web UI提供了受监视事件的统一视图以及易于使用的工具,可减少警报疲劳。

确保UI服务端口已打开。

$ sudo ss -tunelp | grep 3000
tcp   LISTEN  0       128                         *:3000                *:*      users:(("sensu-backend",pid=2194,fd=18)) uid:994 ino:27800 sk:a v6only:0 <->   

查询API运行状况以查看后端是否已启动并正在运行。

$ curl http://127.0.0.1:8080/health
{"Alarms":null,"ClusterHealth":[{"MemberID":9882886658148554927,"MemberIDHex":"8927110dc66458af","Name":"default","Err":"","Healthy":true}],"Header":{"cluster_id":4255616304056076734,"member_id":9882886658148554927,"raft_term":2}}

如果您有活动的防火墙服务,请允许端口3000。

sudo firewall-cmd --add-port=3000/tcp --permanent
sudo firewall-cmd --reload

打开浏览器,并访问位于http://本地主机:3000或http:// server_ip_or_hostname:3000的Sensu仪表板。

在CentOS 8 / RHEL 8上安装Sensu Go监视工具

使用您先前设置的凭据登录。

在CentOS 8 / RHEL 8上安装Sensu Go监视工具

以下指南介绍了Sensu Agent和sensuctl命令行工具的安装。

参考

监控细节:

在CentOS / RHEL 8上安装Nagios 4

如何在RHEL / CentOS 8上安装Cacti

如何在RHEL / CentOS 8上安装Zabbix服务器

如何在RHEL / CentOS 8上安装Netdata

在RHEL / CentOS 8上安装和配置Telegraf

如何在RHEL / CentOS 8上安装Prometheus

如何在RHEL 8上安装Grafana

这是续集。
您可以通过以下链接以PDF格式下载本文,以为我们提供支持。

将指南下载为PDF


这是续集。

这是续集。
这是续集。

Sidebar