Better way to add hosts?

Hi All. I am new to Nagios, and Linux for that fact. I have Nagios up and running and have been playing around a bit.

My question is whether or not there is a way to add multiple hosts without having to manually enter them.

I have about 150 Windows hosts to add and I am thinking that there has got to be a way to import these from a list or something.

Does anyone have a starting point. Just remember that the simpler the better here.

Thanks,

Holli F.

Haven’t used this:
nagmin.sourceforge.net/
use at your own risk.
I do all thing manually. It’s a lot of work, but at least at the end you know what you have done.

What I did to speed up adding hosts was to setup an FTP on my Nagios server and just import all my configs from my GUI box. It is much easier than using VI if you are not used to VI. I know people swear by it, but Id rather copy/paste and save some time. :stuck_out_tongue:

I was wondering the same,

I’m considering nagios to monitor up to 2000 nt machines. But seeing the way to add computers, i’m starting to think about killing that project right here.

Is there a way to link nagios to LDAP ? This could be such and easy way to add new hosts.

If you know a little Ruby you can create a simple script that will generate a config for you. I’ve been trying out different web administration tools, some work and some don’t work as well as I would like them.

You can easily add hundreds or thousands of hosts using a config_dir (/usr/local/nagios/etc/hosts) where each host has its own .cfg file. Build a template config file with keywords like HOST, IP, FULLNAME and then run a shell script reading in a CSV file with the matching information to substitute the keywords with the values. For example.

In your CSV file.

host1,192.168.1.10,Mail Server
host2,192.168.1.11,Domain Controller

Your host template.

define host{
use generic-host
host_name HOST
alias FULLNAME
address IP
}

define service{
use generic-service
host_name HOST
max_check_attempts 1
service_description check-disk
check_command check_disk
}

Then a small shell script.

cat hosts.CSV | while read LINE
do
HOST=echo $LINE | cut -d' -f1
IP=echo $LINE | cut -d' -f2
FULLNAMEecho $LINE | cut -d' -f3-
cat host-template | sed -e “s/HOST/${HOST}/g” -e “s/IP/${IP}/g” -e s"/FULLNAME/${FULLNAME}" > /usr/local/nagios/etc/hosts/$HOST.cfg
done

This would create a hundred host config files in seconds. HTH