Question regarding hosts & hostgroups
Posted: Tue Dec 17, 2019 5:33 pm
Hi.
Please pardon this newbie question as I am kind of weeding my way through a preconfigured Nagios setup configured by an admin that left the company. I 'think' I get the basics but not entirely sure.
From what I gather, nagios can be configured to look 'anywhere' for a host configuration file which is configured in nagios.cfg. In my previous post -- https://support.nagios.com/forum/viewto ... =7&t=56828 -- I initially lost my hosts and restored them by enabling a backup copy of nagios.cfg and disabling the initial primary copy which lead me to believe there was a mistake in nagios.cfg - and after searching for hours I figured out one of the sources were hashed out and wasn't so on the backup copy. It was
I'm assuming that the previous admin used servers as another folder to store hosts in where I found two .cfg files containing host definitions - for the every machine on the network.
In the hostgroups folder, I found multiple .cfg's
and within Nagios itself there are multiple hostgroups corresponding similar to these filenames (although I realize the groups are defined within the contents of the files.)
So what I am thinking is, the hosts (machines, servers, vm's, ect) are all defined in the servers folder under .cfg's that contain entries like this:
and those hosts are divided into groups in the hostgroups folder with .cfg's containing entries like this:
With additional services defined below that point...
...What I couldnt understand however is how Nagios know which host belongs to which hostgroup....
input?
Please pardon this newbie question as I am kind of weeding my way through a preconfigured Nagios setup configured by an admin that left the company. I 'think' I get the basics but not entirely sure.
From what I gather, nagios can be configured to look 'anywhere' for a host configuration file which is configured in nagios.cfg. In my previous post -- https://support.nagios.com/forum/viewto ... =7&t=56828 -- I initially lost my hosts and restored them by enabling a backup copy of nagios.cfg and disabling the initial primary copy which lead me to believe there was a mistake in nagios.cfg - and after searching for hours I figured out one of the
Code: Select all
cfg_file=Code: Select all
cfg_dir=/usr/local/nagios/etc/serversIn the hostgroups folder, I found multiple .cfg's
Code: Select all
/usr/local/nagios/etc$ ls hostgroups
apps.cfg peds.cfg logs.cfg board.cfg
closet.cfg hex.cfg table.cfg principal.cfg
colfax.cfg principal.cfg vm.cfg
So what I am thinking is, the hosts (machines, servers, vm's, ect) are all defined in the servers folder under .cfg's that contain entries like this:
Code: Select all
define host {
use linux-server
host_name sw02
alias sw02
address x.x.x.x
}
Code: Select all
define hostgroup {
hostgroup_name colfax
alias Colfax
}
define service{
use local-service
hostgroup_name colfax
service_description Current temperature
check_command check_nrpe!check_temp
notifications_enabled 1
}
...What I couldnt understand however is how Nagios know which host belongs to which hostgroup....
input?