diff --git a/monitor.py b/monitor.py index e458145..a0a83d5 100644 --- a/monitor.py +++ b/monitor.py @@ -26,6 +26,7 @@ import logging import sys +import os import csv from itertools import islice @@ -536,19 +537,20 @@ def process_message(_bmessage): # log only to file if system is NOT OpenBridge event (not logging open bridge system, name depends on your OB definitions) AND transmit time is LONGER as 2sec (make sense for very short transmits) if LASTHEARD_INC: if int(float(p[9]))> 2: + curDir = os.getcwd() log_lh_message = '{},{},{},{},{},{},{},TS{},TG{},{},{},{}'.format(_now, p[9], p[0], p[1], p[3], p[5], alias_call(int(p[5]), subscriber_ids), p[7], p[8],alias_tgid(int(p[8]),talkgroup_ids),p[6], alias_short(int(p[6]), subscriber_ids)) - lh_logfile = open('/opt/HBmonitor/log/lastheard.log', "a") + lh_logfile = open(curDir+"/log/lastheard.log", "a") lh_logfile.write(log_lh_message + '\n') lh_logfile.close() # Lastheard in Dashboard by SP2ONG my_list=[] n=0 - f = open("/opt/HBmonitor/templates/lastheard.html", "w") + f = open(curDir+"/templates/lastheard.html", "w") f.write("
\n") f.write(" .: Lastheard (10) :. \n") f.write("\n") f.write("\n") - with open('/opt/HBmonitor/log/lastheard.log', 'r') as textfile: + with open(curDir+"/log/lastheard.log", "r") as textfile: for row in islice(reversed(list(csv.reader(textfile))),100): duration=row[1] dur=str(int(float(duration.strip())))
DateTimeSlotTG#TG NameCallsign (DMR-Id)NameDur TX (s)Source IDSystem