Skip to content
Snippets Groups Projects
Unverified Commit be6c7da8 authored by Antoine Leroyer's avatar Antoine Leroyer
Browse files

Merge commit 'refs/pull/2/head' of https://github.com/soundcloud/rsyslog_exporter

parents fb8dc535 72c70307
No related branches found
No related tags found
No related merge requests found
...@@ -5,6 +5,8 @@ A [prometheus](http://prometheus.io/) exporter for [rsyslog](http://rsyslog.com) ...@@ -5,6 +5,8 @@ A [prometheus](http://prometheus.io/) exporter for [rsyslog](http://rsyslog.com)
## Rsyslog Configuration ## Rsyslog Configuration
Configure rsyslog to push JSON formatted stats via omprog: Configure rsyslog to push JSON formatted stats via omprog:
``` ```
module(load="omprog")
module( module(
load="impstats" load="impstats"
interval="10" interval="10"
...@@ -17,13 +19,25 @@ ruleset(name="process_stats") { ...@@ -17,13 +19,25 @@ ruleset(name="process_stats") {
action( action(
type="omprog" type="omprog"
name="to_exporter" name="to_exporter"
binary="/usr/local/bin/rsyslog_exporter" binary="/usr/local/bin/rsyslog_exporter [--tls.server-crt=/path/to/tls.crt --tls.server-key=/path/to/tls.key]"
) )
} }
``` ```
The exporter itself logs back via syslog, this cannot be configured at the moment. The exporter itself logs back via syslog, this cannot be configured at the moment.
## Command Line Switches
* `web.listen-address` - default `:9104` - port to listen to (NOTE: the leading
`:` is required for `http.ListenAndServe`)
* `web.telemetry-path` - default `/metrics` - path from which to serve Prometheus metrics
* `tls.server-crt` - default `""` - PEM encoded file containing the server certificate and
the CA certificate for use with `http.ListenAndServeTLS`
* `tls.server-key` - default `""` - PEM encoded file containing the unencrypted
server key for use with `tls.server-crt`
If you want the exporter to listen for TLS (`https`) you must specify both
`tls.server-crt` and `tls.server-key`.
## Provided Metrics ## Provided Metrics
The following metrics provided by the rsyslog [impstats](https://www.rsyslog.com/doc/master/configuration/modules/impstats.html) module are tracked by rsyslog_exporter: The following metrics provided by the rsyslog [impstats](https://www.rsyslog.com/doc/master/configuration/modules/impstats.html) module are tracked by rsyslog_exporter:
......
...@@ -15,6 +15,8 @@ import ( ...@@ -15,6 +15,8 @@ import (
var ( var (
listenAddress = flag.String("web.listen-address", ":9104", "Address to listen on for web interface and telemetry.") listenAddress = flag.String("web.listen-address", ":9104", "Address to listen on for web interface and telemetry.")
metricPath = flag.String("web.telemetry-path", "/metrics", "Path under which to expose metrics.") metricPath = flag.String("web.telemetry-path", "/metrics", "Path under which to expose metrics.")
certPath = flag.String("tls.server-crt", "", "Path to PEM encoded file containing TLS server cert.")
keyPath = flag.String("tls.server-key", "", "Path to PEM encoded file containing TLS server key (unencyrpted).")
) )
func main() { func main() {
...@@ -51,6 +53,13 @@ func main() { ...@@ -51,6 +53,13 @@ func main() {
`)) `))
}) })
if *certPath == "" && *keyPath == "" {
log.Printf("Listening on %s", *listenAddress) log.Printf("Listening on %s", *listenAddress)
log.Fatal(http.ListenAndServe(*listenAddress, nil)) log.Fatal(http.ListenAndServe(*listenAddress, nil))
} else if *certPath == "" || *keyPath == "" {
log.Fatal("Both tls.server-crt and tls.server-key must be specified")
} else {
log.Printf("Listening for TLS on %s", *listenAddress)
log.Fatal(http.ListenAndServeTLS(*listenAddress, *certPath, *keyPath, nil))
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment