Created
March 27, 2014 19:52
-
-
Save sorah/9816731 to your computer and use it in GitHub Desktop.
zabbix -> idobata
This file contains 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
# 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