Beginner at a loss..

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.
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Beginner at a loss..

Post by slansing »

You need to define your max_check_attempts for that host that you showed:
Error: Invalid max_check_attempts value for host '78B490-cafe'
Errors in your configurations generally point to missing or incorrect configuration definitions, which must be corrected before nagios starts.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Beginner at a loss..

Post by tmcdonald »

VincentF wrote: Error: Invalid max_check_attempts value for host '78B490-cafe'
Error: Could not register host (config file '/etc/nagios3/conf.d/hosts.cfg', starting on line 1)
Error processing object config files!
Right there. Errors in the Nagios verification are show-stoppers. Since you erased the templates, your objects are now incomplete and you need to manually set all of the required config settings. I would take a look at the Nagios Core Object Definitions for more.
Former Nagios employee
VincentF
Posts: 37
Joined: Thu Dec 19, 2013 12:15 pm

Re: Beginner at a loss..

Post by VincentF »

OK - So, as it turns out - deleting the templates provided by Nagios was a dumb idea on my part.

Crazy thought - but is there any way to restore Nagios back to default to get it back to square 1?

If not, then i'll just blow away the VM and start from scratch. It'll also give me a potential chance to use another OS besides Ubuntu.

-Vin
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Beginner at a loss..

Post by slansing »

There is not unfortunately, not with nagios core, unless you took a snapshot of the VM after you initially brought it up, or you have a backup.
VincentF
Posts: 37
Joined: Thu Dec 19, 2013 12:15 pm

Re: Beginner at a loss..

Post by VincentF »

OK - here we go - Just giving you all an update.

Got a fresh & clean VM back up with Ubuntu 12.04 and nagios installed. (Snapshot taken as a precaution.)

So, the first thing I am going to do is try replacing all the lines that contain localhost and put in the Managers PC...

Here goes nothing...
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: Beginner at a loss..

Post by lmiltchev »

It's a steep learning curve - take one step at a time. After every mod, test your configuration to make sure you don't have any config errors:

Code: Select all

/etc/nagios3/conf.d$ nagios3 -v /etc/nagios3/nagios.cfg
It there are errors, fix them and test again. If there are no errors, restart nagios so that the changes can take effect.

Code: Select all

service nagios3 restart
Be sure to check out our Knowledgebase for helpful articles and solutions!
VincentF
Posts: 37
Joined: Thu Dec 19, 2013 12:15 pm

Re: Beginner at a loss..

Post by VincentF »

I cannot BELIEVE the progress I am making. I am actually quite shocked really. In truth, the biggest mistake ANY n00b can make is to erase the templates provided by Nagios.

So, what made this time so different than the other attempts you ask? Well, I went into every single .cfg file in the /etc/nagios3/conf.d directory and copied each line of each file and pasted it into a good ole'fashioned word file. Then, I separated them out by the file name and highlighted each area underneath the respective file name. This provided me with three MAIN things:

First, it enabled me to VISUALLY see the lines of config vs. what is being displayed on-screen, thus, allowing me to see which files control what.
Second, it allows one to see how the lines of configuration interact with one another and it's dependencies. This really is helpful in that you can see what files are required and which aren't.
and lastly, and what has wrecked havoc on me in the past, is it provided me a fail safe where if I completely screw up the configs, I can just copy and paste back the originals to all of them and start all over from "factory default"

As I promised to all of you, I planned to pay it forward to all of the other n00b's that come along. That said, I have attached the word doc I created to this message to save all of the hassle it took to copy and paste it all into one area. :D

OK, on to the next stage - Best practices, ease of use.

Few questions I have to continue this thread.
1) First, should I group hosts that are of the same task under on .cfg file? i.e. - POS Hosts.cfg, District Servers.cfg, etc.....
2) If I want all of them to have an active ping check every 30 seconds, how do I accomplish that? Currently, my generic-host_nagios2.cfg file looks like this:

# Generic host definition template - This is NOT a real host, just a template!

define host{
name generic-host ; The name of this host template
notifications_enabled 1 ; Host notifications are enabled
event_handler_enabled 1 ; Host event handler is enabled
flap_detection_enabled 1 ; Flap detection is enabled
failure_prediction_enabled 1 ; Failure prediction is enabled
process_perf_data 1 ; Process performance data
retain_status_information 1 ; Retain status information across program restarts
retain_nonstatus_information 1 ; Retain non-status information across program restarts
check_command check-host-alive
max_check_attempts 10
notification_interval 0
notification_period 24x7
notification_options d,u,r
contact_groups admins
register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL HOST, JUST A TEMPLATE!
}

Is the check-host-alive the same as ping? Is this the file to manipulate or should I created another similar file?

3) Is there an easier way of just grouping all hosts into one "member" rather than typing each member to a hostgroup or any other grouping type?

I think that is all for now....

Progress in the near future all!!! :D :D :D :D
Attachments
Nagios_Filenames-CFGs.docx
Nagios CFG's - line by line
(19.54 KiB) Downloaded 172 times
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Beginner at a loss..

Post by slansing »

Its great to see how much your grasp of this has grown, I think we've all made mistakes like this in the past when starting out with Nagios. The biggest thing I can recommend, and it looks like you are doing it now is backups, backups, backups. If you are using a VM it's a good idea to take a snapshot of it when you first get everything installed, then again when you have made the core changes you wish and everything is still working. Thank you for posting your outline and what you did to save yourself and others pain in the future if running into this issue! I'm sure others will find it very helpful. :)
VincentF
Posts: 37
Joined: Thu Dec 19, 2013 12:15 pm

Re: Beginner at a loss..

Post by VincentF »

Question - Where does one go to check the available "check-command"'s and how to use them?

i.e. -

define service{
use generic-service ; Inherit values from a template
host_name localhost ; The name of the host the service is associated with
service_description Ping ; The service description
check_command check_ping!200.0,20%!600.0,60% ; The command used to monitor the service
normal_check_interval 5 ; Check the service every 5 minutes under normal conditions
retry_check_interval 1 ; Re-check the service every minute until its final/hard state is determined
}
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Beginner at a loss..

Post by slansing »

They should all be in the commands.cfg file by default, generally, at least with check commands you will see them defined as:

Code: Select all

$USER1$/pluginname "arguments, flags, etc"
$USER1$ is defined in the resource.cfg file and is actually giving that command a directory path, in centos/rhel it would be by default "/usr/local/nagios/libexec" or, the path to the plugin's location.

There is a wealth of knowledge on these subjects here:

http://nagios.sourceforge.net/docs/3_0/ ... tions.html
Locked