From 0942fb46fb98913e91beb211eb00b7e7ee4cdd43 Mon Sep 17 00:00:00 2001 From: Cory Hawkless Date: Thu, 6 Oct 2022 13:04:00 +1030 Subject: [PATCH] Added job_last_success_unixtime --- namespace_conntrack_check.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/namespace_conntrack_check.py b/namespace_conntrack_check.py index 240d472..7e1ff65 100644 --- a/namespace_conntrack_check.py +++ b/namespace_conntrack_check.py @@ -12,12 +12,16 @@ while True: registry = CollectorRegistry() g_count = Gauge('test_nf_conntrack_count', 'nf_conntrack_count inside given namespace', ['host','namespace'],registry=registry ) g_max = Gauge('test_nf_conntrack_max', 'nf_conntrack_max inside given namespace', ['host','namespace'],registry=registry ) + g_time = Gauge('job_last_success_unixtime', 'Last time a batch job successfully finished', registry=registry) + g_time.set_to_current_time() for _item in netns.listnetns(): if str(_item).startswith("qrouter"): nsp = NSPopen(_item, ['cat', '/proc/sys/net/netfilter/nf_conntrack_count'], stdout=subprocess.PIPE) result=nsp.communicate() nsresult_count=(result[0].decode('ascii').strip()) - + nsp.wait() + nsp.release() + nsp = NSPopen(_item, ['cat', '/proc/sys/net/netfilter/nf_conntrack_max'], stdout=subprocess.PIPE) result=nsp.communicate() nsresult_max=(result[0].decode('ascii').strip())