How to calculate a monthly availability of my website?

Greetings,

I have the following index populated each 3 minutes:

{
  "template": "web-*",
  "settings": {
    "number_of_shards": 1
  },
  "mappings": {
      "web-": {
      "_source": {
      "enabled": true
      },
      "properties": {
        "@timestamp": {
          "type": "date",
          "format" : "epoch_second"
        },
        "uri": {
          "type": "keyword"
        },
        "http_status": {
          "type": "integer"
        },
        "downtime": {
          "type": "integer"
        }
      }
    }
  }
}

Now the variable "downtime" will be equal to 3 (minutes) if "http_status" is different than 200.

I want to calculate based on "time" and "downtime" the availability percentage of my web each month for example:
"total downtime for this month" = 200 min --> how can I get this value each month?
"time in minutes of this month" = 44640 min

availability percentage by month = (200 / 44640 ) * 100

Now how can I get the availability percentage automatically calculated and want to report it by the end of each month?

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