How to make nagios send me brief and informative alerts

nagios

The default format for alert messages is:

** RECOVERY Host Alert: server is UP **
***** Nagios *****

Notification Type: RECOVERY
Host: server
State: UP
Address: server.ru
Info: PING OK - Packet loss = 0%, RTA = 26.00 ms

Date/Time: Thu Aug 13 17:08:16 MSD 2009

I want maximum information in minimum letters. First, to be able to get information from SMS. Second, to read only the headers of e-mail messages in 90% cases.

For example, the previous message can be just "H: server is UP" where H stands for Host Alert. If this server is down, I would like to get such a message: [!] H: server is DOWN.

Instead of message, that "Swap usage on server is CRITICAL" I would like to get "[!] S: server/swap usage is >50%" where 50 was taken from the nagios config for check_swap, not hardcoded into the message.

And if "Router/wan2 is CRITICAL", I want to see "ADSL channel is off".

So, to summarize, I want to customize message for every service and its state separately, with ability to use plugin parameters in text.

How can I achieve this?

Best Answer

Nagios can be configured to send notifications by various ways and in various formats. If you need to personalize that please refer to your commands.cfg.
This is an example to show you how to receive a short notification by sms using gnokii:


define command{
        command_name    notify-host-by-sms
        command_line    /usr/bin/printf "%.120s" "$HOSTALIAS$ is $HOSTSTATE$" |/usr/local/bin/gnokii --sendsms $CONTACTPAGER$ -r
        }

define command{ command_name notify-service-by-sms command_line /usr/bin/printf "%.120s" "$HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$" | /usr/local/bin/gnokii --sendsms $CONTACTPAGER$ -r }

The output is like this "hostname is up"

Related Topic