This exporter for Prometheus only exposes one metric (fow now), the number of tasks for each app in a Marathon cluster. It has one dimension, the name of the app.
This exporter is not meant to report low-level metrics on Marathon. If you are looking for this, you should look at the Mesos expoer or the Marathon exporter.
marathon_task_count{task="app-01.production"} 10
marathon_task_count{task="app-02.production"} 3
marathon_task_count{task="app-03.staging"} 0
Note : the task name format was taken from the Mesos exporter for consistency. If you have an app in /cluster/production/app-01, it will be reported as app-01.production.cluster.
$ go get github.com/apognu/marathon_task_exporter
$ go build github.com/apognu/marathon_task_exporter
$ ./marathon_task_exporter -help
Usage of ./marathon_task_exporter:
-marathon.url string
Marathon instance URL
-web.listen-address string
Address to listen on for HTTP interface (default ":9091")
-web.telemetry-path string
Path under which to expose metrics (default "/metrics")
$ ./marathon_task_exporter -marathon.url=http://my.marathon.tld
You can use Prometheus's Alert Manager with this exporter, by first grouping by the task label in your route configuration:
route:
group_by: [ 'task' ]
An example alert rule could look like this:
ALERT ProductionAPIInstanceCount
IF marathon_task_count{task = "/production/.+"} < 3
FOR 30s
ANNOTATIONS {
summary = "Support Marathon Task count",
description = "Number of tasks for *{{$labels.task}}* has changed -> *{{$value}}*"
}
- Try to include Mesos labels as metric dimensions
- Take app health checks into account to count only live tasks
- Handle HTTP authentication on Marathon