Get the App
SLTechnology News&Howtos  ›  Servers  › 

Prometheus monitors liunx host

Shulou Source: shulou.com Published: 2022-06-03 09:45:29 09月21日 Update

Exporter is used in liunx basic resource monitoring

What is exporter?

Exporter is a component that collects monitoring data and provides data through prometheus monitoring. Exporter mainly obtains monitoring data through monitoring-related interfaces provided by monitored objects.

Installation and deployment

Wget https://github.com/prometheus/node_exporter/releases/download/v0.18.1/node_exporter-0.18.1.linux-amd64.tar.gz

Install to the corresponding directory

Make standard startup service

Cat / etc/systemd/system/node_ exporter.service[Unit] Description=node_ export[Service] ExecStart=/op/xxx/node_ export[Install] WantedBy=multi-user.target

Start

Systemctl enable node_exporter.service

Systemctl start node_exporter.service

Add host information in prometheus server

Scrape_configs: # The job name is added as a label `job= `to any timeseries scraped from this config. -job_name: 'shanghai' static_configs:-targets: [' x.x.x.xblog 90'] relabel_configs:-action: replace source_labels: ['job'] regex: (. *) replacement: $1 target_label: idc-job_name:' node1' static_configs:-targets: ['x.x.x.xpur9100']

Restart prometheus or reload the configuration file kill-hup $pid

Check whether the monitoring is in effect

Common monitoring items in exporter

Node_disk disk

Node_cpu cpu

Node_memory memory

Node_network network

Node_load1 system load

Commonly used query statements

Cpu utilization rate

Avg by (instance) (irate (node_cpu {instance= "xxx:9100", mode= "idle"} [5m])) * 100)

Average machine load

Network card receiving

Sum (rate (node_network_receive_bytes_total {instance= "xxx:9100", job= "server", lo = "lo"} [5m]))

Output of network card

Sum (rate (node_network_transmit_bytes {instance= "xxx:9100", job= "server", lo = "lo"} [5m]))

System load

Node_load1 {instance= "xxx:9100"} / / 1 minute load

Node_load5 {instance= "xxx:9100"} / / 5-minute load

Node_load15 {instance= "xxx:9100"} / / 15-minute load

Memory utilization

Round ((node_memory_MemTotal_bytes- (node_memory_MemFree_bytes+node_memory_Buffers_bytes+node_memory_Cached_bytes)) / node_memory_MemTotal_bytes * 100)

Tags: Monitoring data utilization memory system network card host information foundation object common query common interface file machine standard directory disk component Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi Xiaomi MariaDB vpn Shulou Information