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!

Shape the Future of Splunk: Join the Product Research Lab!

Join the Splunk Product Research Lab and connect with us in the Slack channel #product-research-lab to get ...

Auto-Injector for Everything Else: Making OpenTelemetry Truly Universal

You might have seen Splunk’s recent announcement about donating the OpenTelemetry Injector to the ...

[Puzzles] Solve, Learn, Repeat: Character substitutions with Regular Expressions

This challenge was first posted on Slack #puzzles channelFor BORE at .conf23, we had a puzzle question which ...