send Graphite output to Slack

Oct 22, 2014

Just a quick recipe to send rendered graphs from Graphite to Slack, using your crontab(5) and Incoming Webhooks:

0  5  *  *  * /path/to/ >/dev/null

This will send a message to your webhook's default channel every day at 5am, and Slack show you a preview of the graph in the channel. For completeness' sake (!) here's the contents of `/path/to/`:

PAYLOAD='payload={\'text\': \'<$GRAPH|daily metric graph>\'}'
curl -s --dump-header - -X POST --data-urlencode '$PAYLOAD'

UPDATE: the initial version had a bug with single quotes which ought to have been double quotes. Thanks to GregTheRules for catching that.