Skip to content

Instantly share code, notes, and snippets.

@sorah
Created March 27, 2014 19:52
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sorah/9816731 to your computer and use it in GitHub Desktop.
Save sorah/9816731 to your computer and use it in GitHub Desktop.
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