Prometheus PromSQL acquisition system service status

Prometheus PromSQL acquisition system service status

: Use systemd collector
". +" --Collector.systemd.unit-whitelist = systemd positively circulated from the matching unit
--collector.systemd.unit-whitelist = "(docker | sshd | nginx) .service" white list, collection target

# Monitoring Service Status 
/ usr / bin / node_exporter --collector.systemd --collector.systemd.unit -whitelist = (docker | sshd | nginx) .service

 

Node end modify the startup configuration

1, modify the startup configuration, add the parameter: vim /usr/lib/systemd/system/node_exporter.service

[Unit]
Description=https://prometheus.io

[Service]
Restart=on-failure
ExecStart=/usr/local/node_exporter/node_exporter --collector.systemd --collector.systemd.unit-whitelist=(docker|sshd|nginx).service

[Install]
WantedBy=multi-user.target

2, load the configuration restart the service

systemctl daemon-reload
systemctl restart node_exporter

 

View Node monitoring client service

1, view the service through promSQL

node_systemd_unit_state

2, see docker service runs several states

node_systemd_unit_state{instance="47.98.138.176:9100",job="node",name="docker.service"}

 

Guess you like

Origin www.cnblogs.com/xiangsikai/p/11289276.html