Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
AbahDoku Custom
Serba-serbi Windows
AbahDoku Wiki
Search
Search
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Monitoring Server
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Special pages
Page information
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=Install Prometheus= ==Download Prometheus== Download package prometheus di url https://prometheus.io/download/, caranya copy link url package untuk linux di https://github.com/prometheus/prometheus/releases/download/v2.48.0-rc.0/prometheus-2.48.0-rc.0.linux-amd64.tar.gz. Masuk ke server kemudian paste setelah command wget, atau command lengkatnya adalah berikut ini : wget https://github.com/prometheus/prometheus/releases/download/v2.48.0-rc.0/prometheus-2.48.0-rc.0.linux-amd64.tar.gz tunggu proses downloadnya selesai ==Menyiapkan Prometheus== Extract prometheus yang sudah di download dengan command berikut : tar xvf prometheus-2.48.0-rc.0.linux-amd64.tar.gz tunggu proses extract sampai selesai, jalan ls -l, maka akan keluhatan folder baru dengan nama prometheus-2.48.0-rc.0.linux-amd64. Masuk ke folder prometheus-2.48.0-rc.0.linux-amd64 : cd prometheus-2.48.0-rc.0.linux-amd64 jalankan ls -l akan kelihatan 2 file eksekusi, namun tidak akan kita eksekusi langsung, melainkan akan kita eksekusi menggunakan service daemon agar dapat berjalan di background proses. Menyiapkan tempat penyimpanan data prometheus yang akan di buat secara terpisah di dalam /var/lib sudo mkdir /var/lib/prometheus ===Membuat user untuk prometheus=== Langkah pertama jalankan command : sudo groupadd --system prometheus masukkan password user jika diminta Buatkan user baru dengan nama prometheus dan asign ke dalam group promehteus dengan command berikut : sudo useradd --system -s /sbin/nologin -g prometheus prometheus Kemudian pindahkan folder promehteus dan promtool ke /usr/local/bin/ dengan command : sudo mv prometheus promtool /usr/local/bin/ periksa hasilnya menggunakan which, maka akan terlihat kedua file tersebut sudah berpindah folder which prometheus which promtool kita dapat juga melakukan pengecekan version prometheus : prometheus --version ===Membuat folder baru untuk menyimpan file konfigurasi=== Cek menggunakan ls -l, akan terlihat 3 komponen yang akan di pindahkan ke folder baru, yaitu folder console_libraries, folder consoles dan file prometheus.yml. Folder baru tersebut akan di buat di dalam folder /etc : sudo mkdir /etc/prometheus Kemudian membuat folder atau otak penyimpanan data prometheus di dalam folder /var/lib/ sudo mkdir /var/lib/prometheus Diperlukan permission untuk /var/lib/prometheus untuk proses baca/tulis. Cek dulu menggunakan : ls -l /var/lib/ dapat dilihat ownier prometheus itu masih punya root, untuk itu perlu dibuat chown sesuai user dan group prometheus yang sudah dibuat di atas dengan command berikut : sudo chown -R user:group /var/lib/prometheus/ jika sesuai user dan group daiata adalah : sudo chown -R prometheus:prometheus /var/lib/prometheus/ Cek lagi dengan : ls -l /var/lib/ akan terlihat kepemilikan prometheus sudah berubah dari user root ke prometheus. Selanjutnya memindahkan folder console_libraries, folder consoles dan file prometheus.yml ke folder /etc/prometheus dengan cara : sudo mv console_libraries/ consoles/ prometheus.yml /etc/prometheus/ cek lagi di folder asal, maka 3 kompnen di atas sduah tidak terlihat karena sudah berpindah folder. ls -l Pindah ke /etc/promehteus cd /etc/prometheus Edit file promehteus.yml sudo nano prometheus.yml isinya menjadi global: scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute. evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute. scrape_configs: - job_name: "prometheus" static_configs: - targets: ["localhost:9090"] ===Membuat backgroud service prometheus=== Kita buatkan file servicenya : sudo nano /etc/systemd/system/prometheus.service sehingga isinya secara sederhana seperti berikut ini : #Prometheus Service [Unit] Description=Prometheus Documentation=https://prometheus.io/docs/introduction/overview/ Wants=network-online.target After=network-online.target [Service] User=prometheus Group=prometheus Type=simple ExecStart=/usr/local/bin/prometheus \ --config.file /etc/prometheus/prometheus.yml \ --storage.tsdb.path /var/lib/prometheus/ \ --web.console.templates=/etc/prometheus/consoles \ --web.console.libraries=/etc/prometheus/comnsole_libraries [Install] WantedBy=multi-user.target Karena ada konfigurasi baru maka prometheus perlu di reload sudo systemctl daemon-reload Kemudaian cek status prometheus sudo systemctl status prometheus.service Disini statusnya masih dalam keadaan inactive β prometheus.service - Prometheus Loaded: loaded (/etc/systemd/system/prometheus.service; disabled; vendor preset: enabled) Active: inactive (dead) Docs: https://prometheus.io/docs/introductions/overview/ Agar stausnya active dan servicenya enable maka jalankan command berikut : sudo systemctl enable --now prometheus.service hasilnya : Created symlink /etc/systemd/system/multi-user.target.wants/prometheus.service β /etc/systemd/system/prometheus.service. Cek sekali lagi : sudo systemctl status prometheus hasilmya sudah running : β prometheus.service - Prometheus Loaded: loaded (/etc/systemd/system/prometheus.service; enabled; vendor preset: enabled) Active: active (running) since Mon 2023-10-23 08:36:04 UTC; 2s ago Docs: https://prometheus.io/docs/introductions/overview/ Main PID: 5597 (prometheus) Tasks: 5 (limit: 2252) Memory: 50.9M CGroup: /system.slice/prometheus.service ββ5597 /usr/local/bin/prometheus --config.file /etc/prometheus/prometheus.yml --storage.tsdb.path /var/lib/promethe> Oct 23 08:36:04 pcbuntu systemd[1]: Started Prometheus. Selanjutnya cek dan validasi sesuai port default di 9090 degan cara : sudo lsof -n -i | grep prometheus menghasilkan : prometheu 2872 prometheus 7u IPv6 36798 0t0 TCP *:9090 (LISTEN) prometheu 2872 prometheus 11u IPv4 37901 0t0 TCP 127.0.0.1:56360->127.0.0.1:9090 (ESTABLISHED) prometheu 2872 prometheus 12u IPv6 37902 0t0 TCP 127.0.0.1:9090->127.0.0.1:56360 (ESTABLISHED) Dapat dilihat port server yang akan dimonitor sudah aktif, selanjutnya coba akses ip_server:9090. Sebelumnya cek dulu ip server menggunakan : hostname -I misal hasilnya : 10.10.10.7 Dapat di akses menggunakan browser 10.10.10.7:9090 maka akan terbuka halaman Prometheus namun msh belum dilengkap metric-metric untuk memonitor system server, seperti cpu, memory, hardisk dan sebagainya. Sampai pada tahap ini perispan Prometheus sudah selesai.
Summary:
Please note that all contributions to AbahDoku Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
AbahDoku Wiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Toggle limited content width