Page 1 of 1

how do I start adding the target hosts to monitor?

Posted: Wed Oct 11, 2017 10:22 pm
by ikekim
Hi,

I installed Nagios Core and its plugins on Centos 7.x by following the easy setup instructions online here:
https://support.nagios.com/kb/article/n ... tml#CentOS

I tested the web console and I'm able to logon successfully and I see the localhost object.

But how do I start adding the target hosts to monitor and make them display on the web console?

I would like to monitor PING and URL.

I wasn't able to locate clear instructions on this,


Thanks,
ik

Re: how do I start adding the target hosts to monitor?

Posted: Thu Oct 12, 2017 10:53 am
by kyang
This is how I set mine up to just ping a few servers.
1. After you create a cfg for these hosts in /usr/local/nagios/etc/objects

2. Allow the cfg_file path in the nagios.cfg

3. service restart nagios

Code: Select all

# Define a host for the local machine

define host{
        use                     linux-server            ; Name of host template to use
        host_name               xi
        alias                   xi
        address                 192.168.4.125
        icon_image              storm.png
        statusmap_image         storm.png
        }
# Define a host for the local machine

define host{
        use                     linux-server            ; Name of host template to use
        host_name               nna
        alias                   nna2
        address                 192.168.4.45
        icon_image              storm.png
        statusmap_image         storm.png
        }
My results in my nagios core of just pinging my XI and NNA server.
test.PNG
What URLS? you can do it as a service under these hosts with check_http

Code: Select all

define service{
        use                             local-service         ; Name of service template to use
        host_name                       localhost
        service_description             HTTP
        check_command                   check_http! -H www.google.com
        notifications_enabled           0
        }
Does this help?

Re: how do I start adding the target hosts to monitor?

Posted: Thu Oct 12, 2017 1:29 pm
by ikekim
When I go to modify the:
vi /usr/local/nagios/etc/nagios.cfg

and I add these lines:
# Definitions for monitoring a Windows registration iis machine
cfg_file=/usr/local/nagios/etc/objects/win_registration_iis.cfg

for some reason this results in nagios service being failed..if I remove the lines that I added then the nagios service resumes back to normal.

I tried with /usr/local/nagios/etc/objects/win_registration_iis.cfg and tried without.

The content for /usr/local/nagios/etc/objects/win_registration_iis.cfg is as follows:

define host {
use generic-host
host_name registration_iis
alias Some Remote Host
address 10.155.58.26
hostgroups allhosts
}


thanks,
ik

Re: how do I start adding the target hosts to monitor?

Posted: Thu Oct 12, 2017 2:47 pm
by kyang
Could you run this command and post the output.

Code: Select all

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
What happens when you remove hostgroups? It should be hostgroup_name.

Here are the object definitions for Core.
https://assets.nagios.com/downloads/nag ... ml#service