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