Calculate Uptime from elasticsearch logs


I have read some where in the online about on how to calculate the Uptime for all service. Nagios & Centreon kind of monitoring system generating the report from the logs. Lets say for the server, totally 6 checks has been configured. This reporting system will look for OK from the logs for each checks. Hence they are using the calculation like (No of OK checks count / All checks count * 100%) = Uptime. For example (5/6*100% = 83.3%)
Here 5 is the total OK check count and 6 is the total check count for the host. Hence 83.3% is the uptime.

In my case, i have stored all logs in elasticsearch. From grafana, How to show the uptime in singlestat ? can some one let me know how to achieve this ?

Kindly let me know your feedback


I don’t think it’s possible to accomplish this with a singlestat panel since it’s not possible to calculate percentage of total using Elasticsearch in Grafana. See this issue for example.

However, I’ve found the following reply who seems to have done kind of what your asking for: How to calculate the % of service uptime?. He’s using the pie chart panel instead which is a plugin to Grafana which you can install and try.


1 Like