Source code for saltext.zabbix.returners.zabbix_return
"""Return salt data to ZabbixThe following Type: "Zabbix trapper" with "Type of information" Text items are required:.. code-block:: cfg Key: salt.trap.info Key: salt.trap.warning Key: salt.trap.highTo use the Zabbix returner, append '--return zabbix' to the salt command. ex:.. code-block:: bash salt '*' test.ping --return zabbix"""importos# Define the module's virtual name__virtualname__="zabbix"def__virtual__():ifzbx():returnTruereturnFalse,"Zabbix returner: No zabbix_sender and zabbix_agend.conf found."defzbx():ifos.path.exists("/usr/local/zabbix/bin/zabbix_sender")andos.path.exists("/usr/local/zabbix/etc/zabbix_agentd.conf"):zabbix_sender="/usr/local/zabbix/bin/zabbix_sender"zabbix_config="/usr/local/zabbix/etc/zabbix_agentd.conf"return{"sender":zabbix_sender,"config":zabbix_config}elifos.path.exists("/usr/bin/zabbix_sender")andos.path.exists("/etc/zabbix/zabbix_agentd.conf"):zabbix_sender="/usr/bin/zabbix_sender"zabbix_config="/etc/zabbix/zabbix_agentd.conf"return{"sender":zabbix_sender,"config":zabbix_config}else:returnFalsedefzabbix_send(key,output):cmd=zbx()["sender"]+" -c "+zbx()["config"]+" -k "+key+' -o "'+output+'"'__salt__["cmd.shell"](cmd)
[docs]defsave_load(jid,load,minions=None):# pylint: disable=unused-argument""" Included for API consistency """