Инструменты пользователя

Инструменты сайта


сервис_prometheus

Сервис Prometheus

Установка в Debian 10

# apt install prometheus prometheus-node-exporter prometheus-alertmanager

# cat /etc/default/prometheus-alertmanager
...
ARGS="--cluster.advertise-address=0.0.0.0:9093"
...
# service prometheus-alertmanager restart

# ps ax | grep prom
...prometheus-node-exporter...
...prometheus...
...prometheus-alertmanager...

Подключение

Консоли

# cp -rv /usr/share/doc/prometheus/examples/consoles/ /etc/prometheus/

# cp -rv /usr/share/doc/prometheus/examples/console_libraries/ /etc/prometheus/

# gunzip /etc/prometheus/console_libraries/prom.lib.gz

# service prometheus restart

Exporters

prometheus-snmp-exporter

# cat /etc/prometheus/snmp.yml

snmp_in_out_octets:
  version: 2
  auth:
    community: public
  walk:
  - 1.3.6.1.2.1.2.2.1.10
  - 1.3.6.1.2.1.2.2.1.16
  - 1.3.6.1.2.1.2.2.1.2
  metrics:
  - name: if_in_octets
    oid: 1.3.6.1.2.1.2.2.1.10
    type: counter
    indexes:
    - labelname: ifIndex
      type: Integer
    lookups:
    - labels:
      - ifIndex
      labelname: ifDescr
      oid: 1.3.6.1.2.1.2.2.1.2
      type: DisplayString
  - name: if_out_octets
    oid: 1.3.6.1.2.1.2.2.1.16
    type: counter
    indexes:
    - labelname: ifIndex
      type: Integer
    lookups:
    - labels:
      - ifIndex
      labelname: ifDescr
      oid: 1.3.6.1.2.1.2.2.1.2
      type: DisplayString

# curl 'http://127.0.0.1:9116/snmp?target=router&module=snmp_in_out_octets'

# cat /etc/prometheus/prometheus.yml
...
  - job_name: 'snmp'
    static_configs:
      - targets:
        - router  # SNMP device.
    metrics_path: /snmp
    params:
      module: [snmp_in_out_octets]
    relabel_configs:
      - source_labels: [__address__]
        target_label: __param_target
      - target_label: __address__
        replacement: server:9116
сервис_prometheus.txt · Последние изменения: 2021/01/28 10:17 — val