Install Node Exporter

sansae@sansaeubuntu:~$ cd prometheus-course/scripts/
sansae@sansaeubuntu:~/prometheus-course/scripts$ ls
1-install.sh               5-install-mailserver.sh   install-consul-exporter.sh  reverse-proxy-mutual-tls.sh
2-node-exporter.sh         6-cloudwatch-exporter.sh  install-docker.sh           reverse-proxy.sh
3-install-grafana.sh       add-flask-app.sh          mutual-tls.sh               start-consul.sh
4-install-alertmanager.sh  add-spring-boot-app.sh    register-service.sh
sansae@sansaeubuntu:~/prometheus-course/scripts$
sansae@sansaeubuntu:~/prometheus-course/scripts$ sudo ./2-node-exporter.sh
--2021-04-28 06:15:56--  https://github.com/prometheus/node_exporter/releases/download/v0.16.0/node_exporter-0.16.0.linux-amd64.tar.gz
Resolving github.com (github.com)... 15.164.81.167
Connecting to github.com (github.com)|15.164.81.167|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://github-releases.githubusercontent.com/9524057/87c9e928-5869-11e8-9817-8e2ec2a2c679?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20210428%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20210428T061527Z&X-Amz-Expires=300&X-Amz-Signature=b86fc6ae5299b32af4c19077087eaa80aa43dc6a2d95cbff775492b37b49c632&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=9524057&response-content-disposition=attachment%3B%20filename%3Dnode_exporter-0.16.0.linux-amd64.tar.gz&response-content-type=application%2Foctet-stream [following]
--2021-04-28 06:15:56--  https://github-releases.githubusercontent.com/9524057/87c9e928-5869-11e8-9817-8e2ec2a2c679?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20210428%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20210428T061527Z&X-Amz-Expires=300&X-Amz-Signature=b86fc6ae5299b32af4c19077087eaa80aa43dc6a2d95cbff775492b37b49c632&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=9524057&response-content-disposition=attachment%3B%20filename%3Dnode_exporter-0.16.0.linux-amd64.tar.gz&response-content-type=application%2Foctet-stream
Resolving github-releases.githubusercontent.com (github-releases.githubusercontent.com)... 185.199.109.154, 185.199.108.154, 185.199.111.154, ...
Connecting to github-releases.githubusercontent.com (github-releases.githubusercontent.com)|185.199.109.154|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 5276312 (5.0M) [application/octet-stream]
Saving to: ‘node_exporter-0.16.0.linux-amd64.tar.gz.1’

node_exporter-0.16.0.linux-am 100%[=================================================>]   5.03M  10.3MB/s    in 0.5s

2021-04-28 06:15:57 (10.3 MB/s) - ‘node_exporter-0.16.0.linux-amd64.tar.gz.1’ saved [5276312/5276312]

node_exporter-0.16.0.linux-amd64/
node_exporter-0.16.0.linux-amd64/LICENSE
node_exporter-0.16.0.linux-amd64/node_exporter
node_exporter-0.16.0.linux-amd64/NOTICE
Created symlink /etc/systemd/system/multi-user.target.wants/node_exporter.service → /etc/systemd/system/node_exporter.service.
Setup complete.
Add the following lines to /etc/prometheus/prometheus.yml:

  - job_name: 'node_exporter'
    scrape_interval: 5s
    static_configs:
      - targets: ['localhost:9100']

sansae@sansaeubuntu:~/prometheus-course/scripts$ ps -eaf | grep node_ex
node_ex+  4597     1  0 06:15 ?        00:00:00 /usr/local/bin/node_exporter
sansae    4649  2421  0 06:16 pts/0    00:00:00 grep --color=auto node_ex
sansae@sansaeubuntu:~/prometheus-course/scripts$
sansae@sansaeubuntu:~/prometheus-course/scripts$ curl localhost:9100
<html>
                        <head><title>Node Exporter</title></head>
                        <body>
                        <h1>Node Exporter</h1>
                        <p><a href="/metrics">Metrics</a></p>
                        </body>
                        </html>

Run & Config Node exporter on Docker

sansae@sansaeubuntu:~/prometheus-course/scripts$ docker run -itd -p 9100:9100 --name exporter prom/node-exporter:latest
sansae@sansaeubuntu:~/prometheus-course/scripts$ docker rm -f prometheus
sansae@sansaeubuntu:~/prometheus-course/scripts$ docker run -d --name prometheus --link exporter -p 9090:9090 prom/prometheus
sansae@sansaeubuntu:~/prometheus-course/scripts$ docker exec -it prometheus sh
/prometheus $ vi /etc/prometheus/prometheus.yml

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  - job_name: 'node_exporter'
    scrape_interval: 5s
    static_configs:
    - targets: ['exporter:9100']
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/prometheus $ exit
sansae@sansaeubuntu:~/prometheus-course/scripts$ docker stop prometheus
prometheus
sansae@sansaeubuntu:~/prometheus-course/scripts$ docker start prometheus
prometheus
sansae@sansaeubuntu:~/prometheus-course/scripts$ curl ifconfig.me
20.194.55.215


  • No labels

0 Comments

You are not logged in. Any changes you make will be marked as anonymous. You may want to Log In if you already have an account.