Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install and deploy Prometheus Monitoring

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

Prometheus introduction

Prometheus is an open source system monitoring and alarm toolkit, and Prometheus joined the Cloud Native Computing Foundation in 2016 as the second project after Kubernetes.

The main features of Prometheus are:

A multidimensional data model in which time series data is identified by measurement names and key / value pairs

PromQL is a flexible query language that can take advantage of this dimension

Does not rely on distributed storage; a single server node is autonomous

Time series collection is carried out through the pull model on HTTP.

Support push of time series through intermediate gateway

Discover targets through service discovery or static configuration

Multi-mode drawing and dashboard support

Architecture diagram

module

The prometheus server side is responsible for regularly fetching metrics (indicator) data on the target, and each target needs to expose a http service interface for prometheus timing crawling. This way of calling monitoring objects to obtain monitoring data is called pull.

The prometheus client side generates the corresponding metrics for the service to be monitored and exposes it to Prometheus server.

Push Gateway: mainly used for short-term jobs. Because this type of jobs exists for a short time, it may be found in the

Prometheus disappeared before he came to pull. To do this, jobs can push their metrics directly to the Prometheus server side this time. This method is mainly used for metrics at the service level, and node exporter is required for metrices at the machine level.

Exporters: supports services such as HAProxy,StatsD,Graphite,Redis

Alertmanager: after receiving the alerts from the Prometheus server side, it will remove the duplicate data, packet, and route to the receiving mode, and issue an alarm. The common receiving methods are: e-mail, pagerduty,OpsGenie, webhook and so on.

Core concepts of prometheus

1. Indicators

All the monitoring indicators (Metric) of prometheus are uniformly defined as

{=,.}

The metric name describes the meaning of the metric, for example, the total number of requests for which tcp_request_total represents tcp

The metric name must consist of letters, numerical underscores or colons, and conform to the regular expression

Such as [a-zA-Z:] [a-zA-Z0-9:] *.

Tags (label) for filtering and aggregation

2. Data acquisition

Prometheus collects monitoring data by pull, which is different from that by push.

In push mode, agent actively reports data, and the collected data can be reported to the monitoring center immediately. The collected data will not be saved locally in push mode. Agent itself is a stateless service, and master needs to maintain various agent states.

Pull master actively pulls agent data and periodically collects data for 30s or more.

Agent itself requires a certain amount of data storage capacity, and master is only responsible for simple data pull.

3. Data processing

Prometheus supports data processing, including relabel, replace, keep, drop

4. Data storage

Prometheus supports both local storage and remote storage

5. Data query

Prometheus uses promQL query

6. Alarm

Prometheus itself will not handle the alarm, it needs a component alertmanager, and prometheus will configure the alertmanager address, so that the alarm record issued by prometheus can be sent to alertmanager for processing.

Deployment mode

Binary deployment download

Wget https://github.com/prometheus/prometheus/releases/download/v2.14.0/prometheus-2.14.0.linux-amd64.tar.gz

Tar zxf prometheus-2.14.0.linux-amd64.tar.gz & & cd prometheus

Modify the configuration file

Scrape_configs:

The job name is added as a label job= to any timeseries scraped from this config.

Job_name: 'prometheus'

Metrics_path defaults to'/ metrics'

Scheme defaults to 'http'.

Static_configs:

Targets: ['localhost:9090'] # default localhost

Start prometheus

Nohup / opt/prometheus/prometheus-- config.file=prometheus.yml &

Visit

Http://localhost:9090/graph

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report