Prometheus+Grafana+Loki
March 22, 2023
Prometheus install with bash script
Установка и запуск Prometheus на ВМ.
#!/bin/bash # Запускаем строго от root cd /opt wget https://github.com/prometheus/prometheus/releases/download/v2.26.0/prometheus-2.26.0.linux-amd64.tar.gz tar zxf prometheus-2.26.0.linux-amd64.tar.gz mv prometheus-2.26.0.linux-amd64 prometheus rm -rf prometheus-2.26.0.linux-amd64.tar.gz cd prometheus mkdir data useradd -s /sbin/nologin -d /opt/prometheus prometheus chown -R prometheus:prometheus /opt/prometheus touch /etc/systemd/system/prometheus.service echo '[Unit]' >> /etc/systemd/system/prometheus.service echo 'Description=Prometheus' >> /etc/systemd/system/prometheus.service echo 'Wants=network-online.target' >> /etc/systemd/system/prometheus.service echo 'After=network-online.target' >> /etc/systemd/system/prometheus.service echo "" >> /etc/systemd/system/prometheus.service echo '[Service]' >> /etc/systemd/system/prometheus.service echo 'User=prometheus' >> /etc/systemd/system/prometheus.service echo 'Group=prometheus' >> /etc/systemd/system/prometheus.service echo 'ExecStart=/opt/prometheus/prometheus \' >> /etc/systemd/system/prometheus.service echo '--config.file=/opt/prometheus/prometheus.yml \' >> /etc/systemd/system/prometheus.service echo '--storage.tsdb.path=/opt/prometheus/data \' >> /etc/systemd/system/prometheus.service echo '--web.console.templates=/opt/prometheus/consoles \' >> /etc/systemd/system/prometheus.service echo '--web.console.libraries=/opt/prometheus/console_libraries' >> /etc/systemd/system/prometheus.service echo '[Install]' >> /etc/systemd/system/prometheus.service echo 'WantedBy=default.target' >> /etc/systemd/system/prometheus.service systemctl daemon-reload systemctl enable prometheus systemctl start prometheus systemctl status prometheus
Заходим по адресу: http://ip_addr:9090
Это адрес дашборда Prometheus. Он не очень удобен. Лучше использовать Grafana.