Wednesday, November 13, 2024
Amazon Linux AWS Prometheus

Cara Install Prometheus pada Amazon Linux

Prometheus

“Cara Install Prometheus pada Amazon Linux”

Pengantar

Prometheus adalah alat pemantauan dan peringatan sistem sumber terbuka dan gratis yang awalnya dibuat di SoundCloud. Sejak awal awalnya banyak perusahaan telah mengadopsi Prometheus sehingga pertumbuhan komunitas penggunanya. Prometheus sekarang merupakan proyek mandiri yang dikelola dan dikembangkan oleh komunitas open source. Prometheus bergabung dengan Cloud Native Computing Foundation pada tahun 2016 sebagai proyek yang dihosting kedua, setelah Kubernetes.

Install Prometheus pada Amazon Linux

  • Tambahkan repositori
sudo tee /etc/yum.repos.d/prometheus.repo <<EOF 
[prometheus]
name=prometheus
baseurl=https://packagecloud.io/prometheus-rpm/release/el/7/x86_64
repo_gpgcheck=1
enabled=1
gpgkey=https://packagecloud.io/prometheus-rpm/release/gpgkey
       https://raw.githubusercontent.com/lest/prometheus-rpm/master/RPM-GPG-KEY-prometheus-rpm
gpgcheck=1
metadata_expire=300
EOF
  • Install prometheus
sudo yum -y install prometheus2 node_exporter
  • konfigurasi Prometheus
sudo vim /etc/prometheus/prometheus.yml

edit file

# my global config
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_timeout is set to the global default (10s).

# Alertmanager configuration
alerting:
  alertmanagers:
  - static_configs:
    - targets:
      # - alertmanager:9093

# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
  # - "first_rules.yml"
  # - "second_rules.yml"

# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
  # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
  - job_name: 'prometheus'

    # metrics_path defaults to '/metrics'
    # scheme defaults to 'http'.

    static_configs:
    - targets: ['localhost:9090']
  # Pull host metrics with node exporter
  - job_name: mynode
    static_configs:
      - targets: ['localhost:9100']
  • enable service
sudo systemctl enable prometheus node_exporter
sudo systemctl restart prometheus node_exporter

Tambahkan Firewall

sudo firewall-cmd --add-service=prometheus --permanent
sudo firewall-cmd --reload

Akses via web

http://(server_hostname_or_IP_Address):9090

Baca Juga :  Cara Setup IP Public Static pada EC2 AWS

Penutup

Sahabat Blog Learning & Doing demikianlah penjelasan mengenai Cara Install Prometheus pada Amazon Linux. Semoga Bermanfaat . Sampai ketemu lagi di postingan berikut nya.

(Visited 153 times, 1 visits today)

Similar Posts