Added job_last_success_unixtime

This commit is contained in:
Cory Hawkless 2022-10-06 13:04:00 +10:30
parent 27177cbd74
commit 0942fb46fb
1 changed files with 5 additions and 1 deletions

View File

@ -12,11 +12,15 @@ 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()