Stopping acknowledegement notification?


#1

I am looking for a way to stop sending acknowledgement notifications but I have been unable to figure it out.
I use acknowledgements to stop the warnings and criticals from showing up in different systems, but I do not want them to send e-mails.

The thing is that all e-mails goes to an external provider that converts them to SMS messages, however the acknowledgements got to long a subject to create as SMSes, so all that happens is that me and the external provider get a few errors every time someone acknowledges a problem.


#2

When you’re at the aknowledgement page of the probelmatic host/service, under “Command options” just uncheck the “Send notification” checkbox and that should surpress the ack. notifications.


#3

Yeah, I’ve seen that option, but trying to teach my fellow technicians to uncheck that every time is harder than learning a monkey to speak.

I would be pretty satisfied with just having the checkbox unchecked by default, do you know how one would achieve that?


#4

[blockquote]Yeah, I’ve seen that option, but trying to teach my fellow technicians to uncheck that every time is harder than learning a monkey to speak.
[/blockquote]
:smiley: Hehe, know how you feel

Seems to me like you would have to change the source code and compile it again. If you have test box on which you could do that it would be good. I wouldn’t advise you to change the code on a system that works. Except if you are very experienced user and you know what you are doing.

I’m not very good at this but I think I have found what has to be changed (haven’t tested it, so it might be a mistake). In the source folder /base/ there is a commands.c file and in it there is part of the code that says:

/* acknowledges a host or service problem */ int cmd_acknowledge_problem(int cmd,char *args){ service *temp_service=NULL; host *temp_host=NULL; char *host_name=""; char *svc_description=""; char *ack_author; char *ack_data; char *temp_ptr; int type=ACKNOWLEDGEMENT_NORMAL; int notify=TRUE; int persistent=TRUE;

I think you have to change:

to:

WARNING!! Again, I say, I’m not good at this, so take my advices as not-100% sure. Don’t do anything if you don’t know what you are doing. I haven’t done this, so it might be a total mistake


#5

Oh, that seems very promising. Nothing I can try here at work right now, but I think I’ll try it at home tonight.

Thank you very much for an excellent suggestion!


#6

Back again!

I tried compiling nagios with the suggested variable changed, didn’t seem to change anything though.

I followed your trail of thought and grep:ed through some of the source code.

I found the following, seems to be the code actually creating the html.

cgi/cmd.c case CMD_ACKNOWLEDGE_HOST_PROBLEM: printf("<tr><td CLASS='optBoxRequiredItem'>Host Name:</td><td><b>"); printf("<INPUT TYPE='TEXT' NAME='host' VALUE='%s'>",escape_string(host_name)); printf("</b></td></tr>\n"); if(cmd==CMD_ACKNOWLEDGE_HOST_PROBLEM){ printf("<tr><td CLASS='optBoxItem'>Sticky Acknowledgement:</td><td><b>"); printf("<INPUT TYPE='checkbox' NAME='sticky_ack' CHECKED>"); printf("</b></td></tr>\n"); printf("<tr><td CLASS='optBoxItem'>Send Notification:</td><td><b>"); printf("<INPUT TYPE='checkbox' NAME='send_notification' CHECKED>"); printf("</b></td></tr>\n"); } printf("<tr><td CLASS='optBoxItem'>Persistent%s:</td><td><b>",(cmd==CMD_ACKNOWLEDGE_HOST_PROBLEM)?" Comment":""); printf("<INPUT TYPE='checkbox' NAME='persistent' %s>",(cmd==CMD_ACKNOWLEDGE_HOST_PROBLEM)?"":"CHECKED"); printf("</b></td></tr>\n"); printf("<tr><td CLASS='optBoxRequiredItem'>Author (Your Name):</td><td><b>"); printf("<INPUT TYPE='TEXT' NAME='com_author' VALUE='%s' %s>",escape_string(comment_author),(lock_author_names==TRUE)?"READONLY DISABLED":""); printf("</b></td></tr>\n"); printf("<tr><td CLASS='optBoxRequiredItem'>Comment:</td><td><b>"); printf("<INPUT TYPE='TEXT' NAME='com_data' VALUE='%s' SIZE=40>",escape_string(comment_data)); printf("</b></td></tr>\n"); break;

can someone more used to C perhaps explain what strings this could amount to:

and what about the HTML, to create a unchecked checkbox does one simply omit the word ‘CHECKED’?


#7

I tried the following code:

Seems as omiting the word ‘CHECKED’ or changing it to ‘UNCHECKED’ are both valid ways to get the box unchecked.

Soo what the C code I asked about does is the following, it checkes if ‘cmd’ equals ‘CMD_ACKNOWLEDGE_HOST_PROBLEM’ if it is the empty string is delivered and if not the string ‘CHECKED’ is delivered.

What my dull mind could not penetrate was nothing more than a simple if-then-else statement. :stuck_out_tongue:

I’ll try changing this piece of code instead, will get back with the results soon!


#8

Yes!

After changing row 948 to

and 974 to

in cgi/cmd.c everything works like a charm!

Thank you again Albin for getting me on the right track!