portmaster-plugin-prometheus
DISCLAIMER: This is not an official Safing product!
This repository provides a Safing Portmaster plugin that exposes connection statistics to Prometheus. It supports pull (scraping) and push mode.
Warning: This repository is based on the experimental Portmaster Plugin System which is available in safing/portmaster#834 but has not been merged and released yet.
Installation
Using the install command
This plugin uses the cmds.InstallCommand()
from the portmaster plugin framework so installation is as simple as:
go build .
sudo ./portmaster-plugin-prometheus install --data /opt/safing/portmaster
Manual Installation
To manually install the plugin follow these steps:
-
Build the plugin from source code: go build .
-
Move the plugin /opt/safing/portmaster/plugins/portmaster-plugin-prometheus
-
Edit /opt/safing/portmaster/plugins.json
to contain the following content:
[
{
"name": "portmaster-plugin-prometheus",
"types": [
"decider"
],
"config": {
"namespace": "",
"subsystem": "",
"mode": "pull",
"address": "0.0.0.0:8081",
"push": {
"interval": "10s",
"jobName": "portmaster"
}
}
}
]
Configuration
Important: Before being able to use plugins in the Portmaster you must enable the "Plugin System" in the global settings page. Note that this setting is still marked as "Experimental" and "Developer-Only" so you'r Portmaster needs the following settings adjusted to even show the "Plugin System" setting:
The plugin can either be configured using static configuration in plugins.json
.
Just specify the static configuration when using portmaster-plugin-prometheus install
. For example:
sudo ./portmaster-plugin-prometheus install --mode push --address https://pushgateway.example.com/metrics/ --push-job-name portmaster --push-interval 10s --data /opt/safing/portmaster