# Measuring planned downtime of a service

**URL:** <https://discuss.elastic.co/t/measuring-planned-downtime-of-a-service/249696>\
**Category:** Kibana\
**Created:** [September 23, 2020, 7:04pm UTC](https://discuss.elastic.co/t/measuring-planned-downtime-of-a-service/249696 "2020-09-23T19:04:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![josaku](https://avatars.discourse-cdn.com/v4/letter/j/7993a0/32.png) [@josaku](https://discuss.elastic.co/u/josaku)\
**Post date:** [September 23, 2020, 7:04pm UTC](https://discuss.elastic.co/t/measuring-planned-downtime-of-a-service/249696/1 "2020-09-23T19:04:27Z")

</div>

Greetings 🙂

We use Kibana 7.8 to measure the uptime of a windows service. We can calculate the percentage as well as the number of hours a windows service has been up or down. But when such a service is shut down we are not able to differentiate whether the shut down was planned or unplanned. We'd like to exclude the planned downtime while calculating the uptime percentages. I am not sure if it is possible to differentiate this in Kibana. Any help is this direction appreciated!

Thanks  
Joseph

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [September 23, 2020, 9:43pm UTC](https://discuss.elastic.co/t/measuring-planned-downtime-of-a-service/249696/2 "2020-09-23T21:43:47Z")

</div>

How are you doing the calculations at the moment?

---

<div class="post-metadata">

**Author:** ![josaku](https://avatars.discourse-cdn.com/v4/letter/j/7993a0/32.png) [@josaku](https://discuss.elastic.co/u/josaku)\
**Post date:** [September 24, 2020, 8:33am UTC](https://discuss.elastic.co/t/measuring-planned-downtime-of-a-service/249696/3 "2020-09-24T08:33:05Z")

</div>

Metricbeat set to send data at 20sec frequency. Added a field in metricbeat config like "windows\_service\_State\_number" that will send a 1 if the service is up and 0 if it is down. Over a period of time if we take all this data and sum them, we get the numerator x and a count of all the data will form the denominator y. `x/y` will give the `%` of uptime for the service. E.g. for a 10 minute period we'll have `y = 30`. If the service was up for 9 minutes then we'll get `x = 27`. So uptime is `27/30`. We don't worry if a service goes down and comes up within a period less than 20sec.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 22, 2020, 8:33am UTC](https://discuss.elastic.co/t/measuring-planned-downtime-of-a-service/249696/4 "2020-10-22T08:33:20Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
