wget https://github.com/prometheus/prometheus/releases/download/v2.53.0/prometheus-2.53.0.linux-amd64.tar.gz
##EKstrak Filenya dengan ketikan perintah
sudo tar xvf prometheus-2.53.0.linux-amd64.tar.gz
##Masuk Ke directory prometheus
cd prometheus-2.53.0.linux-amd64
##Pindahkan File programnya ke /usr/local/bin/
sudo mv prometheus promtool /usr/local/bin/
##Buatkan Group & user untuk Prometheus
sudo groupadd –system prometheus
sudo useradd –system -s /sbin/nologin -g prometheus prometheus
##Buat folder & Pindahkan Console_libraries & consoles ke folder etc
sudo mkdir /etc/prometheus
sudo mv consoles/ console_libraries/ prometheus.yml /etc/prometheus
##Buat folder prometheus di /var/lib/prometheus dan ganti securitynya
sudo mkdir /var/lib/prometheus
sudo chown -R prometheus:prometheus /var/lib/prometheus/
##Cek apakah foldernya apakah sudah ter set
ls -l /var/lib
##Buat daemon untuk prometheus
sudo nano /etc/systemd/system/prometheus.service
##Copy Skrip dibawah ini
[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/console_libraries
[Install]
WantedBy=multi-user.target
##Reload daemon nya
sudo systemctl daemon-reload
wget https://github.com/prometheus/prometheus/releases/download/v2.53.0/prometheus-2.53.0.linux-amd64.tar.gz
##EKstrak Filenya dengan ketikan perintah
sudo tar xvf prometheus-2.53.0.linux-amd64.tar.gz
##Masuk Ke directory prometheus
cd prometheus-2.53.0.linux-amd64.tar.gz
##Pindahkan File programnya ke /usr/local/bin/
sudo mv prometheus promtool /usr/local/bin/
##Buatkan Group & user untuk Prometheus
sudo groupadd –system prometheus
sudo useradd –system -s /sbin/nologin -g prometheus prometheus
##Buat folder & Pindahkan Console_libraries & consoles ke folder etc
sudo mkdir /etc/prometheus
sudo mv consoles/ console_libraries/ prometheus.yml /etc/prometheus
##Buat folder prometheus di /var/lib/prometheus dan ganti securitynya
sudo mkdir var/lib/prometheus
sudo chown -R prometheus:prometheus /var/lib/prometheus/
##Cek apakah foldernya apakah sudah ter set
ls -l /var/lib
##Buat daemon untuk prometheus
sudo nano /etc/systemd/system/prometheus.service
##Copy Skrip dibawah ini
[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/console_libraries
[Install]
WantedBy=multi-user.target–now prometheus.service
##Restart daemon nya
sudo systemctl daemon-reload
sudo systemctl enable –now prometheus.service
sudo systemctl status prometheus.service
##CEK PORT PROGRAM YANG BERJALAN
sudo lsof -n -i | grep LISTEN
##AKSES PROMETHEUS NYA
ip_server_anda:9090
##SNMP EXPORTER & EKSTRAK
wget https://github.com/prometheus/snmp_exporter/releases/download/v0.26.0/snmp_exporter-0.26.0.linux-amd64.tar.gz
sudo tar xvf snmp_exporter-0.26.0.linux-amd64.tar.gz
##Masuk ke directory SNMP Exporternya
cd snmp_exporter-0.26.0.linux-amd64
#MOVE Programnya ke /usr/local/bin
sudo mv snmp_exporter /usr/local/bin/
##Buat dan pindahkan file snmp.yml ke directory etc
sudo mkdir /etc/snmp_exporter
sudo mv snmp.yml /etc/snmp_exporter/
##BUAT daemon untuk snmp
sudo nano /etc/systemd/system/snmp-exporter.service
##COPY SKRIP DIBAWAH INI
[Unit]
Description=SNMP Exporter
After=network-online.target
# This assumes you are running snmp_exporter under the user “prometheus”
[Service]
User=prometheus
Restart=on-failure
ExecStart=/usr/local/bin/snmp_exporter –config.file=’/etc/snmp_exporter/snmp.yml’
[Install]
WantedBy=multi-user.target
## RELOAD daemonnya & enable programnya
sudo systemctl daemon-reload
sudo systemctl enable –now snmp-exporter.service
sudo systemctl status snmp-exporter.service
##CEK PORT YANG BERJALAN
sudo lsof -n -i | grep LISTEN
##TAMBAHKAN MIKROTIK KE DALAM prometheus.yml
sudo nano /etc/prometheus/prometheus.yml
##COPY SKRIP DIBAWAH INI
# my global config
global:
scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default i>
evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is ev>
scrape_configs:
– job_name: “prometheus”
static_configs:
– targets: [“localhost:9090”]
– job_name: ‘Mikrotik’
static_configs:
– targets:
– 192.168.200.3 # IP MIKROTIK ANDA.
metrics_path: /snmp
params:
module: [mikrotik]
relabel_configs:
– source_labels: [__address__]
target_label: __param_target
– source_labels: [__param_target]
target_label: instance
– target_label: __address__
replacement: 127.0.0.1:9116 # The SNMP exporter’s real hostname:port.
## Restart Prometheus
sudo systemctl restart prommetheus
sudo systemctl status prommetheus
##NYALAKAN SNMP MIKROTIK
##INSTALL GRAFANA
sudo apt-get install -y apt-transport-https software-properties-common wget
sudo mkdir -p /etc/apt/keyrings/
wget -q -O – https://apt.grafana.com/gpg.key | gpg –dearmor | sudo tee /etc/apt/keyrings/grafana.gpg > /dev/null
echo “deb [signed-by=/etc/apt/keyrings/grafana.gpg] https://apt.grafana.com stable main” | sudo tee -a /etc/apt/sources.list.d/grafana.list
sudo apt-get update
sudo apt-get install grafana