English English

An Icinga2 notification through Twitter has been set up for running servers

My existing Icinga2 monitoring instance has been extended by another notification option via the social network "Twitter". Notifications about my servers and services are now also published via Twitter.

For several years now I have been running my monitoring instance for my servers worldwide, which provides me with information about my services and hosts. Now Icinga2 notifications are published via Twitter in addition to e-mail and telegram. For this the program "twidge" is used, which is called in the Icinga2 notification script. An example code for host notifications is shown at the end of this article. The notification script uses Icinga2 variables to retrieve notification information about services and hosts.

A new Twitter account has been created with a developer account that is used to send tweets via the twidge program. OAUTH (authentication) provides access to the Twitter account. Depending on the type of notification (host or services) and state (problem, OK, ..), a specific tweet is published that includes the Icinga2 notification.

This newly created Twitter account is also used for information about maintenance work on servers or services, as well as for other types of messages.

More about twidge: https://github.com/jgoerzen/twidge/wiki

Notification script (example):

        /bin/echo "#$NOTIFICATIONTYPE - Server $HOSTALIAS. $NOTIFICATIONCOMMENT" | twidge -c /etc/icinga2/twidgerc update
        if [ "$HOSTSTATE" = 'UP' ] || [ "$HOSTSTATE" = 'OK' ]
                        /bin/echo "#$NOTIFICATIONTYPE OK - SERVER #$HOSTALIAS is $HOSTSTATE. Bitte entschuldigen Sie die Unannehmlichkeiten." | twidge -c /etc/icinga2/twidgerc update
                        /bin/echo "#$NOTIFICATIONTYPE - SERVER #$HOSTALIAS is $HOSTSTATE. Problem wird so schnell wie möglich behoben." | twidge -c /etc/icinga2/twidgerc update

We use cookies on our website. They are essential for the operation of the site