Page 1 of 1

force always send ack notifications

Posted: Thu Jul 31, 2014 2:38 pm
Is there an easy way to remove the ability for users to disable ack notifications?

When integrated with pagerduty, ack notifications are required for the pagerduty service to be ack'd from nagios. For some reason, users always want to uncheck the notification box (see attached).

So, I want to ALWAYS send ack notifications when a service or host problem is ackd...

How?

Re: force always send ack notifications

Posted: Thu Jul 31, 2014 5:13 pm
by tmcdonald
An easy way? Not really. You would need to make that modification in the CGI source for cmd.cgi and recompile. Essentially you would have to remove that check box or make it hidden in the HTML, but still send the checked value so Nagios knows to send the notification.

Edit: Actually, you might be able to just set

Code: Select all

int persistent_comment = TRUE;
near the beginning of the code because it is FALSE by default and doing so would keep it as TRUE since unchecking the box does nothing but checking it sets it to TRUE.

Re: force always send ack notifications

Posted: Fri Sep 12, 2014 3:26 pm
I am still (back to actually) working with this, and related issues.

Is there a reference for variables included in cmd.c + their related functions?

Re: force always send ack notifications

Posted: Fri Sep 12, 2014 4:03 pm
by abrist
Not beyond what is mentioned in the source comments. Did you try editing the variable as tmcd suggested?

Re: force always send ack notifications

Posted: Fri Sep 12, 2014 4:31 pm
yes, I also made the checkbox hidden.

An unintended side effect is it DIDN'T send acks at all to pagerduty anymore.

It's a time consuming process in my environment to change the code, build, and deploy the test so I was hoping for a little more visibility into the variables as I don't want to change more than one value per test. The naming is fairly straightforward, but not sure exactly the intended result of changing, for example (and especially):

int send_notification=FALSE;
int force_notification=0;

Thanks in advance!

Paul

Re: force always send ack notifications

Posted: Mon Sep 15, 2014 5:07 pm
by Nagios Support
Trevor is the person who is most familiar with this issue. He is not working today, but he should be in tomorrow and will follow up with you.

Re: force always send ack notifications

Posted: Tue Sep 16, 2014 2:02 pm
by tmcdonald
In your original post, you showed Persistent Comment as being unchecked, so I think I was looking at that when I wrote my reply. The variable that would make sense to change to TRUE is actually send_notification. force_notification and broadcast_notification have to do with modifying the normal notification logic as described below:

http://old.nagios.org/developerinfo/ext ... and_id=134

As for more comments on the code, that is something the core devs would need to decide on. My guess is that most people who would be digging into the source would be used to variables being self-documenting, and since a lot of these are only referenced a few times their uses wouldn't be too hard to figure out.

Re: force always send ack notifications

Posted: Tue Sep 16, 2014 4:25 pm
by prennix
after looking into this some more, the original suggestion was correct. I was hiding the checkbox/option the incorrect way.

The way I ended up doing it was hiding the row:

printf("<tr><td CLASS='optBoxItem'></td><td><b>");

altering it to:

printf("<tr style='display:none;'><td CLASS='optBoxItem'></td><td><b>");

(using the smae method for service and host notification checkboxes/text)

Thank you for your help.