From 2d78bddbba296777ad127f9c22f0fc8d238ff9f0 Mon Sep 17 00:00:00 2001 From: hurtcrushing Date: Mon, 25 Oct 2021 14:34:18 +0200 Subject: [PATCH 1/2] Search for entries in ZPROCESS but not in ZLIVEUSAGE --- mvt/ios/modules/net_base.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/mvt/ios/modules/net_base.py b/mvt/ios/modules/net_base.py index 591b595..8b1bccc 100644 --- a/mvt/ios/modules/net_base.py +++ b/mvt/ios/modules/net_base.py @@ -39,7 +39,9 @@ class NetBase(IOSExtraction): ZLIVEUSAGE.ZHASPROCESS, ZLIVEUSAGE.ZTIMESTAMP FROM ZLIVEUSAGE - LEFT JOIN ZPROCESS ON ZLIVEUSAGE.ZHASPROCESS = ZPROCESS.Z_PK; + LEFT JOIN ZPROCESS ON ZLIVEUSAGE.ZHASPROCESS = ZPROCESS.Z_PK + UNION + SELECT ZFIRSTTIMESTAMP, ZTIMESTAMP, ZPROCNAME, ZBUNDLENAME, Z_PK, NULL, NULL, NULL, NULL, NULL, NULL, NULL FROM ZPROCESS WHERE Z_PK NOT IN (SELECT ZHASPROCESS FROM ZLIVEUSAGE); """) for row in cur: @@ -68,7 +70,7 @@ class NetBase(IOSExtraction): "wwan_out": row[8], "live_id": row[9], "live_proc_id": row[10], - "live_isodate": live_timestamp, + "live_isodate": live_timestamp if row[10] else first_isodate, }) cur.close() @@ -89,7 +91,7 @@ class NetBase(IOSExtraction): }] # Only included first_usage and current_usage records when a ZPROCESS entry exists. - if "MANIPULATED" not in record["proc_name"] and "MISSING" not in record["proc_name"]: + if "MANIPULATED" not in record["proc_name"] and "MISSING" not in record["proc_name"] and record["live_proc_id"] is not None: records.extend([ { "timestamp": record["first_isodate"], @@ -151,6 +153,8 @@ class NetBase(IOSExtraction): msg = msg + " (However, the process name might have been truncated in the database)" self.log.warning(msg) + if not proc["live_proc_id"]: + self.log.warning(f"Found process entry in ZPROCESS but not in ZLIVEUSAGE : {proc['proc_name']} at {proc['live_isodate']}") def check_manipulated(self): """Check for missing or manipulate DB entries""" From 635d3a392d366714cbb29a7a6538e7b88d0bd210 Mon Sep 17 00:00:00 2001 From: hurtcrushing Date: Mon, 25 Oct 2021 14:54:03 +0200 Subject: [PATCH 2/2] change warning to info --- mvt/ios/modules/net_base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mvt/ios/modules/net_base.py b/mvt/ios/modules/net_base.py index 8b1bccc..adc92f5 100644 --- a/mvt/ios/modules/net_base.py +++ b/mvt/ios/modules/net_base.py @@ -154,7 +154,7 @@ class NetBase(IOSExtraction): self.log.warning(msg) if not proc["live_proc_id"]: - self.log.warning(f"Found process entry in ZPROCESS but not in ZLIVEUSAGE : {proc['proc_name']} at {proc['live_isodate']}") + self.log.info(f"Found process entry in ZPROCESS but not in ZLIVEUSAGE : {proc['proc_name']} at {proc['live_isodate']}") def check_manipulated(self): """Check for missing or manipulate DB entries"""