Nagios Core Version 4.1.1 on raspberry

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
bdacasc
Posts: 1
Joined: Thu Nov 22, 2018 5:42 pm

Nagios Core Version 4.1.1 on raspberry

Post by bdacasc »

Greetings from a Noob

I have followed this guide since I would like to learn some nagios.
It was working then and I could login and see the localhost at the start.
Then I wanted to add another host to be monitored. Another Raspberry pi. I just wanted a simpel ping.

Then I messed up !

What did I do ? I tried to add a jessie.cfg. I wanted to do simpel ping to see if my jessei was alive.

in my nagios.cfg I added
# You can specify individual object config files as shown below:
cfg_file=/usr/local/nagios/etc/objects/commands.cfg
cfg_file=/usr/local/nagios/etc/objects/contacts.cfg
cfg_file=/usr/local/nagios/etc/objects/timeperiods.cfg
cfg_file=/usr/local/nagios/etc/objects/jessie.cfg

this did not work !

When I do

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Code: Select all

]
Nagios Core 4.1.1
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 08-19-2015
License: GPL

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

Looking at contacts.cfg :

Code: Select all


# Just one contact defined by default - the Nagios admin (that's you)
# This contact definition inherits a lot of default values from the 'generic-contact'
# template which is defined elsewhere.

define contact{
        contact_name                    nagiosadmin             ; Short name of user
        use                             generic-contact         ; Inherit default values from generic-contact template (defined above)
        alias                           Nagios Admin            ; Full name of user

        email                           @nagios@@localhost      ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******
        }


cat from /usr/local/nagios/var/nagios.log

Code: Select all

[1542924786] qh: Socket '/usr/local/nagios/var/rw/nagios.qh' successfully initialized
[1542924786] qh: core query handler registered
[1542924786] nerd: Channel hostchecks registered successfully
[1542924786] nerd: Channel servicechecks registered successfully
[1542924786] nerd: Channel opathchecks registered successfully
[1542924786] nerd: Fully initialized and ready to rock!
[1542924786] wproc: Successfully registered manager as @wproc with query handler
[1542924786] wproc: Registry request: name=Core Worker 311;pid=311
[1542924786] wproc: Registry request: name=Core Worker 314;pid=314
[1542924786] wproc: Registry request: name=Core Worker 312;pid=312
[1542924786] wproc: Registry request: name=Core Worker 313;pid=313
[1542924786] wproc: Registry request: name=Core Worker 310;pid=310
[1542924786] wproc: Registry request: name=Core Worker 315;pid=315
[1542924786] Error: Template 'generic-contact' specified in contact definition could not be not found (config file '/usr/local/nagios/etc/objects/contacts.cfg', starting on line 29)
[1542924786] Bailing out due to one or more errors encountered in the configuration files. Run Nagios from the command line with the -v option to verify your config before restarting. (PID=295)
[1542924786] Event broker module 'NERD' deinitialized successfully.

What have I done wrong?
Command me, dark lords


I am running Raspbian GNU/Linux 9.6 (stretch)
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: Nagios Core Version 4.1.1 on raspberry

Post by benjaminsmith »

Hello @bdacasc,

Your contact uses a template called generic-contact and it looks like it cannot locate this.
Error: Template 'generic-contact' specified in contact definition could not be not found (config file '/usr/local/nagios/etc/objects/contacts.cfg', starting on line 29)
Let's verify that you have a templates.cfg in /usr/local/nagios/etc/objects and it contains the generic-contact template.

Code: Select all

define contact{
        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!
        }
Next, make sure your nagios.cfg lists the path to the object config file for templates.cfg

Code: Select all

# You can specify individual object config files as shown below:
cfg_file=/usr/local/nagios/etc/objects/commands.cfg
cfg_file=/usr/local/nagios/etc/objects/contacts.cfg
cfg_file=/usr/local/nagios/etc/objects/timeperiods.cfg
cfg_file=/usr/local/nagios/etc/objects/templates.cfg
cfg_file=/usr/local/nagios/etc/objects/jessie.cfg
Run a pre-flight check on your configuration:

Code: Select all

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
If everything checks out, re-start Nagios:

Code: Select all

service nagios restart
Let me know if you get it working.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked