o/s
1 2 |
[root@www ~]# cat /etc/redhat-release Rocky Linux release 8.8 (Green Obsidian) |
1. node_exporter download
1 2 3 4 5 |
[root@www ~]# wget https://github.com/prometheus/node_exporter/releases/download/v1.8.1/node_exporter-1.8.1.linux-amd64.tar.gz [root@www ~]# tar xvfz node_exporter-1.8.1.linux-amd64.tar.gz [root@www ~]# mv node_exporter-1.8.1.linux-amd64/node_exporter /usr/local/bin/ |
2. 서비스 시작 파일 생성
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
[root@www ~]# vi /etc/systemd/system/node_exporter.service [Unit] Description=Node Exporter Wants=network-online.target After=network-online.target [Service] User=root Group=root Type=simple ExecStart=/usr/local/bin/node_exporter [Install] WantedBy=multi-user.target |
3. 서비스 등록 및 시작 및 상태 확인
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
[root@www ~]# systemctl daemon-reload ### 서비스 시작시 활성 [root@www ~]# systemctl enable node_exporter.service Created symlink /etc/systemd/system/multi-user.target.wants/node_exporter.service → /etc/systemd/system/node_exporter.service. ### 서비스 시작 [root@www ~]# systemctl start node_exporter.service ### 상태확인 [root@www ~]# systemctl status node_exporter.service ● node_exporter.service - Node Exporter Loaded: loaded (/etc/systemd/system/node_exporter.service; enabled; vendor preset: disabled) Active: active (running) since Thu 2023-10-05 17:00:03 KST; 4s ago Main PID: 2950385 (node_exporter) Tasks: 5 (limit: 100403) Memory: 5.1M CGroup: /system.slice/node_exporter.service └─2950385 /usr/local/bin/node_exporter 10월 05 17:00:03 www.icomis.com node_exporter[2950385]: ts=2023-10-05T08:00:03.975Z caller=node_exporter.go:117 level=info collector=thermal_zone 10월 05 17:00:03 www.icomis.com node_exporter[2950385]: ts=2023-10-05T08:00:03.975Z caller=node_exporter.go:117 level=info collector=time 10월 05 17:00:03 www.icomis.com node_exporter[2950385]: ts=2023-10-05T08:00:03.975Z caller=node_exporter.go:117 level=info collector=timex |
4. 포트 확인
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
[root@www ~]# netstat -anp | grep node tcp6 0 0 :::9100 :::* LISTEN 2950385/node_export unix 3 [ ] STREAM CONNECTED 9904588 2950385/node_export [root@www ~]# curl localhost:9100 <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Node Exporter</title> <style>body { font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,Liberation Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji; margin: 0; } header { background-color: #e6522c; color: #fff; font-size: 1rem; padding: 1rem; } main { padding: 1rem; } label { display: inline-block; width: 0.5em; } </style> </head> <body> <header> <h1>Node Exporter</h1> </header> <main> <h2>Prometheus Node Exporter</h2> <div>Version: (version=1.6.1, branch=HEAD, revision=4a1b77600c1873a8233f3ffb55afcedbb63b8d84)</div> <div> <ul> <li><a href="/metrics">Metrics</a></li> </ul> </div> </main> </body> </html> |
5. 웹페이지에서 확인
7. prometheus 파일에 해당 서버 추가
1 2 3 4 5 6 |
[root@xinet ~]# vi /usr/local/prometheus/prometheus.yml - job_name: "rocky_linux_server" static_configs: - targets: ["192.168.1.10:9100"] |
8. granfana 에서 대시보드 확인