Jumat, 24 April 2020

How to install prometheus on centos 7

  Tidak ada komentar


Download Prometheus package
[root@app01 ~]# wget https://github.com/prometheus/prometheus/releases/download/v2.17.2/prometheus-2.17.2.linux-amd64.tar.gz
--2020-04-24 08:42:05--  https://github.com/prometheus/prometheus/releases/download/v2.17.2/prometheus-2.17.2.linux-amd64.tar.gz
Resolving github.com (github.com)... 52.74.223.119
Connecting to github.com (github.com)|52.74.223.119|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://github-production-release-asset-2e65be.s3.amazonaws.com/6838921/70e29d80-830b-11ea-91f7-0e535a551978?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20200424%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20200424T014206Z&X-Amz-Expires=300&X-Amz-Signature=842daed1a8eeda464238c85d29ffa4f97be6754b8d4a2d324df41e9707d86ff0&X-Amz-SignedHeaders=host&actor_id=0&repo_id=6838921&response-content-disposition=attachment%3B%20filename%3Dprometheus-2.17.2.linux-amd64.tar.gz&response-content-type=application%2Foctet-stream [following]
--2020-04-24 08:42:06--  https://github-production-release-asset-2e65be.s3.amazonaws.com/6838921/70e29d80-830b-11ea-91f7-0e535a551978?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20200424%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20200424T014206Z&X-Amz-Expires=300&X-Amz-Signature=842daed1a8eeda464238c85d29ffa4f97be6754b8d4a2d324df41e9707d86ff0&X-Amz-SignedHeaders=host&actor_id=0&repo_id=6838921&response-content-disposition=attachment%3B%20filename%3Dprometheus-2.17.2.linux-amd64.tar.gz&response-content-type=application%2Foctet-stream
Resolving github-production-release-asset-2e65be.s3.amazonaws.com (github-production-release-asset-2e65be.s3.amazonaws.com)... 52.216.204.235
Connecting to github-production-release-asset-2e65be.s3.amazonaws.com (github-production-release-asset-2e65be.s3.amazonaws.com)|52.216.204.235|:443... connected                                                                     .
HTTP request sent, awaiting response... 200 OK
Length: 60150384 (57M) [application/octet-stream]
Saving to: ‘prometheus-2.17.2.linux-amd64.tar.gz’

100%[======================================>] 60,150,384  3.06MB/s   in 21s

2020-04-24 08:42:30 (2.72 MB/s) - ‘prometheus-2.17.2.linux-amd64.tar.gz’ saved [60150384/60150384]

[root@app01 ~]# 
 Perform following command
