Sebastian Nohn

Weblog

(Ab)using twitter for Nagios IM/SMS notification

Two months after signing up for Twitter, I still haven't found a real use for it. I don't see any sense in telling everyone, what I'm doing right now, and it doesn't make sense as some kind of asynchronous multi-user chat as long as it doesn't support channels/rooms. So looking for something useful (well more or less) I tried to abuse their JSON interface for Nagios notification. It is dead simple, much simpler than implementing standard IM or SMS notifications in Nagios and it even seems to comply with Twitter's TOS:

define command {
        command_name    notify-by-twitter
        command_line    /usr/bin/curl --basic --user "user:password" --data-ascii "status=[Nagios] $NOTIFICATIONTYPE$ $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$" http://twitter.com/statuses/update.json
}

define command {
        command_name    host-notify-by-twitter
        command_line    /usr/bin/curl --basic --user "user:password" --data-ascii "status=[Nagios] $HOSTSTATE$ alert for $HOSTNAME$" http://twitter.com/statuses/update.json
}

Posted Jun 01, 2008
Tagged as: Hack, Nagios, Twitter

<<< Page 1 of 1 >>>