2010
02.06

When implementing a Nagios Monitoring solution and looking at the default map output, It’s really boring. I like to give the eye something to, so I decided to find out how to use downloaded icons and/or custom created icons you made yourself. 

I will explain how to configure icons for your nagios map:

By default Nagios will show any icons as a question mark logo, known as unknown.gif and unknown.gd2 in your filesystem.
You can define your own icons by downloading icon packs for Nagios or just creating your own icons.
I don’t need to explain how to create .png files and how to crop images to the best size on your Nagios map (40*40 pixels), however creating .gd2 files will be a little bit different (pretty easy however).

Icons used by Nagios will be put into the following directory:

/usr/local/nagios/share/images/logos 

You have to create a config file for configuring icons on specified hosts or you can just add the icon info in your host definitions. When using a specific config file for your icons, it’s best to create a hostextinfo.cfg file in /usr/local/nagios/etc/objects (where all your monitored host config files resign) and add a line specifying the path of the hostextinfo.cfg file in your nagios.cfg file (nagios.cfg will tell nagios what config files to load at startup/reload).
When you have created the hostextinfo.cfg file (depends on how you named it ofcourse) open hostextinfo.cfg with your favorite editor and use the following config to configure the icons for your hosts:

define hostextinfo{
                host_name                        [one or multiple hosts, separated by a ',']
                # notes_url                        http://webserver/hostinfo.pl?host=you_can_edit_this
                icon_image                        hosts.png
                icon_image_alt 0             hosts
                vrml_image                       hosts.png
                statusmap_image           hosts.gd2
                # 2d_coords                      100,250
                # 3d_coords                      100.0,50.0,75.0
                }

You could also just add the following info in your host definitions, so you would get an entry like this: 

define host{
                use                                        linux-server
                host_name                        [hostname]
                parents                                [parent name]
                alias                                       [alias]
                address                                192.168.*.*
                hostgroups                        linux-servers
                icon_image                        [image.png]
                icon_image_alt                [image]
                vrml_image                       [image.png]
                statusmap_image           [image.gd2]
}

When you want to create your own icons you need the pngtogd2 utility, that is distributed as part of the libgd-tools package in Debian and Ubuntu.

apt-get install libgd-tools

when you created some custom .png files, upload them to your server, and use the following command to make a copy of the specified .png file and automatically create a .gd2 file: 

pngtogd2 [.png file] [use the same name and just put .gd2 at the end] cs 1

When using this command, you will notice you just created a .gd2 file for your custom .png file.
Afterwards you will get something like this:

No Comment.

Add Your Comment