Skip to content
Snippets Groups Projects
Verified Commit 763ff08e authored by Florian Pritz's avatar Florian Pritz
Browse files

zabbix-agent/accounting: Support @ in unit names


Signed-off-by: default avatarFlorian Pritz <bluewind@xinu.at>
parent ca7ed787
No related branches found
No related tags found
No related merge requests found
......@@ -23,6 +23,6 @@ def get_unit_prop(interface, propname):
for u in units:
unit_properties = dbus.Interface(bus.get_object('org.freedesktop.systemd1', u[6]), dbus_interface='org.freedesktop.DBus.Properties')
if get_unit_prop(unit_properties, "CPUAccounting") or get_unit_prop(unit_properties, "MemoryAccounting"):
discovered.append({"{#UNITNAME}": u[0]})
discovered.append({"{#UNITNAME}": u[0].replace("@", "--AT--")})
print(json.dumps({"data": discovered}));
......@@ -22,7 +22,7 @@ UserParameter=systemd.unit.is-enabled[*],systemctl is-enabled --quiet '$1' && ec
UserParameter=systemd.failed_units,/usr/local/bin/systemd-units-failed.py
UserParameter=systemd.accounting_discover,/usr/local/bin/systemd-discover-accounting-units.py
UserParameter=systemd.unit_data[*],systemctl show '$1' | perl -MJSON -ne 'BEGIN{my %h}; my ($$k,$$v) = split(/=/,$$_,2); chomp($$h{$$k} = $v); END {print encode_json(\%h)};'
UserParameter=systemd.unit_data[*],systemctl show $(echo '$1' | sed 's#--AT--#@#g') | perl -MJSON -ne 'BEGIN{my %h}; my ($$k,$$v) = split(/=/,$$_,2); chomp($$h{$$k} = $v); END {print encode_json(\%h)};'
UserParameter=postfix.pfmailq,mailq | grep -v "Mail queue is empty" | grep -c '^[0-9A-Z]'
UserParameter=postfix[*],/usr/local/bin/postfix-zabbix-stats.sh $1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment