Subversion Repositories saptoolbox

Rev

Rev 1 | Blame | Compare with Previous | Last modification | View Log | RSS feed

Module: Available
=================
SAP keeps a registry of its (un)available status.
This is an example of the content of available.log (raw data):

Unavailable 18.08.2016 17:31:41 - 19.08.2016 12:15:33
Available   19.08.2016 12:16:33 - 19.08.2016 12:27:33
Unavailable 19.08.2016 12:28:22 - 19.08.2016 12:31:24
Available   19.08.2016 12:32:24 - 19.08.2016 12:33:24
Unavailable 19.08.2016 12:34:19 - 19.08.2016 12:34:24
Available   19.08.2016 12:35:24 - 19.08.2016 12:38:24
Unavailable 19.08.2016 12:38:58 - 19.08.2016 12:39:06
Available   19.08.2016 12:39:07 - 19.08.2016 12:43:07
Unavailable 19.08.2016 12:44:07 - 25.08.2016 10:08:09
Unavailable 01.09.2016 00:28:01 - 01.09.2016 08:35:27
Available   01.09.2016 08:36:27 - 01.09.2016 08:50:27
Unavailable 01.09.2016 08:51:27 - 01.09.2016 08:52:43
Available   01.09.2016 08:53:43 - 02.09.2016 08:23:58
Unavailable 02.09.2016 08:24:58 - 02.09.2016 08:25:36
Available   02.09.2016 08:26:36 - 02.09.2016 16:12:37
Unavailable 02.09.2016 16:12:50 - 02.09.2016 16:28:55
Unavailable 03.09.2016 00:30:34 - 05.09.2016 08:40:33
Available   05.09.2016 08:41:33 - 05.09.2016 08:56:33
Unavailable 05.09.2016 08:57:21 - 05.09.2016 08:59:05

This script extract the fields from each line (registry) and save them
as structured data:

['Unavailable', '29.09.2017', '00:25:03', '-', '29.09.2017', '02:24:51']
['Available', '', '', '29.09.2017', '02:25:51', '-', '06.10.2017', '01:53:06']

Then, get stats and, build the report.

Execution
---------
1) From Python:
    av = Available(logfile=sys.argv[1], sapsid=sys.argv[2], maxdown=int(sys.argv[3]))
    print(av.build_report())
2) From command line
    python saptoolbox/available.py scripts/logs/roca_available.log DBT 10

Output:

Report: SAP System 'DBT' Availability Stats
Source: scripts/logs/roca_available.log
-------------------------------------------

First entry recorded: 2016-08-18 17:31:41
 Last entry recorded: 2017-10-06 01:53:06
        Is Available: True
        SAP Lifetime: 413 days, 8:21:25
         Unavailable: 17 days, 4:35:57, 25 times down, 4.16% of lifetime
           Available: 396 days, 3:04:44, 95.83% of lifetime

Last 10/24 downtimes:
     1 - Down from: 2017-09-29 00:25:03     to: 2017-09-29 02:24:51 Duration: 1:59:48
     2 - Down from: 2017-09-28 19:04:29     to: 2017-09-28 23:46:04 Duration: 4:41:35
     3 - Down from: 2017-09-28 17:54:05     to: 2017-09-28 18:07:30 Duration: 0:13:25
     4 - Down from: 2017-09-28 15:28:07     to: 2017-09-28 17:50:04 Duration: 2:21:57
     5 - Down from: 2017-09-27 14:41:38     to: 2017-09-27 15:01:02 Duration: 0:19:24
     6 - Down from: 2017-09-20 21:01:34     to: 2017-09-20 21:04:29 Duration: 0:02:55
     7 - Down from: 2017-09-19 05:51:26     to: 2017-09-19 05:59:24 Duration: 0:07:58
     8 - Down from: 2017-09-18 21:01:22     to: 2017-09-18 21:04:11 Duration: 0:02:49
     9 - Down from: 2017-09-14 21:31:18     to: 2017-09-14 23:00:16 Duration: 1:28:58
    10 - Down from: 2017-07-18 21:40:18     to: 2017-07-18 21:59:21 Duration: 0:19:03

Report built on 2017-10-14 15:54:22.063946


Disclaimer:
There is no public info about available.log file contents format so I do
my best to extract records and group them.

This report try to be as accurate as possible but, please, doublecheck
results before use them.