Are you wondering how many alternative ways to get notifications from your nagios/icinga exists, other than plain email messages? And what if you actually are monitoring your email or DNS infrastructure and you don’t want to use a third-party email account dedicated to our precious notices?

An alternative and effective method to deliver the short status notification is via Twitter messages, using a protected account (for privacy).

Register a new standard Twitter account and make sure to enable in the settings:

twitter privacy settings

We need to install on the monitoring server a command-line Twitter client, such as Twidge:

sudo apt-get install twidge

Do the one-time configuration procedure with the user you prefer:

twidge setup

Move the generated configuration file from your home folder somewhere into the nagios/icinga configuration folder:

sudo mv ~/.twidgerc /etc/icinga/twidgerc

Now add two new custom commands in the nagios/icinga configuration:


define command {
        command_name	notify-host-by-twitter
        command_line	/bin/echo "HOST $HOSTALIAS$ is $HOSTSTATE$" | twidge -c /etc/icinga/twidgerc update
define command {
	command_name	notify-service-by-twitter
	command_line	/bin/echo "SERVICE $SERVICEDESC$ on $HOSTALIAS$ is $SERVICESTATE$" | twidge -c /etc/icinga/twidgerc update

Now you need to use such commands as host and service notifications, like here:

define contact {
        contact_name                    root
        alias                           Root
        service_notification_period     24x7
        host_notification_period        24x7
        service_notification_options    w,u,c,r
        host_notification_options       d,r
        service_notification_commands   notify-service-by-twitter
        host_notification_commands      notify-host-by-twitter

Reload and enjoy!

sudo /etc/init.d/icinga reload

space new robot