LinkedNestBlog

Prometheus Installation & Configuration

by Dev Jinwon

Installation & Configuration


Installation

[hPlatform@qa ~]$ wget https://github.com/prometheus/prometheus/releases/download/v2.29.2/prometheus-2.29.2.linux-amd64.tar.gz

Installation Logs

--2022-01-28 17:35:18--  https://github.com/prometheus/prometheus/releases/download/v2.29.2/prometheus-2.29.2.linux-amd64.tar.gz
Resolving github.com... 20.205.243.166
Connecting to github.com|20.205.243.166|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://objects.githubusercontent.com/github-production-release-asset-2e65be/6838921/17d3d453-5a8e-47aa-844f-d4ff56f5c1cb?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20220128%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20220128T093519Z&X-Amz-Expires=300&X-Amz-Signature=8afefa7c2a85e587ec256d43f426ab47aa01cb12c4c2088350f86798fed848df&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=6838921&response-content-disposition=attachment%3B%20filename%3Dprometheus-2.29.2.linux-amd64.tar.gz&response-content-type=application%2Foctet-stream [following]
--2022-01-28 17:35:19--  https://objects.githubusercontent.com/github-production-release-asset-2e65be/6838921/17d3d453-5a8e-47aa-844f-d4ff56f5c1cb?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20220128%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20220128T093519Z&X-Amz-Expires=300&X-Amz-Signature=8afefa7c2a85e587ec256d43f426ab47aa01cb12c4c2088350f86798fed848df&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=6838921&response-content-disposition=attachment%3B%20filename%3Dprometheus-2.29.2.linux-amd64.tar.gz&response-content-type=application%2Foctet-stream
Resolving objects.githubusercontent.com... 185.199.108.133, 185.199.109.133, 185.199.110.133, ...
Connecting to objects.githubusercontent.com|185.199.108.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 73175122 (70M) [application/octet-stream]
Saving to: “prometheus-2.29.2.linux-amd64.tar.gz”

100%[=======================================================================================================================================>] 73,175,122  14.9M/s   in 4.7s

2022-01-28 17:35:24 (14.9 MB/s) - “prometheus-2.29.2.linux-amd64.tar.gz” saved [73175122/73175122]

Unzip tar.gz file

[hPlatform@qa ~]$ tar -xzvf prometheus-2.29.2.linux-amd64.tar.gz
prometheus-2.29.2.linux-amd64/
prometheus-2.29.2.linux-amd64/consoles/
prometheus-2.29.2.linux-amd64/consoles/index.html.example
prometheus-2.29.2.linux-amd64/consoles/node-cpu.html
prometheus-2.29.2.linux-amd64/consoles/node-disk.html
prometheus-2.29.2.linux-amd64/consoles/node-overview.html
prometheus-2.29.2.linux-amd64/consoles/node.html
prometheus-2.29.2.linux-amd64/consoles/prometheus-overview.html
prometheus-2.29.2.linux-amd64/consoles/prometheus.html
prometheus-2.29.2.linux-amd64/console_libraries/
prometheus-2.29.2.linux-amd64/console_libraries/menu.lib
prometheus-2.29.2.linux-amd64/console_libraries/prom.lib
prometheus-2.29.2.linux-amd64/prometheus.yml
prometheus-2.29.2.linux-amd64/LICENSE
prometheus-2.29.2.linux-amd64/NOTICE
prometheus-2.29.2.linux-amd64/prometheus
prometheus-2.29.2.linux-amd64/promtool

Change(move) directory name

[hPlatform@qa ~]$ mv prometheus-2.29.2.linux-amd64 prometheus

Check directory name

[hPlatform@qa ~]$ ll
total 102468
...
drwxr-xr-x.  4 hPlatform hPlatform     4096 Aug 27 17:56 prometheus
-rw-rw-r--.  1 hPlatform hPlatform 73175122 Dec  8 14:04 prometheus-2.29.2.linux-amd64.tar.gz
...

Execute

[hPlatform@qa] cd ~/promemtheus
[hPlatform@qa prometheus]$ ./prometheus --config.file=prometheus.yml --storage.tsdb.path=data

Check Port Listening

[hPlatform@qa ~]$ netstat -lntup | grep prometheus
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
tcp        0      0 :::9090                     :::*                        LISTEN      20406/./prometheus

