Prometheus

внесение изменения в yml

sudo nano /etc/prometheus/prometheus.yml

содержание файла

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).

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

rule_files:
  # - "first_rules.yml"
  # - "second_rules.yml"

scrape_configs:
  - job_name: "prometheus"
    static_configs:
      - targets: ["localhost:9090"]
      - targets: ["localhost:9100"]
      - targets: ["10.8.0.2:9182"]
      - targets: ["10.8.0.78:9182"]
      - targets: ["10.8.0.1:9100"]

Запросы

пример windows query

wmi_service_state{instance="10.8.0.2:9182", job="prometheus", name="anydesk", state="running"}

node_exporter Linux

https://prometheus.io/download/#node_exporter

поместить актуальный файл .tar на хост и разархировать

tar -zxf node_exporter-*.linux-amd64.tar.gz
cd node_exporter-*.linux-amd64

Копируем исполняемый файл в bin:

sudo cp node_exporter /usr/local/bin/

Создаем пользователя nodeusr и задаем владельца для исполняемого файла

sudo useradd --no-create-home --shell /bin/false nodeusr
sudo chown -R nodeusr:nodeusr /usr/local/bin/node_exporter

Создаем автоапуск

sudo nano /etc/systemd/system/node_exporter.service

Содержание файла

[Unit]
Description=Node Exporter Service
After=network.target

[Service]
User=nodeusr
Group=nodeusr
Type=simple
ExecStart=/usr/local/bin/node_exporter
ExecReload=/bin/kill -HUP $MAINPID
Restart=on-failure

[Install]
WantedBy=multi-user.target

Добавляем автозапуск и проверяем

sudo systemctl enable node_exporter
sudo systemctl start node_exporter
sudo systemctl status node_exporter

postgres_exporter

на windows скачать официальный .exe файл экспортера https://github.com/prometheus-community/postgres_exporter/releases

добавить в папку с файлом postgres_exporter.yml

auth_modules:
  first:
    type: userpass
    userpass:
      username: postgres
      password: 2589
    options:
      sslmode: disable

добавить перменную среды windows

postgresql://postgres:2589@localhost:5432/?sslmode=disable

vlan