Icinga2 - Notification Scripts for Notificiation on Twitter through Twidge

Revision as of 03:14, 11 October 2019 by Ardaut (talk | changes) (Created page with "Twidge must be installed and configured. In Icinga2: You have to configure notification templates and apply it also. <br> === Service notification script /etc/icinga2/scripts/...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Twidge must be installed and configured. In Icinga2: You have to configure notification templates and apply it also.

Service notification script /etc/icinga2/scripts/twitter-service-notification.sh

#!/bin/bash
if [ $NOTIFICATIONTYPE = 'CUSTOM' ]
then
        /bin/echo "#$NOTIFICATIONTYPE - Service $SERVICEDISPLAYNAME. $NOTIFICATIONCOMMENT" | twidge -c /etc/icinga2/twidgerc update
else
        if [ "$SERVICESTATE" = 'UP' ] || [ "$SERVICESTATE" = 'OK' ]
        then
                        /bin/echo "#$NOTIFICATIONTYPE - SERVICE #$SERVICEDISPLAYNAME is $SERVICESTATE. Sorry for any inconvenience." | twidge -c /etc/icinga2/twidgerc update
        else
                        /bin/echo "#$NOTIFICATIONTYPE - SERVICE #$SERVICEDISPLAYNAME on #$HOSTALIAS is $SERVICESTATE. Will be fixed." | twidge -c /etc/icinga2/twidgerc update
        fi

fi

Host notification script /etc/icinga2/scripts/twitter-host-notification.sh

  1. !/bin/sh

if [ $NOTIFICATIONTYPE = 'CUSTOM' ] then

       /bin/echo "#$NOTIFICATIONTYPE - Server $HOSTALIAS. $NOTIFICATIONCOMMENT" | twidge -c /etc/icinga2/twidgerc update

else

       if [ "$SERVICESTATE" = 'UP' ] || [ "$SERVICESTATE" = 'OK' ]
       then
                       /bin/echo "#$NOTIFICATIONTYPE - SERVER #$HOSTALIAS is $HOSTSTATE. Sorry for any inconvenience." | twidge -c /etc/icinga2/twidgerc update
       else
                       /bin/echo "#$NOTIFICATIONTYPE - SERVER #$HOSTALIAS is $HOSTSTATE. Will be fixed." | twidge -c /etc/icinga2/twidgerc update
       fi

fi