Access

http://{ip}:9090


Installation Node Exporter

[hPlatform@qa ~]$ wget https://github.com/prometheus/node_exporter/releases/download/v1.2.2/node_exporter-1.2.2.linux-amd64.tar.gz
--2022-01-28 17:55:38--  https://github.com/prometheus/node_exporter/releases/download/v1.2.2/node_exporter-1.2.2.linux-amd64.tar.gz
Resolving github.com... 20.205.243.166
Connecting to github.com|20.205.243.166|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://objects.githubusercontent.com/github-production-release-asset-2e65be/9524057/28598a7c-d8ad-483d-85ba-8b2c9c08cf57?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20220128%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20220128T095538Z&X-Amz-Expires=300&X-Amz-Signature=8d74cf681c3a8b933080420ef4947629aa1b3c27b32b0adf60092b3207f54348&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=9524057&response-content-disposition=attachment%3B%20filename%3Dnode_exporter-1.2.2.linux-amd64.tar.gz&response-content-type=application%2Foctet-stream [following]
--2022-01-28 17:55:38--  https://objects.githubusercontent.com/github-production-release-asset-2e65be/9524057/28598a7c-d8ad-483d-85ba-8b2c9c08cf57?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20220128%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20220128T095538Z&X-Amz-Expires=300&X-Amz-Signature=8d74cf681c3a8b933080420ef4947629aa1b3c27b32b0adf60092b3207f54348&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=9524057&response-content-disposition=attachment%3B%20filename%3Dnode_exporter-1.2.2.linux-amd64.tar.gz&response-content-type=application%2Foctet-stream
Resolving objects.githubusercontent.com... 185.199.110.133, 185.199.109.133, 185.199.111.133, ...
Connecting to objects.githubusercontent.com|185.199.110.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 8898481 (8.5M) [application/octet-stream]
Saving to: “node_exporter-1.2.2.linux-amd64.tar.gz”

100%[=======================================================================================================================================>] 8,898,481   12.3M/s   in 0.7s

2022-01-28 17:55:40 (12.3 MB/s) - “node_exporter-1.2.2.linux-amd64.tar.gz” saved [8898481/8898481]

Unzip file for Node Exporter

[hPlatform@qa ~]$ tar -xzvf node_exporter-1.2.2.linux-amd64.tar.gz
node_exporter-1.2.2.linux-amd64/
node_exporter-1.2.2.linux-amd64/LICENSE
node_exporter-1.2.2.linux-amd64/NOTICE
node_exporter-1.2.2.linux-amd64/node_exporter

Change(Move) Directory Name For Node Exporter

[hPlatform@qa ~]$ mv node_exporter-1.2.2.linux-amd64 node_exporter
[hPlatform@qa ~]$ ll
total 111164
...
drwxr-xr-x.  2 hPlatform hPlatform     4096 Aug  6 21:50 node_exporter
-rw-rw-r--.  1 hPlatform hPlatform  8898481 Dec  8 16:52 node_exporter-1.2.2.linux-amd64.tar.gz
drwxr-xr-x.  5 hPlatform hPlatform     4096 Jan 28 17:48 prometheus
-rw-rw-r--.  1 hPlatform hPlatform 73175122 Dec  8 14:04 prometheus-2.29.2.linux-amd64.tar.gz
...

Execute Node Exporter

[hPlatform@qa ~]$ /home/hPlatform/node_exporter/node_exporter

Check Port Listening For Node Exporter

[hPlatform@qa ~]$ netstat -lntup | grep node
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
tcp        0      0 :::9100                     :::*                        LISTEN      20899/node_exporter

Add Node Exporter's Info on prometheus.yml(/home/hPlatform/prometheus/prometheus.yml)

  - job_name: "prometheus"
    static_configs:
      - targets: ["localhost:9100"]

Restart Prometheus

[hPlatform@qa prometheus]$ ./prometheus --config.file=prometheus.yml --storage.tsdb.path=data

Access Prometheus Svr.

http://{IP}:9090/graph

Access Prometheus Node Exporter Svr.

http://{Node Exporter's IP}:9100/metrics




Prometheus Installation & Configuration · LinkedNest Blog