nagios_objects

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
Volcharge
Posts: 2
Joined: Tue Aug 25, 2015 8:09 pm

nagios_objects

Post by Volcharge »

Hi,everybody:
In /usr/local/nagios/etc/objects/ I created hosts.cfg and services.cfg
But I found one question: I can't define one more host,but I need to minitor 7 linux_hosts in my company.
HOW CAN I DEFINE ONE MORE LINUX by modifying hosts.cfg and services.cfg?
THX THX THX!!!! :D :D :D :D :D :D :D

It's the hosts.cfg:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
define host{
use linux-server
host_name xianyuan-Linux
alias xianyuan-Linux
address 192.168.1.9
}
define hostgroup{
hostgroup_name hanminfo-servers
alias hanminfo servers
members xianyuan-Linux
}
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
it's the service.cfg
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
define service{
use local-service
host_name xianyuan-Linux
service_description Current Load
check_command check_nrpe!check_load
}

define service{
use local-service
host_name xianyuan-Linux
service_description Check Disk sda1
check_command check_nrpe!check_sda1
}
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: nagios_objects

Post by hsmith »

Volcharge wrote:Hi,everybody:
In /usr/local/nagios/etc/objects/ I created hosts.cfg and services.cfg
But I found one question: I can't define one more host,but I need to minitor 7 linux_hosts in my company.
HOW CAN I DEFINE ONE MORE LINUX by modifying hosts.cfg and services.cfg?
THX THX THX!!!! :D :D :D :D :D :D :D

It's the hosts.cfg:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
define host{
use linux-server
host_name xianyuan-Linux
alias xianyuan-Linux
address 192.168.1.9
}
define hostgroup{
hostgroup_name hanminfo-servers
alias hanminfo servers
members xianyuan-Linux
}
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
it's the service.cfg
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
define service{
use local-service
host_name xianyuan-Linux
service_description Current Load
check_command check_nrpe!check_load
}

define service{
use local-service
host_name xianyuan-Linux
service_description Check Disk sda1
check_command check_nrpe!check_sda1
}
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Hi Volcharge,

You can add as many

Code: Select all

define host{   
        use                     linux-server          
        host_name               something         
        alias                   something         
        address                 so.me.ip.addr         
        }   
As you want in the file. The list of files that nagios grabs stuff from can be found in /usr/local/nagios/etc/nagios.cfg

Code: Select all

cfg_file=/usr/local/nagios/etc/objects/commands.cfg
cfg_file=/usr/local/nagios/etc/objects/contacts.cfg
cfg_file=/usr/local/nagios/etc/objects/timeperiods.cfg
cfg_file=/usr/local/nagios/etc/objects/templates.cfg
cfg_file=/usr/local/nagios/etc/objects/hosts.cfg
cfg_file=/usr/local/nagios/etc/objects/something.cfg
cfg_file=/usr/local/nagios/etc/objects/whatever.cfg
cfg_file=/usr/local/nagios/etc/objects/somethingelse.cfg
cfg_file=/usr/local/nagios/etc/objects/supertopsecretawesomehosts.cfg
I hope this helps clear some stuff up for you.
Former Nagios Employee.
me.
Locked