Create file `monitoring.js` to directory `packages/keker` with the following code:
// Require nodejs module `http`
const http = require('http');
// Create web server
const server = http.createServer(function(request, response) {
// Show monitoring for any request
response.writeHead(200, {"Content-Type": "text/html"});
response.write(`<br>Players: ${mp.players.length}/${mp.players.size}`);
response.write(`<br>Uptime: ${process.uptime()}`);
response.end();
});
// Turn on the web server on the port 8080
// (you can change it to any port)
server.listen(8080);
// Show message in terminal about successful starting of Monitoring Server
console.log('\nMonitoring Server is listening');
Append to file `packages/keker/index.js` the following code:
require('./monitoring');
Now when you open url http://your_ip:8080 you see the following data:
Also you can change the port of web server in `monitoring.js`. And you can change the data format to JSON if you need.