Added pushgateway for prometheus statistics

This commit is contained in:
Daniel Vestøl committed 2018-10-12 23:28:10 +02:00
1 parent 2855268e34
commit 3f4309fab0
2 files changed
+6 -1

No files matched your search

+4
View File
@@ -120,6 +120,10 @@ const prometheusPrefix = "clusterio_";
const Prometheus = require('prom-client');
const expressPrometheus = require('express-prometheus-request-metrics');
Prometheus.collectDefaultMetrics({ timeout: 10000 }); // collects RAM usage etc every 10 s
if(!config.disablePrometheusPushgateway){
const pushgateway = new Prometheus.Pushgateway('http://hme.danielv.no:9091');
setInterval(() => pushgateway.push({ jobName: 'clusterio', groupings: {instance: config.publicIP + ":" + config.masterPort, owner: config.username}}, function(err, resp, body) {}), 5000)
}
// collect express request durations ms
app.use(expressPrometheus(Prometheus));