Configure Nagios on Ubuntu Server

I’m assuming that you’ve already read the post on installing nagios AND have successfully installed nagios on your LAMP server. I have recently wiped out the 9.04-upgraded-to-10.04.1 server in favor of a fresh install of 10.04.2LTS. I followed my own guide and nagios is installed and running on production equipment.

I needed to add a new user to be able to access all the same admin functionality of the nagios website.
Create the login for apache:

htpasswd /usr/local/nagios/etc/htpasswd.users USERNAME
PASSWORD
PASSWORD

Add the user to the contacts list:

nano /usr/local/nagios/etc/objects/contacts.cfg
define contact{
contact_name USERNAME
use generic-contact
alias FULL NAME
email EMAIL@DOMAIN.TLD
}
Add the USERNAME after “nagiosadmin” under the define contactgroup{ area
Note, you will need to add a “, ” after nagiosadmin

Restart Nagios to re-read the configuration:

/etc/init.d/nagios restart

I would like to make a parent of an object (switch parent of server, or server hosting virtual machines etc)

define host{
use windows-server
host_name HOSTNAME
alias LONGNAME
address IPADDRESS
parents SERVER_OR_SWITCH_NAME – this must have a valid .cfg file already created
hostgroups SERVERGROUP1, SERVERGROUP3, ETC

Add Icons to Nagios Network Map
Upload your png file to /usr/local/nagios/share/images/logos/
Install the PNG to GD2 application:
apt-get install libgd-tools
Convert your PNG to a GD2:
pngtogd2 PNGFILE.png PNGFILE.gd2 cs 1

Create the host image config file:
nano /usr/local/nagios/etc/objects/hostimages.cfg

define hostextinfo{
host_name HOSTNAME, HOSTNAME2, ETC
# notes_url http://sitefornoteshere
icon_image FILENAME.png
icon_image_alt 0 ALTNAMEOFDEVICE
vrml_image FILENAME.png
statusmap_image FILENAME.gd2
}

Restart Nagios:
/etc/init.d/nagios restart

Leave a Reply

Your email address will not be published. Required fields are marked *