Execute a script located on Zabbix server on trigger -


we monitoring our production environments using zabbix 2.4. new instances provisioned ansible sets zabbix agent. need hosts removed server if have been terminated receive messages running instances becoming unavailable.

to wrote python script can take zabbix host name argument, check if host on list of running instances calling awscli , delete host if it's not on "not terminated" list.

i put script in /usr/bin/delete_host.py , configured action call when "agent not available" trigger activated. how operation tab looks link

and here action log link

i've tried couple of ways write command, placed script in externalscripts directory. turned on debug logs server nothing in mentioned error or anything. in fact showed messages command being executed , ok, host still there. when copy command action log , execute manually works fine.

at point out of options on how troubleshoot further. disabled selinux , added zabbix user sudoers file nopasswd. can't find in logs. possible execute non-messaging scripts zabbix?

try write script in way print "ok" or 0 if ran , error message or error code if fails. run script using active zabbix agent item on zabbix server host (use function system.run). in way you'll able create trigger raise error if script fails run.

you can schedule using different tool such rundeck.


Comments