Target server
I built a target server in express-js.
const express = require("express");
var morgan = require("morgan");
const app = express();
const port = 3000;
let counter = 10;
app.use(morgan("combined"));
app.get("/metrics", (req, res) => {
counter += 10;
res.setHeader("Content-Type", "text/plain");
res.send(`CUSTOM_SERVER_COUNTER ${counter}`);
});
app.get("/", (req, res) => {
res.send("Hello World!");
});
app.listen(port, () => {
console.log(`Example app listening on port ${port}`);
});
Prometheus
Configures my target in the Prometheus and it's showing in the UI also.
Not sure why my target is always showing down.