|
@@ -20,6 +20,25 @@ Should read all log*.log-files and output
|
|
|
import codecs
|
|
|
import csv
|
|
|
import glob, os
|
|
|
+import datetime
|
|
|
+import getopt
|
|
|
+import sys
|
|
|
+
|
|
|
+
|
|
|
+def args_read(l_search_parameter):
|
|
|
+ l_args = sys.argv[1:]
|
|
|
+
|
|
|
+ try:
|
|
|
+ opts, args = getopt.getopt(l_args,"d:;",["dir=",
|
|
|
+ ])
|
|
|
+ except getopt.GetoptError as err_det:
|
|
|
+ print ("Error in reading parameters:" + str(err_det))
|
|
|
+ print ("Call with --dir= or without any parameters")
|
|
|
+ sys.exit("Abgebrochen wegen Fehler in Aufrufparametern")
|
|
|
+ if opts:
|
|
|
+ for opt, arg in opts:
|
|
|
+ if l_search_parameter == opt: #in ("-u", "--usage"):
|
|
|
+ return arg
|
|
|
|
|
|
|
|
|
def f_get_logfiles_from_dir(l_dir):
|
|
@@ -38,6 +57,7 @@ class read_csv():
|
|
|
self.attribs["file"] = csv.split("\\")[-1]
|
|
|
self.attribs["start"] = ""
|
|
|
self.attribs["end"] = ""
|
|
|
+ self.attribs["duration"] = ""
|
|
|
self.attribs["server"] = ""
|
|
|
self.attribs["computer"] = ""
|
|
|
self.attribs["users"] = 0
|
|
@@ -87,6 +107,8 @@ class read_csv():
|
|
|
# Server:
|
|
|
if "set_default: Server:" in l_string:
|
|
|
self.attribs["server"] = l_string.split(" ")[-1]
|
|
|
+ elif "Server: " in l_string:
|
|
|
+ self.attribs["server"] = l_string.split(" ")[-1]
|
|
|
|
|
|
if "get_l_users: Users: " in l_string:
|
|
|
self.attribs["users"] = int(l_string.split(" ")[-1])
|
|
@@ -99,6 +121,11 @@ class read_csv():
|
|
|
|
|
|
if "printreport" in l_string:
|
|
|
self.__printreport(l_string)
|
|
|
+
|
|
|
+ if len(self.attribs["end"]) > 13 and len(self.attribs["start"]) > 13:
|
|
|
+ self.attribs["duration"] = ( datetime.datetime.strptime(self.attribs["end"], '%Y-%m-%d %H:%M:%S:%f')
|
|
|
+ - datetime.datetime.strptime(self.attribs["start"], '%Y-%m-%d %H:%M:%S:%f') )
|
|
|
+
|
|
|
|
|
|
if self.attribs["mode"] == "":
|
|
|
self.attribs["mode"] = "allnew"
|
|
@@ -169,17 +196,21 @@ def l_export_csvs(l_csvs, l_export_filename):
|
|
|
for l_row_key, l_row_item in l_csv_in.get_all_attribs().items():
|
|
|
if l_row_key == "API-AVG":
|
|
|
for n in range(0, 5):
|
|
|
- if isint(l_row_item[n]):
|
|
|
- l_row_out.append(l_row_item[n])
|
|
|
- elif
|
|
|
+ #if isinstance(l_row_item[n], int):
|
|
|
+ l_row_out.append(str(l_row_item[n]).replace(".", ","))
|
|
|
+ #elif
|
|
|
|
|
|
else:
|
|
|
l_row_out.append(l_row_item)
|
|
|
l_csv_writer.writerow(l_row_out)
|
|
|
|
|
|
+
|
|
|
|
|
|
-
|
|
|
-l_dir = "C:\\Users\\Bernhard\\cs_earthsquad\\CloudStation\\pwa\\Testcases\\API\\ES_API_TEST\\pyAPITest\\dist\\log\\"
|
|
|
+l_dir = args_read("--dir")
|
|
|
+if not l_dir:
|
|
|
+ l_dir = "C:\\Users\\Bernhard\\cs_earthsquad\\CloudStation\\pwa\\Testcases\\API\\ES_API_TEST\\pyAPITest\\dist\\log\\"
|
|
|
+else:
|
|
|
+ l_dir = l_dir + "\\"
|
|
|
|
|
|
l_csvs = {}
|
|
|
|