Subversion Repositories saptoolbox

Compare Revisions

Ignore whitespace Rev HEAD → Rev 1

/README
31,42 → 31,6
 
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.
73,4 → 37,3
 
This report try to be as accurate as possible but, please, doublecheck
results before use them.
 
/__init__.py
File deleted
/available.py
203,15 → 203,52
self.stats['REPORT_TXT'] = REPORT
return REPORT
 
#~ def debug(self):
#~ print ("")
#~ print ("Debug stats:")
#~ mytottime = int(availability[True]['seconds'] + availability[False]['seconds'])
#~ saptottime = int(delta.total_seconds())
#~ print (" My total time: %s" % str(timedelta(seconds=mytottime)))
#~ print (" SAP total time: %s" % str(timedelta(seconds=saptottime)))
#~ print (" Gaps: %s" % str(timedelta(seconds=(int(saptottime - mytottime)))))
 
 
if __name__ == "__main__":
try:
av = Available(logfile=sys.argv[1], sapsid=sys.argv[2], maxdown=int(sys.argv[3]))
av = Available(logfile='available.log', sapsid='DBT', maxdown=15)
#~ av.set_sapsid('DEV')
#~ serie = av.get_contents()
#~ av.group_status(serie)
print(av.build_report())
except Exception as error:
raise
msg = "Error. You must provide a path to available.log, SAPSID and Max downtime times\n"
msg += "Eg.: python3 available.py /usr/sap/SID/DVEBMGS00/work/available.log DBT 10"
msg = "Error. You must provide a path to available.log\n"
msg += "Eg.: python3 available.py /usr/sap/SID/DVEBMGS00/work/available.log"
sys.exit (msg)
 
 
 
 
# Build chart
#~ import pygal
#~ dateline = pygal.DateTimeLine(x_label_rotation=35, truncate_label=-1)
#~ status1 = []
#~ status2 = []
#~ for entry in final:
#~ available = entry[0]
#~ dstart = entry[1]
#~ dend = entry[2]
#~ delta = dend - dstart
#~ if not available:
#~ status1.append((dstart, 0))
#~ status1.append((dend, 0))
#~ else:
#~ status2.append((dstart, 1))
#~ status2.append((dend, 1))
 
 
#~ dateline.add("Offline", status1)
#~ dateline.add("Online", status2)
#~ fout = open('chart.svg', 'wb')
#~ fout.write(dateline.render())
#~ fout.close()