Created
January 29, 2020 15:21
-
-
Save cherts/e14bcce0f43ffd7b701fba8c6990da9a to your computer and use it in GitHub Desktop.
zabbix-agent systemd service discovery
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| UserParameter=systemd.service.discovery,sys_list=$(systemctl list-unit-files | grep ".service" | awk '{split($0,a,".service"); split($0,b," "); print "\"{#SERVICE}\":\""a[1]"\",\"{#STATE}\":\"" b[2]"\""}'); echo -n '['; for s in $sys_list; do echo -n "{"$s"},"; done | sed 's/.$//' ; echo -n ']' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment