@mailprotector/haraka-plugin-prometheus

1.0.6 • Public • Published

haraka-plugin-prometheus

A Haraka plugin for collecting metrics into Prometheus.

Install

Install with npm

npm install @mailprotector/haraka-plugin-prometheus --save

Setup

HTTP Server

Enable Haraka's HTTP server (see listen in http.ini) to listen on port 9904

http.ini:

listen=[::]:9904

Enable Plugin

Add to plugin file in the haraka config folder

@mailprotector/haraka-plugin-prometheus

Config

Config options are set in prometheus.json:

Parameter Description Type Default Value
enabled whether to enable the plugin boolean true
prefix prefix that gets appended to all metrics string none
default_labels labels to add to all metrics map none

Sending metrics from other plugins

You can push metrics into the connection.notes.prometheus_metrics array from any other Haraka plugin. They will be collected into Prometheus on the disconnect hook.

The format of the array is:

connection.notes.prometheus_metrics = [
  { type: 'counter', name 'test_counter', help: '', value: 1, label_names: ['foo', 'bar'] },
  { type: 'gauge', name 'test_gauge', help: '', value: 1, label_names: ['foo', 'bar'] },
  { type: 'histogram', name 'test_histogram', help: '', value: 1, label_names: ['foo', 'bar'] },
  { type: 'summary', name 'test_summary', help: '', value: 1, label_names: ['foo', 'bar'] }
]

alt text

About Mailprotector

Readme

Keywords

Package Sidebar

Install

npm i @mailprotector/haraka-plugin-prometheus

Weekly Downloads

112

Version

1.0.6

License

MIT

Unpacked Size

10.4 kB

Total Files

6

Last publish

Collaborators

  • djatmp
  • andy.mailprotector
  • danwagoner
  • ben.hathaway