From 44aa214b850ad4d085295af617cee37d7664a3f6 Mon Sep 17 00:00:00 2001 From: Marius Pana Date: Sat, 16 Sep 2023 06:53:17 +0000 Subject: [PATCH] Add 'local checks/livestatusstats.py' monitor some livestsatus stats, not sure it is completely right .. --- local checks/livestatusstats.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 local checks/livestatusstats.py diff --git a/local checks/livestatusstats.py b/local checks/livestatusstats.py new file mode 100644 index 0000000..57a6491 --- /dev/null +++ b/local checks/livestatusstats.py @@ -0,0 +1,17 @@ +#!/usr/bin/env python +with open("/opt/omd/sites//var/log/liveproxyd.state") as f: + out = {} + + for line in f: + if line.strip().startswith('['): + sitename = line + if line.strip().startswith('Channels'): + tmp = [] + for line in f: + if line.strip().startswith("Clients"): + out[sitename] = tmp + break + tmp.append(line) + + for k,v in out.items(): + print("0 lp-{s} total={t};;|ready={r};;|busy={b};;|heartbeat={h};; {s} site livestatus channel states").format(s=k.strip()[1:-1],r=sum('ready' in s for s in v),b=sum('busy' in s for s in v),h=sum('heartbeat' in s for s in v),t=len(v)) \ No newline at end of file