Nagios 2.x custom headers in critical and warning letters


#1

good day, comrades! :slight_smile:

i’d like to know is it possible to add custom headers to email notifications which are alerting CRITICAL or WARNING type of problems?

i need to add “X-Priority 1” header to every notification letter. I know i can make it by passing an option -a “X-Priority 1” to /bin/mail command, but it’ll mark all notifications when i need only CRITICAL and WARNING messages to be marked.

any suggestions?
thanks in advance.


#2

Good day to you!

I’ve never wondered about this problem, so this solution may not be the best one, but it should work:

I assume your using the notify-by-email command when trying to send a mail … if not, either you understand what I’m trying to say, or could you post your config for sending mails ? (contactgroups, contacts, command …etc).

You’ll just have to modify the notify-by-email command; instead of directly sending an email via /bin/mail, change it so that it calls a script of your own with -more or less- the same arguments;
inside this script, you’ll just have to write an if-then-else algorithm which will decide what the title of the mail will be, depending on the severity … and voila!

I hope it is clear enough … if not, just ask :wink:


#3

great! thank you
why didn’t i guess it :slight_smile: