Page 1 of 1

contact object required fields

Posted: Sun Oct 19, 2014 4:46 am
by ikrabbe
Hey Nagios Community,

I'm very new to nagios, but a quite experienced unix admin.

Possibly there is an issue in the documentation, that I use to consult, when using new software. (Things that aren't understood, when reading the manual often lead to errors in the use of software.)

http://nagios.sourceforge.net/docs/nagi ... ml#contact

The definition of a contact says, that fields in red are required, which are

Code: Select all

contact_name
host_notifications_enabled
service_notifications_enabled
host_notification_period
service_notification_period
host_notification_options
service_notification_options
host_notification_commands
service_notification_commands
But the examplary

Code: Select all

objects/contact.cfg
reads

Code: Select all

define contact {
  contact_name     nagiosadmin
  use              generic-contact
  alias            Nagios Admin
  contactgroups  admins
  email           none-of-your-business
}
define contactgroup{
  contactgroup_name   admins
  alias               Nagios Administrators
  members             nagiosadmin
}
while the used contact template reads

Code: Select all

        name                            generic-contact         ; The name of this contact template
        service_notification_period     24x7                    ; service notifications can be sent anytime
        host_notification_period        24x7                    ; host notifications can be sent anytime
        service_notification_options    w,u,c,r,f,s             ; send notifications for all service states, flapping events, and scheduled downtime events
        host_notification_options       d,u,r,f,s               ; send notifications for all host states, flapping events, and scheduled downtime events
        service_notification_commands   notify-service-by-email ; send service notifications via email
        host_notification_commands      notify-host-by-email    ; send host notifications via email
        register                        0                       ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL CONTACT, JUST A TEMPLATE!
  
Adding both, I miss the required fields

Code: Select all

host_notifications_enabled
service_notifications_enabled
I assume, the "required field" definition is wrong and both values default to 1?

Am I right or am I right?

regards,

ikrabbe

Re: contact object required fields

Posted: Mon Oct 20, 2014 9:35 am
by slansing
The example on the documentation you linked does show using those two fields. Are you talking about an example that was installed with core? If so, it's quite possible that those lines are intentionally missing, requiring you to finish the set up of a contact (this would effectively stop you from receiving notification spam if you are new to Core, without setting the contacts up properly.)

What version of core are you on, and how was it installed? On what distro?

Re: contact object required fields

Posted: Mon Oct 20, 2014 9:57 am
by ikrabbe
That's true, I'm talking about the sample-config files, that get installed as the initial configuration, when you install nagioscore from source.

I used the current github sourcecode at branch origin/master and compiled, installed and started that on a gentoo host.

The funny thing is, that the contact configuration, which I extended meanwhile by some more contact objects, seems to work perfectly without those "required" fields.

EDIT: I just activated some notifications about some error that has been detected on localhost http (a 403) and though the e-mail processing hasn't been successful due to some missing command chain, the notification command has been executed for all contacts I added. So I finally assume that those fields are not required and default to "1".

Re: contact object required fields

Posted: Mon Oct 20, 2014 11:32 am
by slansing
Hmm, that will take some looking into, thank you for bringing this up though! Let us know if you experience any issues with these contacts without those definitions in place.

Re: contact object required fields

Posted: Tue Oct 21, 2014 7:40 am
by ikrabbe
When it comes to "looking into", it might help that a new contact is created in code here

nagioscore/xdata/xodtemplate.c:971,980

Code: Select all

		case XODTEMPLATE_CONTACT:
			xod_begin_def(contact);

			new_contact->minimum_value = 0;
			new_contact->host_notifications_enabled = TRUE;
			new_contact->service_notifications_enabled = TRUE;
			new_contact->can_submit_commands = TRUE;
			new_contact->retain_status_information = TRUE;
			new_contact->retain_nonstatus_information = TRUE;
			break;
so it is as I observed: The variables notifications enabled variables default to TRUE. I did not found a required field mechanism yet. But this topic starts to address developers now.

Re: contact object required fields

Posted: Wed Oct 22, 2014 3:02 pm
by abrist
Actually, this is probably a documentation issue as those fields do have a default in the source. Have you bumped into anything else, or should we just proceed with removing the *required* flags for those directives from the documentation?

Re: contact object required fields

Posted: Thu Oct 23, 2014 3:50 am
by ikrabbe
Actually I just started to evaluate nagios for the companies needs, I work for.
If I detect more issues I will just report them here, or somewhere near.

Re: contact object required fields

Posted: Thu Oct 23, 2014 4:37 pm
by sreinhardt
Sounds great! Bug fixes and issues are always welcome!

Re: contact object required fields

Posted: Thu Oct 23, 2014 4:40 pm
by eloyd
ikrabbe wrote:Actually I just started to evaluate nagios for the companies needs, I work for.
If I detect more issues I will just report them here, or somewhere near.
If you're looking for more specific assistance, we would be happy to help you out.