Currently I have a Kubernetes environment and using Py rometheus toolkit for monitoring. I have application counters which are not exposed in container metrics. However I am able to view them as a JSON object by using a curl command.
http://10.0.0.1:8081/api/events/
I have used NodePort to expose POD externally via worker nodes's IP.
Response has the following format:
{
{
"ID": "001",
"source": "pageloads",
"summary": "high failure counts",
"severity": "major"
},
{
"ID": "003",
"source": "profile_counts",
"summary": "profile count doesn't match number of groups",
"severity": "minor"
},
{
"ID": "002",
"source": "number of subscribers",
"summary": "profiles higher than subscribers",
"severity": "critical"
}
}
Is there a way to include API response in Prometheus to poll every 15 seconds?
That json response is not in prometheus format , hence prometheus will not be able to scrape that.You will need to use the language specific prometheus client library to instrument your code to expose metrics in prometheus format at /metrics endpoint.If that's not possible then you need to use an existing exporter or write a custom exporter.This exporter runs as a separate process and will collect metrics from your application api endpoint and create prometheus format metrics and expose those metrics at /metrics endpoint.Then you can configure prometheus to scrape the exporter's /metrics endpoint.