For this
configuration of RaspberryPi I'm going to use a single file to hold information
for all of the monitored hosts. On a
larger network you would find advantages to using a more complex structure for
the couple dozen hosts we'll expect a RaspberryPi to monitor this will work
well.
Start by
creating a new .cfg file in the
/etc/nagios3/conf.d directory:
sudo nano hosts.cfg
By the way, I'm also
going to use the Nano text editor for simplicity sake and will not apologize
for it.
The structure of the
file is as follows:
define host {
|
|
use
generic-host
|
Required Use generic-host
as a template, this defines the most basic services.
|
host-name host
name
|
Required Supply the name of the host. This is what the host will appear as in the
Nagios UI. If you supply the host-name
but not an address, then Nagios will try to resolve this name against DNS.
|
alias
description
|
Optional You can provide more description about
the host here.
|
address xxx.xxx.xxx.xxx
|
Optional Defines the IP address this host is
at. Obviously, use only for devices
that have fixed IP addresses.
|
}
|
A host with dynamic
addressing would look like this:
define host {
use
generic-hosthost_name DIRECTV-H23-91652B1A
}
A host with fixed
addressing would look like this:
define host {
use
generic-hosthost_name Main Floor AP
address 192.168.2.15
alias Main Floor AP
}
Write out the file
from Nano (control + O then control + x)
Check the Nagios
config (or if you feel lucky....don't):
sudo nagios3 -v
/etc/nagios3/nagios.cfg
Restart Nagios:
sudo service
nagios3 restart
Go to the Nagios UI
and check your hosts.
No comments:
Post a Comment