Reporting

How to calculate downtime from a script results?

ngerosa
Path Finder

Hi all,
I have a script that ping 10 hosts and output all of the offline hosts.

This script runs every 10 minutes.

The output file is monitored by splunk

What I would like to calculate is the downtime for every offline host present in the last ping.
This is the output file of the script:

  IP_address   Status   _time

  10.x.x.214,  Offline, 2018-03-30 10:32:23
  10.x.x.73,   Offline, 2018-03-30 10:32:27
  10.x.x.67,   Offline, 2018-03-30 10:32:31
  10.x.x.214,  Offline, 2018-03-30 10:42:18 
  10.x.x.73,   Offline, 2018-03-30 10:42:23
  10.x.x.67,   Offline, 2018-03-30 10:42:27
  10.x.x.214,  Offline, 2018-03-30 10:52:32
  10.x.x.67,   Offline, 2018-03-30 10:52:38

In this example I would like to have this |table:

   IP_address         downtime
   10.x.x.214         00:40:38
   10.x.x.67          00:40:30

I would like to have only that two hosts in table because in the last ping the host 10.x.xxx.73 is not present.

Someone can help me?

Thanks a lot!

Tags (3)
0 Karma
Get Updates on the Splunk Community!

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...

Tech Talk | Elevating Digital Service Excellence: The Synergy of Splunk RUM & APM

Elevating Digital Service Excellence: The Synergy of Real User Monitoring and Application Performance ...