Page 1 of 2
Nagios XI Monitoring Wizards Step 5
Posted: Tue Dec 02, 2014 6:07 pm
by emartine
So I have gone through and created my own custom wizard with default services, time frames and templates but one thing still is still an issue.
When running the monitoring wizard like the nrpe wizard, in step 5, it has the send alert notifications to Myself, Other individuals, and Specific contact groups check boxes checked.
I have defined a contact group in the wizard (it adds the group) but I also get added as a contact by default unless I uncheck the check boxes in step 5. How can I get the check boxes in step 5 to be unchecked by default?
Re: Nagios XI Monitoring Wizards Step 5
Posted: Wed Dec 03, 2014 10:17 am
by tmcdonald
That's an HTML thing. I believe you would just need to leave out any "checked" attributes to the <input> element like so:
Code: Select all
<input type="checkbox" class="checkbox" name="services[commands][whatever]">
Re: Nagios XI Monitoring Wizards Step 5
Posted: Wed Dec 03, 2014 10:25 am
by emartine
File name and location?
Re: Nagios XI Monitoring Wizards Step 5
Posted: Wed Dec 03, 2014 10:40 am
by tmcdonald
I can't really say for sure because that would be something in your custom wizard that needs to be changed. But it should be in the wizardname.inc.php file under the "case CONFIGWIZARD_MODE_GETSTAGE4OPTS" section. However looking at existing wizards I don't see any that explicitly state what to display in that section, so it might be one that our wizard framework populates automatically.
If that is the case (and I believe it is) you might need to put in some javascript that would change the:
Code: Select all
<input id="notification_targets_myself" type="checkbox" checked="" name="notification_targets[myself]">
element to have a forced non-checked attribute, something like this in jQuery:
Code: Select all
$('#notification_targets_myself').attr('checked', false);
Re: Nagios XI Monitoring Wizards Step 5
Posted: Wed Dec 03, 2014 11:47 am
by emartine
First it was html and now java..... hmmm... I'm not seeing the CONFIGWIZARD_MODE_GETSTAGE4OPTS in any of the files. Right now I am modifying the nrpe wizard.
Re: Nagios XI Monitoring Wizards Step 5
Posted: Wed Dec 03, 2014 11:51 am
by tmcdonald
emartine wrote:First it was html and now java
Javascript*. Totally different beast.
You might be able to add in a new case statement to run it manually then. Have you looked at the demo wizard for reference?
http://exchange.nagios.org/directory/Ad ... rd/details
Pretty well-commented and explains about the different sections in a wizard.
Re: Nagios XI Monitoring Wizards Step 5
Posted: Wed Dec 03, 2014 4:57 pm
by emartine
I was hoping for someone to give me an answer who understood it. I've read through the demo link but not learning much from it.
Re: Nagios XI Monitoring Wizards Step 5
Posted: Wed Dec 03, 2014 6:19 pm
by tmcdonald
You need to add in your own stage 4 HTML section like so to the cases:
Code: Select all
case CONFIGWIZARD_MODE_GETSTAGE4OPTS:
echo "<script type='text/javascript'>setTimeout(function(){\$('#notification_targets_myself').attr('checked', false);},500);</script>";
break;
That will run a javascript function after a short 500ms delay (to allow the page to load fully) which will uncheck the "Myself" box. You may need to adjust the 500ms up depending on how long it takes the page to render.
Re: Nagios XI Monitoring Wizards Step 5
Posted: Wed Dec 03, 2014 6:57 pm
by Box293
Have a look at the box293_demonstration_wizard I created. It is heavily commented and is the most detailed documentation you'll get at this point in time.
http://exchange.nagios.org/directory/Ad ... rd/details
I also used this as the basis for my talk (Custom Wizards, Components, Dashlets In Nagios XI) at one of the Nagios World Conference:
https://www.youtube.com/watch?v=wcULFg2dHLc
Re: Nagios XI Monitoring Wizards Step 5
Posted: Thu Dec 04, 2014 11:43 am
by emartine
Awesome. Thank you! In the video you mention hiding the steps. Even though steps are hidden this doesn't mean that defaults aren't applied? In other words, even though they are hidden it doesn't mean we haven't deactivated default settings... and in my case I need to set them to something else if I am expecting different output other than defaults? This is my assumption based on tests/troubleshooting.