Page 2 of 3

Re: Bulk import users

Posted: Mon Dec 08, 2014 2:27 pm
by jkinning
This was my steps I took to import the configs. However, thanks you you I was able to see what the issue was. The use line is empty so is there a way to bulk add the generic-contact for all the use lines I've imported?

Re: Bulk import users

Posted: Mon Dec 08, 2014 2:37 pm
by tmcdonald
Are you asking how to add "generic-contact" to all the empty lines? Attach a (sanitized) example of one of the contact config files with the missing "use" directive and I can show you a command that should work to fill them in. It needs to be attached and not just copy+pasted because I need to see what newlines and other whitespace are in use.

Re: Bulk import users

Posted: Mon Dec 08, 2014 3:56 pm
by jkinning
Well, I looked at the contacts configs I was importing and they have a use line but after I import them the use line disappears.

Here is an example of one I was going to import.

Re: Bulk import users

Posted: Mon Dec 08, 2014 5:08 pm
by lmiltchev
Do you get any config errors when trying to apply configuration? Did you test the configuration via the Write Config Tool, after the import?

Re: Bulk import users

Posted: Tue Dec 09, 2014 7:20 am
by jkinning
I used that config, aklump which I've attached. It imports but when I verify I get this error:
Error: Template '' specified in contact definition could not be not found (config file '/usr/local/nagios/etc/contacts.cfg', starting on line 16)

Nagios Core 4.0.8
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 08-12-2014
License: GPL

Website: http://www.nagios.org
Reading configuration data...
Read main config file okay...
Error: Template '' specified in contact definition could not be not found (config file '/usr/local/nagios/etc/contacts.cfg', starting on line 16)
Error processing object config files!


***> One or more problems was encountered while processing the config files...

Check your configuration file(s) to ensure that they contain valid
directives and data defintions. If you are upgrading from a previous
version of Nagios, you should be aware that some variables/definitions
may have been removed or modified in this version. Make sure to read
the HTML documentation regarding the config files, as well as the
'Whats New' section to find out what has changed.

So it appears during the import the use line is getting removed.

Code: Select all

define contact {
        contact_name                            aklump
        alias                                   Aaron Klump
        email                                   [email protected]
        use
        }
I attempted to change the order so the use in the same location as it appeared after the import

Code: Select all

define contact{
contact_name                    aklump
alias                           Aaron Klump
email                           [email protected]
use                             contact-dnd
}
I still get the error and when looking the use line is empty.

Re: Bulk import users

Posted: Tue Dec 09, 2014 10:33 am
by tmcdonald
After you import it, the contact should show up in the CCM. Can you screenshot the contact in the CCM along with the "Templates" section open? This is after the import but before the Apply Config.

Re: Bulk import users

Posted: Tue Dec 09, 2014 10:38 am
by jkinning
The user is there...is this what you are wanting to see?

Re: Bulk import users

Posted: Tue Dec 09, 2014 10:39 am
by tmcdonald
I was actually hoping you could open the contact's config page and show us that. If it for whatever reason has a "blank" template assigned, it might cause a problem.

Re: Bulk import users

Posted: Tue Dec 09, 2014 10:46 am
by jkinning
It isn't blank but one thing I also did was activated the contact-dnd within the contacts-templates. Now I am seeing this message when I verify:
Error: Contact 'aklump' has no service notification commands defined!
Error: Contact 'aklump' has no host notification commands defined!

Nagios Core 4.0.8
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 08-12-2014
License: GPL

Website: http://www.nagios.org
Reading configuration data...
Read main config file okay...
Read object config files okay...

Running pre-flight check on configuration data...

Checking objects...
Checked 56 services.
Checked 8 hosts.
Checked 12 host groups.
Checked 0 service groups.
Error: Contact 'aklump' has no service notification commands defined!
Error: Contact 'aklump' has no host notification commands defined!
Warning: Contact 'aklump' has no service notification time period defined!
Warning: Contact 'aklump' has no host notification time period defined!
Checked 19 contacts.
Checked 3 contact groups.
Checked 117 commands.
Checked 24 time periods.
Checked 0 host escalations.
Checked 0 service escalations.
Checking for circular paths...
Checked 8 hosts
Checked 0 service dependencies
Checked 0 host dependencies
Checked 24 timeperiods
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...

Total Warnings: 2
Total Errors: 2

***> One or more problems was encountered while running the pre-flight check...

Check your configuration file(s) to ensure that they contain valid
directives and data defintions. If you are upgrading from a previous
version of Nagios, you should be aware that some variables/definitions
may have been removed or modified in this version. Make sure to read
the HTML documentation regarding the config files, as well as the
'Whats New' section to find out what has changed.

Re: Bulk import users

Posted: Tue Dec 09, 2014 10:48 am
by tmcdonald
Well that's one mystery solved, and I probably should have caught that from your screenshots.

As for those errors, they should speak for themselves. Is there a notification command defined for the aklump contact either on the contact itself or in the contact-dnd template? My guess is not, so you would need to define one in either location for it to work. Personally I would go with the template since there are likely many more contacts with this problem.