Page 1 of 1

newbi quations about hosts and servics

Posted: Sat Feb 10, 2018 11:51 pm
by grafix143
I am very new to Nagios , anyway I have it pre-installed i need to modify it a bit

I watched the self paced learning video but i still failed to carry out the task so i need help.

In the web interface under services in Nagios I have 4 number hosts to be checked which are printers they are not in use so i decided to remove them .

In nagios>congif folder there are two files which i found related to the printers

1- hostgroups.cfg

define hostroups {
hostgroup_name Printers
alias CUPS printers
members rlprt01,rlprt20,rlprt70,rlprt80
}

2. service_distants.cfg
define service {
hostgroup_name Printers
services_description CHK - Print spooler
check_command check_lpqueue
use generic-service
notification_interval 0
}



so what I did is removing the

define hostroups {
hostgroup_name Printers
alias CUPS printers
members rlprt01,rlprt20,rlprt70,rlprt80
}

from the hostgroups,cfg then i used the command to restart nagios (service nagios restart) but i got an error which is

Configuration validation failed

Any suggestion how to make this works . i need to remove the printers check

screen shots attached

Re: newbi quations about hosts and servics

Posted: Mon Feb 12, 2018 3:03 pm
by lmiltchev
so what I did is removing the

define hostroups {
hostgroup_name Printers
alias CUPS printers
members rlprt01,rlprt20,rlprt70,rlprt80
}

from the hostgroups,cfg then i used the command to restart nagios (service nagios restart) but i got an error which is

Configuration validation failed
Did you remove the entire hostgroup (Printers) or just the two members (hosts) that you wanted to remove? Which host the "CHK307 - Print spooler" service is attached to? The service is added to the "Printers" hostgroup, so it would show up under each host, member of this group, unless you remove the host from the "Printers" hostgroup.

What is the exact error that you see when you verify the configuration?

Code: Select all

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
Note: If the path to the nagios binary or the main config file is different, please modify the above command accordingly.

Re: newbi quations about hosts and servics

Posted: Mon Mar 05, 2018 5:31 am
by grafix143
lmiltchev wrote:
so what I did is removing the

define hostroups {
hostgroup_name Printers
alias CUPS printers
members rlprt01,rlprt20,rlprt70,rlprt80
}

from the hostgroups,cfg then i used the command to restart nagios (service nagios restart) but i got an error which is

Configuration validation failed
Did you remove the entire hostgroup (Printers) or just the two members (hosts) that you wanted to remove? Which host the "CHK307 - Print spooler" service is attached to? The service is added to the "Printers" hostgroup, so it would show up under each host, member of this group, unless you remove the host from the "Printers" hostgroup.

What is the exact error that you see when you verify the configuration?

Code: Select all

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
Note: If the path to the nagios binary or the main config file is different, please modify the above command accordingly.

Ok , as I know if you have to put the *.cfg file in Nagios.cfg
but this is not case here , in Nagios.cfg they point to a folder where I find this hostgroups.cfg

and I have deleted the whole section from hotgroups.cfg

define hostroups {
hostgroup_name Printers
alias CUPS printers
members rlprt01,rlprt20,rlprt70,rlprt80
}

and then I did a restart and it failed ( Configuration Validation failed)

then I did your command so I ran this
( /usr/local/bin/nagios-sync -v /etc/nagios/nagios.cfg)

and the output is this
sending incremental file list
nagios/config/
nagios/config/hostgroups.cfg

Re: newbi quations about hosts and servics

Posted: Mon Mar 05, 2018 3:38 pm
by scottwilkerson
I noticed this in your post
grafix143 wrote:

Code: Select all

/usr/local/bin/nagios-sync -v /etc/nagios/nagios.cfg
What is nagios-sync?

This leads me to believe it is more than just the nagios binary.

Does it by chance sync you configurations and then execute the commands to the real binary?

Re: newbi quations about hosts and servics

Posted: Mon Mar 05, 2018 11:00 pm
by grafix143
scottwilkerson wrote:I noticed this in your post
grafix143 wrote:

Code: Select all

/usr/local/bin/nagios-sync -v /etc/nagios/nagios.cfg
What is nagios-sync?

This leads me to believe it is more than just the nagios binary.

Does it by chance sync you configurations and then execute the commands to the real binary?
Hi Scott,
TBH , I have no clue what are you talking about (real binary) and I also don't know what is nagios-sync , I was looking for the file nagios in this folder but I couldn't find anything else than nagios-sync .

I will try to search for what you just mentioned I may make sense out of it . :roll:

Re: newbi quations about hosts and servics

Posted: Tue Mar 06, 2018 7:26 am
by t3dus
What I got from this is he deleted something that looked like

Code: Select all

define hostgroup{
        hostgroup_name  Printers
        alias           CUPS printers
        members         rlprt01,rlprt20,rlprt70,rlprt80
        }
from a file named "hostgroups.cfg" which I find a bit odd. None of my nagios files are simply called hostgroups.cfg so sounds like somebody did some modifying of file names.

Have you tried simply putting back in what you deleted? I included above what you deleted & corrected the misspelling you provided prior.

After you replace what you deleted then verify the config using

Code: Select all

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
and then restart nagios and see if it fixes it.

Re: newbi quations about hosts and servics

Posted: Tue Mar 06, 2018 10:16 am
by scottwilkerson
grafix143 wrote:TBH , I have no clue what are you talking about (real binary) and I also don't know what is nagios-sync , I was looking for the file nagios in this folder but I couldn't find anything else than nagios-sync .
How was nagios installed on this server? Really before we proceed we need to know what we are dealing with because "nagios-sync" is not what the file should be called and is likely some modification.