Page 1 of 1

Different message by device instead of user

Posted: Wed Jul 26, 2017 8:36 am
by sstrudwick
I have many different type of devices and would like to have a special message based on device instead of by user. I am still in evaluation mode and this would be huge for me. Is this possible? I have looked at notification settings and know that there are templates but from what I am finding is that the messages are based on user. example would be "IT support" gets alerts for remote site connectivity. I would like this to be specific messages based on remote site. "IT Support" also gets alerts based on servers. I would like the message to basically be a list of basic how to's based on the server/service type.

If this is possible can you point me to a document that explains this.

Thanks in advance.

Scott

Re: Different message by device instead of user

Posted: Wed Jul 26, 2017 2:37 pm
by dwhitfield
You can set up different commands for each type of device.

Here's the default notify-host-by-email command:

Code: Select all

/usr/bin/printf "%b" "***** Nagios Monitor XI Alert *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
But, you could turn that into as many as you want (you know, given space limits). The following two are simple, but illustrate the point:

Code: Select all

/usr/bin/printf "%b" "***** Nagios Monitor XI Alert *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /bin/mail -s "DEVELOPERS DEVELOPERS DEVELOPERS ** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$

Code: Select all

/usr/bin/printf "%b" "***** Nagios Monitor XI Alert *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /bin/mail -s "GNU SLASH LINUX ** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
You can learn more about the variables at https://assets.nagios.com/downloads/nag ... olist.html

It's ***VERY*** important that you understand the following: https://assets.nagios.com/downloads/nag ... ntacts.pdf

Re: Different message by device instead of user

Posted: Tue Aug 01, 2017 9:45 am
by sstrudwick
Thanks for the direction. I am working on that now.

Re: Different message by device instead of user

Posted: Tue Aug 01, 2017 4:57 pm
by tmcdonald
Let us know if you need more help!