Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
zabbix -> idobata
# Set the following script to "Actions -> Operations -> Remote command (target: current host, execute on: zabbix server)"
# http://img.sorah.jp/z-20140328-045035.png
# ruby is required
bash <<'EOF'
YOUR_ZABBIX_DOMAIN="zabbix"
IDOBATA_HOOK="http://idobata.io/hooks/XXX"
LABEL="$(ruby -e'puts %w(default inverse warning important important important)[ARGV[0].to_i]' -- {TRIGGER.NSEVERITY})"
[ "_{TRIGGER.STATUS}" = "_OK" ] && LABEL="success"
curl --data-urlencode 'source=<span class="label label-'$LABEL'">{TRIGGER.STATUS}</span> <span class="label label-'$LABEL'">{TRIGGER.SEVERITY}</span> <b>{HOST.HOST}:</b> {TRIGGER.NAME}<br>{ITEM.NAME1}: {ITEM.VALUE1}<br>{ITEM.NAME2}: {ITEM.VALUE2}<br>{ITEM.NAME3}: {ITEM.VALUE3}<br><img src="http://'$YOUR_ZABBIX_DOMAIN'/chart.php?itemid={ITEM.ID}&period=3600&width=600" width="400px">' -d format=html $IDOBATA_HOOK
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.