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 use prometheus and grafana to monitor Kubernetes

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

Machine: 172.27.143.155

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 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

1. Prometheus installation:

1. Wget https://github.com/prometheus/prometheus/releases/download/v2.8.1/prometheus-2.8.1.linux-amd64.tar.gz

2. Tar-zxvf prometheus-2.8.1.linux-amd64.tar.gz-C / usr/local/

3 、 cd / usr/local

4 、 mv prometheus-2.8.1.linux-amd64/ prometheus

5 、 cd prometheus/

6. View the version

. / prometheus-- version

7. Modify the configuration file

Prometheus.yml

8. Make it a service service after completion

Vim / lib/systemd/system/prometheus.service

[Unit]

Description=Prometheus

Documentation= https://prometheus.io/

After=network.target

[Service]

Type=simple

User=root

ExecStart=/usr/local/prometheus/prometheus-config.file=/usr/local/prometheus/prometheus.yml-storage.tsdb.path=/home/software/prometheus-data

Restart=on-failure

[Install]

WantedBy=multi-user.target

And then just start it.

And then verify

Systemctl start prometheus

Http://172.27.143.155:9090/targets

Second, install grafana

1. Https://grafana.com/grafana/download

2. Wget https://dl.grafana.com/oss/release/grafana-6.5.2.linux-amd64.tar.gz

3. Tar-zxvf grafana-6.5.2.linux-amd64.tar.gz

4 、 mv grafana-6.5.2 / usr/local/grafana

5 、 cd / usr/local/grafana/bin

6. Nohup. / grafana-server &

Http://172.27.143.155:3000/

Account number and password are admin by default.

7. Configure the data source, which is Prometheus here

8. Import template ID number 193,

9. You can view the results when you are finished.

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