How to install Nagios on CentOS?
Setting nagios.cfg
Please make backup file of localhost.cfg as we will serverly use this file as a template for other cfg files.
[root@yourmachine ~] cd /etc/nagios/objects/
[root@yourmachine nagios] cp localhost.cfg localhost.cfg_org
[root@yourmachine nagios] cd ..
[root@yourmachine nagios] vi nagios.cfg
# OBJECT CONFIGURATION FILE(S)
cfg_file=/etc/nagios/objects/contactgroups.cfg
cfg_file=/etc/nagios/objects/contacts.cfg
cfg_file=/etc/nagios/objects/hostgroups.cfg
cfg_file=/etc/nagios/objects/hosts.cfg
cfg_file=/etc/nagios/objects/services.cfg
cfg_file=/etc/nagios/objects/timeperiods.cfg
# EXTERNAL COMMAND OPTION
check_external_commands=1
# EXTERNAL COMMAND CHECK INTERVAL
command_check_interval=1
Go ahead and save the file.
Now, for each file you specified above you’ll need to create the file because it doesn’t exist within /etc/nagios/objects/.
[root@yourmachine nagios] cd objects
[root@yourmachine objects] touch contactgroups.cfg contacts.cfg hostgroups.cfg hosts.cfg services.cfg timeperiods.cfg
[root@yourmachine objects] chown nagios.nagios contactgroups.cfg contacts.cfg hostgroups.cfg hosts.cfg services.cfg timeperiods.cfg