[root@app01 ~]# useradd --no-create-home --shell /bin/false prometheus
[root@app01 ~]# mkdir /etc/prometheus
[root@app01 ~]# mkdir /var/lib/prometheus
[root@app01 ~]# chown prometheus:prometheus /etc/prometheus
[root@app01 ~]# chown prometheus:prometheus /var/lib/prometheus
Extract Prometheus package
[root@dp-wfh-app01 ~]# ls
anaconda-ks.cfg                       skema-prefork
check-mk-agent_1.6.0p10-1_all.deb     skema-prefork.tar
composer-setup.php                    skemaraja
L60464-1302TMP.html.gz                strace_dir
npm-debug.log                         update-source.sh
prometheus-2.17.2.linux-amd64.tar.gz
[root@dp-wfh-app01 ~]#
[root@dp-wfh-app01 ~]# tar -xzf prometheus-2.17.2.linux-amd64.tar.gz
[root@dp-wfh-app01 ~]# ls
anaconda-ks.cfg                    prometheus-2.17.2.linux-amd64.tar.gz
check-mk-agent_1.6.0p10-1_all.deb  skema-prefork
composer-setup.php                 skema-prefork.tar
L60464-1302TMP.html.gz             skemaraja
npm-debug.log                      strace_dir
prometheus-2.17.2.linux-amd64      update-source.sh
[root@dp-wfh-app01 ~]#
Rename the prometheus directory
[root@dp-wfh-app01 ~]# mv prometheus-2.17.2.linux-amd64 prometheuspackage
[root@dp-wfh-app01 ~]#
[root@dp-wfh-app01 ~]# cp prometheuspackage/prometheus /usr/local/bin/
[root@dp-wfh-app01 ~]# cp prometheuspackage/promtool /usr/local/bin/
[root@dp-wfh-app01 ~]#
[root@dp-wfh-app01 ~]# chown prometheus:prometheus /usr/local/bin/prometheus
[root@dp-wfh-app01 ~]# chown prometheus:prometheus /usr/local/bin/promtool
[root@dp-wfh-app01 ~]#
[root@dp-wfh-app01 ~]# cp -r prometheuspackage/consoles /etc/prometheus
[root@dp-wfh-app01 ~]# cp -r prometheuspackage/console_libraries /etc/prometheus                                                                     [root@dp-wfh-app01 ~]#
[root@dp-wfh-app01 ~]# vi /etc/prometheus/prometheus.yml
[root@dp-wfh-app01 ~]# chown prometheus:prometheus /etc/prometheus/prometheus.yml
[root@dp-wfh-app01 ~]#
[root@dp-wfh-app01 ~]# vi /etc/systemd/system/prometheus.service
[root@dp-wfh-app01 ~]# systemctl daemon-reload
[root@dp-wfh-app01 ~]#
Check prometheus service status and open the firewall
[root@app01 ~]# systemctl status prometheus
● prometheus.service - Prometheus
   Loaded: loaded (/etc/systemd/system/prometheus.service; disabled; vendor preset: disabled)
   Active: active (running) since Fri 2020-04-24 08:54:19 WIB; 12s ago
 Main PID: 25241 (prometheus)
   CGroup: /system.slice/prometheus.service
           └─25241 /usr/local/bin/prometheus --config.file /etc/prometheus/prometheus.yml --storage.tsdb.path /var/lib/prometheus/ --web.console.t...

Apr 24 08:54:19 app01 prometheus[25241]: level=info ts=2020-04-24T01:54:19.847Z caller=main.go:667 msg="Starting TSDB ..."
Apr 24 08:54:19 app01 prometheus[25241]: level=info ts=2020-04-24T01:54:19.847Z caller=web.go:515 component=web msg="Start listenin...0.0:9090
Apr 24 08:54:19 app01 prometheus[25241]: level=info ts=2020-04-24T01:54:19.849Z caller=head.go:575 component=tsdb msg="replaying WA... awhile"
Apr 24 08:54:19 app01 prometheus[25241]: level=info ts=2020-04-24T01:54:19.851Z caller=head.go:624 component=tsdb msg="WAL segment ...egment=0
Apr 24 08:54:19 app01 prometheus[25241]: level=info ts=2020-04-24T01:54:19.851Z caller=head.go:627 component=tsdb msg="WAL replay c...279231ms
Apr 24 08:54:19 app01 prometheus[25241]: level=info ts=2020-04-24T01:54:19.852Z caller=main.go:683 fs_type=XFS_SUPER_MAGIC
Apr 24 08:54:19 app01 prometheus[25241]: level=info ts=2020-04-24T01:54:19.852Z caller=main.go:684 msg="TSDB started"
Apr 24 08:54:19 app01 prometheus[25241]: level=info ts=2020-04-24T01:54:19.852Z caller=main.go:788 msg="Loading configuration file"...heus.yml
Apr 24 08:54:29 app01 prometheus[25241]: level=info ts=2020-04-24T01:54:29.251Z caller=main.go:816 msg="Completed loading of config...heus.yml
Apr 24 08:54:29 app01 prometheus[25241]: level=info ts=2020-04-24T01:54:29.251Z caller=main.go:635 msg="Server is ready to receive ...quests."
Hint: Some lines were ellipsized, use -l to show in full.
[root@app01 ~]#
[root@app01 ~]# firewall-cmd --zone=public --add-port=9090/tcp --permanent
success
[root@app01 ~]# firewall-cmd --reload
success
[root@app01 ~]#
[root@app01 ~]#

Tidak ada komentar :

Posting Komentar