mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-08-02 11:36:27 -04:00
Add initial package import and config
This commit is contained in:
parent
ef41a32353
commit
9a1bf6006a
2 changed files with 15 additions and 0 deletions
|
@ -15,6 +15,7 @@ const gracefulShutdown = require('http-graceful-shutdown');
|
|||
const Database = require("./database");
|
||||
const {sleep} = require("./util");
|
||||
const args = require('args-parser')(process.argv);
|
||||
const prom_client = require('prom-client')
|
||||
|
||||
const version = require('../package.json').version;
|
||||
const hostname = args.host || "0.0.0.0"
|
||||
|
@ -32,6 +33,11 @@ app.use(express.json())
|
|||
* Total WebSocket client connected to server currently, no actual use
|
||||
* @type {number}
|
||||
*/
|
||||
console.log("Setting up the Prometheus Client")
|
||||
|
||||
const collectDefaultMetrics = prom_client.collectDefaultMetrics;
|
||||
collectDefaultMetrics({ prefix: 'uptimekuma' });
|
||||
|
||||
let totalClient = 0;
|
||||
|
||||
/**
|
||||
|
@ -58,6 +64,12 @@ let needSetup = false;
|
|||
console.log("Adding route")
|
||||
app.use('/', express.static("dist"));
|
||||
|
||||
console.log("Adding /metrics")
|
||||
app.get('/metrics', function (req, res) {
|
||||
res.set('Content-Type', prom_client.register.contentType);
|
||||
res.end(prom_client.register.metrics());
|
||||
});
|
||||
|
||||
app.get('*', function(request, response, next) {
|
||||
response.sendFile(process.cwd() + '/dist/index.html');
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue