Prometheus Remote Write
An output plugin to submit Prometheus Metrics using the remote write protocol
The prometheus remote write plugin allows you to take metrics from Fluent Bit and submit them to a Prometheus server through the remote write mechanism.
Important Note: The prometheus exporter only works with metric plugins, such as Node Exporter Metrics
Key
Description
Default
host
IP address or hostname of the target HTTP Server
127.0.0.1
http_user
Basic Auth Username
http_passwd
Basic Auth Password. Requires HTTP_user to be set
port
TCP port of the target HTTP Server
80
proxy
Specify an HTTP Proxy. The expected format of this value is http://host:port. Note that https is not supported yet. Please consider not setting this and use HTTP_PROXY environment variable instead, which supports both http and https.
uri
Specify an optional HTTP URI for the target web server, e.g: /something
/
header
Add a HTTP header key/value pair. Multiple headers can be set.
log_response_payload
Log the response payload within the Fluent Bit log
false
add_label
This allows you to add custom labels to all metrics exposed through the prometheus exporter. You may have multiple of these fields

Getting Started

The Prometheus remote write plugin only works with metrics collected by one of the from metric input plugins. In the following example, host metrics are collected by the node exporter metrics plugin and then delivered by the prometheus remote write output plugin.
1
# Node Exporter Metrics + Prometheus remote write output plugin
2
# -------------------------------------------
3
# The following example collects host metrics on Linux and delivers
4
# them through the Prometheus remote write plugin to new relic :
5
#
6
[SERVICE]
7
Flush 1
8
Log_level info
9
10
[INPUT]
11
Name node_exporter_metrics
12
Tag node_metrics
13
Scrape_interval 2
14
15
[OUTPUT]
16
Name prometheus_remote_write
17
Match node_metrics
18
Host metric-api.newrelic.com
19
Port 443
20
Uri /prometheus/v1/write?prometheus_server=YOUR_DATA_SOURCE_NAME
21
Header Authorization Bearer YOUR_LICENSE_KEY
22
Log_response_payload True
23
Tls On
24
Tls.verify On
25
# add user-defined labels
26
add_label app fluent-bit
27
add_label color blue
28
29
# Note : it would be necessary to replace both YOUR_DATA_SOURCE_NAME and YOUR_LICENSE_KEY
30
# with real values for this example to work.
Copied!

Examples

The following are examples of using Prometheus remote write with hosted services below

Grafana Cloud

With Grafana Cloud hosted metrics you will need to use the specific host that is mentioned as well as specify the HTTP username and password given within the Grafana Cloud page.
1
[OUTPUT]
2
name prometheus_remote_write
3
host prometheus-us-central1.grafana.net
4
match *
5
uri /api/prom/push
6
port 443
7
tls on
8
tls.verify on
9
http_user <GRAFANA Username>
10
http_passwd <GRAFANA Password>
Copied!

Logz.io Infrastructure Monitoring

With Logz.io hosted prometheus you will need to make use of the header option and add the Authorization Bearer with the proper key. The host and port may also differ within your specific hosted instance.
1
[OUTPUT]
2
name prometheus_remote_write
3
host listener.logz.io
4
port 8053
5
match *
6
header Authorization Bearer <LOGZIO Key>
7
tls on
8
tls.verify on
9
log_response_payload true
Copied!

Coralogix

With Coralogix Metrics you may need to customize the URI. Additionally, you will make use of the header key with Coralogix private key.
1
[OUTPUT]
2
name prometheus_remote_write
3
host metrics-api.coralogix.com
4
uri prometheus/api/v1/write?appLabelName=path&subSystemLabelName=path&severityLabelName=severity
5
match *
6
port 443
7
tls on
8
tls.verify on
9
header Authorization Bearer <CORALOGIX Key>
Copied!
Last modified 15d ago