当前位置:网站首页>Consumption monitoring of Prometheus monitoring [consult exporter]

Consumption monitoring of Prometheus monitoring [consult exporter]

2022-06-22 16:26:00 IChen.

1. brief introduction

Consul There are multiple components , But overall , It is a service discovery and configuration tool in the infrastructure . It provides several key functions :
Service discovery :Consul client Can provide services , for example api or mysql, You can also use Consul client To discover the provider of the specified service . Use DNS or HTTP, Applications can easily find the services they depend on .
health examination :Consul client Any number of health checks can be provided , Or with a given service (“Web Whether the server returns 200 OK”), Or with local nodes (“ Whether the memory utilization is lower than 90%”) Related to . You can use this information to monitor cluster health , The service discovery component uses this information to remove traffic from the host in question .
KV Store: Applications can use Consul Hierarchical key / Value store , Including dynamic configuration , Functional markers , Coordinate ,leader Elections and so on . ordinary HTTP API Make it easy to use .
Multi-data center :Consul Support multiple data centers . It means Consul Users of don't have to worry about building additional abstraction layers to extend to multiple areas

2. Deploy

docker run -tid --restart=always  -p 9107:9107 --name consul-expoter prom/consul-exporter:latest --consul.server=172.19.209.51:8500

The dynamic log is as follows :

level=info caller=consul_exporter.go:486 msg=“Starting consul_exporter” version=“(version=0.7.1, branch=HEAD, revision=ae46e2ea980ecf1c961bf332b71160be707b5e98)”
zevel=info caller=consul_exporter.go:487 build_context=“(go=go1.14.6, [email protected], date=20200721-15:34:41)”
level=info caller=consul_exporter.go:538 msg=“Listening on address” address=:9107

Default listening 9107 port , visit http://localhost:9107 You can see :
 Insert picture description here

3.Prometheus Grab metrics

  - job_name: consul-exporter
    static_configs:
      - targets: ['172.19.209.51:9107']

4. Import Dashboard

recommend :Consul Exporter Dashboard

ID yes 12049.

Displays the total number of services ,Consul Peer Quantity and sum Leader Number 、 Unhealthy Consul service 、Consul Service and service detection information .

 Insert picture description here

5. Configure alarm rules

Consul whether Down
The configuration file consul_exporter_alerting_rules.yml as follows :

groups:
- name: consul
  rules:
  - alert: ConsulDown
    annotations:
      description: |-
        Consul instance is down
          VALUE = {
    {
     $value }}
          LABELS: {
    {
     $labels }}
      summary: Consul down (instance {
    {
     $labels.instance }})
    expr: consul_up == 0
    for: 5m
    labels:
      severity: critical

prometheus.yml The configuration is as follows :

rule_files:

  • “consul_exporter_alerting_rules.yml”

Stop Consul, You can see the following alarms :

 Insert picture description here

start-up Consul, The alarm disappears .

 Insert picture description here

原网站

版权声明
本文为[IChen.]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/173/202206221512069643.html