Performance Analytics Expert - Outage contabilization

gcm1
Tera Expert

Hello experts!!

 

I need help developing a script for performance analytics. The goal is to have the total sum of outage hours, but I cannot simply sum all outages because there can be multiple incidents within the same time range. For those within the same range, I want to calculate only the difference. 

 

Example

 

Inc1
Start: May 23, 2024, at 03:26:11
End: May 23, 2024, at 08:15:33

 

Inc2

Start: May 23, 2024, at 08:15:33
End: May 23, 2024, at 08:16:33

 

but in that case, for example, Inc2 should consider only the part that does not overlap with Inc1:

Start: May 23, 2024, at 08:15:33
End: May 23, 2024, at 08:16:33

 

 

 

Inc3
Start: May 24, 2024, at 03:26:11
End: May 24, 2024, at 08:15:33

 

Sum of unique intervals:
Sum of seconds:
22 + 22 = 44 seconds

Sum of minutes:
49 + 1 + 49 = 99 minutes

99 minutes is equal to 1 hour and 39 minutes.

Sum of hours:
4 + 4 + 1 (carryover from minutes) = 9 hours

 

Final result:
Therefore, the sum of all unique intervals is:

9 hours, 39 minutes, and 44 seconds

 

How can I do that?

0 REPLIES 0