mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-24 00:23:12 +09:00
Added pushgateway for prometheus statistics
This commit is contained in:
1 parent
2855268e34
commit
3f4309fab0
2 files changed
+6
-1
No files matched your search
+2
-1
@@ -53,5 +53,6 @@
|
|||||||
"enableCrossServerShout": true,
|
"enableCrossServerShout": true,
|
||||||
"mirrorAllChat": false,
|
"mirrorAllChat": false,
|
||||||
"__comment7": "Autosave interval for items in the master storage in milliseconds. Defaults to one minute when set to 0 or not set.",
|
"__comment7": "Autosave interval for items in the master storage in milliseconds. Defaults to one minute when set to 0 or not set.",
|
||||||
"autosaveInterval": 600000
|
"autosaveInterval": 600000,
|
||||||
|
"disablePrometheusPushgateway": false
|
||||||
}
|
}
|
||||||
@@ -120,6 +120,10 @@ const prometheusPrefix = "clusterio_";
|
|||||||
const Prometheus = require('prom-client');
|
const Prometheus = require('prom-client');
|
||||||
const expressPrometheus = require('express-prometheus-request-metrics');
|
const expressPrometheus = require('express-prometheus-request-metrics');
|
||||||
Prometheus.collectDefaultMetrics({ timeout: 10000 }); // collects RAM usage etc every 10 s
|
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
|
// collect express request durations ms
|
||||||
app.use(expressPrometheus(Prometheus));
|
app.use(expressPrometheus(Prometheus));
|
||||||
|
|||||||
Reference in new issue
Block a user