17 lines
715 B
Python
17 lines
715 B
Python
|
#!/usr/bin/env python
|
||
|
with open("/opt/omd/sites/<SITENAME>/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))
|