Skip to content

Using with Prometheus and Grafana

ArthurMitchell42 edited this page Jan 18, 2024 · 4 revisions

The Chain of Connection

Grafana is an excellent tool for pulling together large amounts of data into a visual representation.

In order to use it with you UPS you need to connect four items together.

  • Your UPS NUT server must be set up to provide status information
  • NUTCase should be able to access the NUT server data socket
  • Prometheus should be configured with a job to scrape NUTCase and record the data
  • Grafana should be configured to use Prometheus as one of it's data sources

Configuring Prometheus and Grafana is quite involved but there are many tutorials out there to help.

Once NUTCase is running in your system Prometheus and other data capture systems can use it to scrape data from any number of NUT servers by setting the target address on requests.

Visualising the captured data with Grafana

A suitable Grafana dashboard

Grafana

Prometheus

To configure Prometheus to scrape NUTCase for metrics set up the following in your prometheus.yml file
# prometheus.yml
global:
    scrape_interval: 10s
scrape_configs:
    - job_name: 'nut'
      scrape_interval: 30s
      scrape_timeout: 10s
      static_configs:
      # Insert NUT server address here
      - targets: ['10.0.10.9:3493']
      metrics_path: /metrics
      relabel_configs:
        - source_labels: [__address__]
          target_label: __param_target
        - source_labels: [__param_target]
          target_label: instance
        - target_label: __address__
          # Insert NUT exporter address here
          replacement: 10.0.10.9:9995

This example makes the assumption that the UPS server is running on 10.0.10.9, port 3493 and that NUTCase is hosted on 10.0.10.9 port 9995. Change as appropriate for your system.

Clone this wiki locally