Prometheus : Add Monitoring Target2020/07/17 |
Add Monitoring Target Nodes.
|
|
[1] | Install [node-exporter] package on the Node you'd like to add that includes features to get metric data of general resource on the System like CPU or Memory usage. |
[root@node01 ~]# cat > /etc/yum.repos.d/prometheus.repo <<'EOF'
[prometheus]
name=prometheus
baseurl=https://packagecloud.io/prometheus-rpm/release/el/$releasever/$basearch
repo_gpgcheck=1
enabled=1
gpgkey=https://packagecloud.io/prometheus-rpm/release/gpgkey
https://raw.githubusercontent.com/lest/prometheus-rpm/master/RPM-GPG-KEY-prometheus-rpm
gpgcheck=1
metadata_expire=300
EOF
[root@node01 ~]#
[root@node01 ~]# dnf -y install node_exporter systemctl enable --now node_exporter
|
[2] | If Firewalld is running, allow ports. |
[root@node01 ~]# firewall-cmd --add-port=9100/tcp --permanent success [root@node01 ~]# firewall-cmd --reload success |
[3] | Add setting on Prometheus Server Configuration. |
[root@dlp ~]#
vi /etc/prometheus/prometheus.yml # line 33: add new Host to [targets] line - job_name: node static_configs: - targets: ['localhost:9100', 'node01.srv.world:9100'] # alternatively, if you'd like to add to another group, # add [job_name] section like follows # any name is OK for [job_name] - job_name: Hiroshima static_configs: - targets: ['node01.srv.world:9100'][root@dlp ~]# systemctl restart prometheus
|
[4] | Access to the Prometheus Web UI and click [Status] - [Targets] to verify new nodes are listed. |
[5] | To input query directly, it's possbile to display specific Job or Node. The example below shows a Job for [node_load5]. ⇒ node_load5{job="Hirosima"} |
[6] | The example below shows a Node for [node_procs_running]. ⇒ node_procs_running{instance=~"node01.*"} |
Sponsored Link |
|