<< Back to man.ChinaUnix.net

1. Replacing the Default Icons

By default, Nagios looks like this:

Here's how you get custom icons working. It's quite easy. In my example, I will be using the standard icons, however there are lots of "icon packs" that others have created. You could also create your own if you wish.

First, check to make sure you have the images on your system.

monitor# ls /usr/local/share/nagios/images/logos/
aix.gd2                 caldera.gif             hp-printer40.png        mac40.png               novell40.gif            slackware.jpg           sunlogo.jpg             unicos.png
aix.gif                 caldera.jpg             hpux.gd2                mandrake.gd2            novell40.jpg            slackware.png           sunlogo.png             unknown.gd2
aix.jpg                 caldera.png             hpux.gif                mandrake.gif            novell40.png            stampede.gd2            switch40.gd2            unknown.gif
aix.png                 cat1900.gd2             hpux.jpg                mandrake.jpg            openbsd.gd2             stampede.gif            switch40.gif            win40.gd2
amiga.gd2               cat2900.gd2             hpux.png                mandrake.png            openbsd.gif             stampede.jpg            switch40.jpg            win40.gif
amiga.gif               cat5000.gd2             irix.gd2                nagios.gd2              openbsd.jpg             stampede.png            switch40.png            win40.jpg
amiga.jpg               debian.gd2              irix.gif                nagios.gif              openbsd.png             station.gd2             turbolinux.gd2          win40.png
amiga.png               debian.gif              irix.jpg                nagiosvrml.png          redhat.gd2              storm.gd2               turbolinux.gif          yellowdog.gd2
apple.gd2               debian.jpg              irix.png                next.gd2                redhat.gif              storm.gif               turbolinux.jpg          yellowdog.gif
apple.gif               debian.png              linux40.gd2             next.gif                redhat.jpg              storm.jpg               turbolinux.png          yellowdog.jpg
apple.jpg               freebsd40.gd2           linux40.gif             next.jpg                redhat.png              storm.png               ultrapenguin.gd2        yellowdog.png
apple.png               freebsd40.gif           linux40.jpg             next.png                router40.gd2            sun40.gd2               ultrapenguin.gif
beos.gd2                freebsd40.jpg           linux40.png             ng-switch40.gd2         router40.gif            sun40.gif               ultrapenguin.jpg
beos.gif                freebsd40.png           logo.gd2                ng-switch40.gif         router40.jpg            sun40.jpg               ultrapenguin.png
beos.jpg                hp-printer40.gd2        mac40.gd2               ng-switch40.jpg         router40.png            sun40.png               unicos.gd2
beos.png                hp-printer40.gif        mac40.gif               ng-switch40.png         slackware.gd2           sunlogo.gd2             unicos.gif
caldera.gd2             hp-printer40.jpg        mac40.jpg               novell40.gd2            slackware.gif           sunlogo.gif             unicos.jpg

Yes, they are there. Next, edit the file hostextinfo.cfg.

ee /usr/local/etc/nagios/nagios.cfg

This contains the extended host information. You also must make sure that nagios.cfg references hostextinfo.cfg, on my system I had to comment out the following line.

cfg_file=/usr/local/etc/nagios/hostextinfo.cfg

After you've done that, now edit hostextinfo.cfg.

ee /usr/local/etc/nagios/hostextinfo.cfg

I've edited my file like this.

define hostextinfo{
      host_name       localhost,intranet,auth-server,spamd,mailhub,router1,snort1
      notes_url       http://webserver/hostinfo.pl?host=you_can_edit_this
      icon_image      freebsd40.png
      icon_image_alt  FreeBSD
      vrml_image      freebsd40.png
      statusmap_image freebsd40.gd2
#     2d_coords       100,250
#     3d_coords       100.0,50.0,75.0
      }

define hostextinfo{
      host_name       ad1,ad2,ad-test
      notes_url       http://webserver/hostinfo.pl?host=you_can_edit_this
      icon_image      win40.png                                                    
      icon_image_alt  Windows                                            
      vrml_image      win40.png                                                    
      statusmap_image win40.gd2                                                    
#     2d_coords       100,250                                                      
#     3d_coords       100.0,50.0,75.0                                              
      }                                      

Note: You can add your own coordinates for the status map.

After editing the file, save your changes, then restart Nagios.

Check to find the Process ID

monitor# ps -aux | grep nagios

nagios 1978 0.0 0.2 3388 2504 p0 S 6:10PM 0:00.06 /usr/local/bin/nagios /usr/local/etc/nagios/nagios.cfg

Send the Kill signal

monitor# kill 1978

monitor# Successfully shutdown... (PID=1978)

[1] Done /usr/local/bin/nagios

/usr/local/etc/nagios/nagios.cfg

Start Nagios

monitor# /usr/local/bin/nagios /usr/local/etc/nagios/nagios.cfg &

[1] 2062

monitor#

Nagios 2.0b3

Copyright (c) 1999-2005 Ethan Galstad (www.nagios.org)

Last Modified: 04-03-2005

License: GPL

Nagios 2.0b3 starting... (PID=2062)

You should now have custom icons. My example looks like this: