eli290
asked on
Nagios 4.0.8 adding additional hosts
I have installed Nagios 4.0.8 on fedora and it seems to be working well. I added the initial windows host for monitoring in the windows.cfg file according to the directions. Now if I want to add additional hosts do I just duplicate the code that is already in there and just change the host name and IP? Is there a better way of doing that maybe a different config file for each host or something? Thanks!
ASKER
oh ok, I may hit you up again if thats ok once I get a second to make that edit
Not a problem. Send any additional questions our way
ASKER
Ok so I see where you were talking about the directory location for a specific category such as servers, printers etc... If I want to create a new category such as workstations I would just create an additional group above right? for instance
# You can also tell Nagios to process all config files (with a .cfg
# extension) in a particular directory by using the cfg_dir
# directive as shown below:
#cfg_dir=/usr/local/nagios /etc/serve rs
#cfg_dir=/usr/local/nagios /etc/print ers
#cfg_dir=/usr/local/nagios /etc/switc hes
#cfg_dir=/usr/local/nagios /etc/route rs
If I want to create say a workstation group I could just create
cfg_dir=/usr/local/nagios/ etc/workst ations
Am I correct on this?
# You can also tell Nagios to process all config files (with a .cfg
# extension) in a particular directory by using the cfg_dir
# directive as shown below:
#cfg_dir=/usr/local/nagios
#cfg_dir=/usr/local/nagios
#cfg_dir=/usr/local/nagios
#cfg_dir=/usr/local/nagios
If I want to create say a workstation group I could just create
cfg_dir=/usr/local/nagios/
Am I correct on this?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
OK so I created a new cfg file and placed it in the servers folder that I created. The new cfg is named file01.cfg and I basically duplicated the windows.cfg file. I went back and edited the windows.cfg and put it back to the sample data. Now I get a warning when validating.
Warning: Duplicate definition found for hostgroup 'windows-servers' (config file '/usr/local/nagios/etc/ser vers/file0 1.cfg', starting on line 46)
Error: Could not add object property in file '/usr/local/nagios/etc/ser vers/file0 1.cfg' on line 47.
Any thoughts?
Warning: Duplicate definition found for hostgroup 'windows-servers' (config file '/usr/local/nagios/etc/ser
Error: Could not add object property in file '/usr/local/nagios/etc/ser
Any thoughts?
ASKER
OK I got that worked out kinda... I had to comment out the Windows Machine Definition
# Definitions for monitoring a Windows machine
#cfg_file=/usr/local/nagio s/etc/obje cts/window s.cfg
However when I create a second host cfg and change the IP address and host_name to the new server name I get the same error. Line 46 begins with the following
define hostgroup{
hostgroup_name windows-servers ; The name of the hostgroup
alias Windows Servers ; Long name of the group
}
Those are in fact the same in both files but I thought that just basically says that these devices are in the host group windows-servers?
# Definitions for monitoring a Windows machine
#cfg_file=/usr/local/nagio
However when I create a second host cfg and change the IP address and host_name to the new server name I get the same error. Line 46 begins with the following
define hostgroup{
hostgroup_name windows-servers ; The name of the hostgroup
alias Windows Servers ; Long name of the group
}
Those are in fact the same in both files but I thought that just basically says that these devices are in the host group windows-servers?
ASKER
Got it working but just using the single file which is working fine. I had to use the * in the place of the host name under services
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You can also duplicate the file and name it Linux.cfg and change the details to reflect Linux servers. This is the basic way monitored items are organized in nagios.
In the nagios.cfg there is a parameter to specify a directory ( on mine I called the directory 'hosts') and in th directory and sub directories I save all my files. Some are based on remote location such as state or country while others based on server type like emailservers.cfg or networks like routers.cfg
Hope that helps