newbi quations about hosts and servics

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
grafix143
Posts: 6
Joined: Thu Feb 08, 2018 4:38 am

newbi quations about hosts and servics

Post 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
Attachments
services_distants.zip
(31.88 KiB) Downloaded 182 times
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: newbi quations about hosts and servics

Post 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.
Be sure to check out our Knowledgebase for helpful articles and solutions!
grafix143
Posts: 6
Joined: Thu Feb 08, 2018 4:38 am

Re: newbi quations about hosts and servics

Post 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
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: newbi quations about hosts and servics

Post 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?
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
grafix143
Posts: 6
Joined: Thu Feb 08, 2018 4:38 am

Re: newbi quations about hosts and servics

Post 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:
User avatar
t3dus
Posts: 161
Joined: Thu Feb 04, 2016 3:46 pm
Location: IA
Contact:

Re: newbi quations about hosts and servics

Post 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.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: newbi quations about hosts and servics

Post 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.
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
Locked