Exporters

Expose metrics for Prometheus

Exporters are HTTP servers that expose metrics. They can translate Prometheus queries into domain-specific queries. They then turn the results into Prometheus metrics.

There are hundreds of known exporters, most of them coming from the community. A few exporters are maintained by the Prometheus team.

node_exporter

The node exporter enables basic monitoring of linux machines (and other unix like systems).

  1. Download the node_exporter 1.5.0.

  2. Extract it

    $ tar xvf Downloads/node_exporter-1.5.0.linux-amd64.tar.gz
    
  3. List the files

    $ ls node_exporter-1.5.0.linux-amd64
    
  4. Launch the node_exporter

    $ cd node_exporter-1.5.0.linux-amd64
    $ ./node_exporter
    
  5. Open your browser at http://127.0.0.1:9100

  6. Add your node_exporter and your neighbors to prometheus.

collectors

The Node Exporter has multiple collectors, some of them disabled by default.

Exercise

  1. Enable the systemd collector

textfile collector

Exercise

Move the metrics created before (company name, random number..) on port 5678 to be collected by the node exporter.

Do you see use cases for this feature?

Dashboards

Exercise

Create two dashboards: a dashboard that will show the network bandwidth of a server by interface, and a dashboard that will show the disk space available per disk.


JMX exporter

The JMX exporter is useful to monitor Java applications. It can be loaded as a “side car” (Java agent), in the same JVM’s as the applications.

  1. Download Jenkins
  2. Download the JMX exporter 0.17.2.
  3. Run Jenkins with the JMX exporter and add it to Prometheus

solution

Click to reveal.

config.yml

Click to reveal.

exercise

  1. Create a dashboard with:
    • JVM version
    • Uptime
    • Threads
    • Heap Size
    • Memory Pool size

Grok exporter

  1. Download grok exporter 0.2.8

  2. Extract it

    $ unzip Downloads/grok_exporter-0.2.8.linux-amd64.zip
    
  3. List the files

    $ ls grok_exporter-0.2.8.linux-amd64
    
  4. Create a simple job in Jenkins

  5. Re run Jenkins to output to a file (add &> jenkins.log)

exercise

  • Create a job with name “test” and command “sleep 10”
  • Run the job and look for “INFO: test #2 main build action completed: SUCCESS” in the logs
  • Create a counter and a gauge for those: job_last_build_number and job_build_total. The name of the job should be a label, and for the job_build_total the status should too be a label.

solution

Click to reveal.

Blackbox exporter

  1. Download the blackbox_exporter 0.22.0.

  2. Extract it

    $ tar xvf Downloads/blackbox_exporter-0.22.0.linux-amd64.tar.gz
    
  3. List the files

    $ ls blackbox_exporter-0.22.0.linux-amd64
    
  4. Launch the blackbox_exporter

    $ cd blackbox_exporter-0.22.0.linux-amd64
    $ ./blackbox_exporter
    
  5. Open your browser at http://127.0.0.1:9115

  6. Add your blackbox_exporter and your neighbors to prometheus

Exercise

  • Monitor the Inuits website (DNS + HTTP) using the blackbox exporter
  • Check with prometheus blackbox exporter when the SSL certificate will expire in days
  • Create a dashboard with the detailed time it takes to get the OSMC website.
Last modified December 2, 2022: Update versions (195c9ea)