Thursday, May 27, 2010

Convert PNG to GD2 for nagios

When working with nagios and working with new icons to show on your status map you might encounter a filetype called GD2. In most cases you will have a file, for example LINUX_SERVER.png and you will also have a file called LINUX_SERVER.gd2 .


The .png files are used to be displayed in your browser wherever they are needed. However the status maps where you can see all your server in on screen on a map is generated. For the generation of this map the nagios code is reading the images needed and for a more direct access to the image source the gd2 files are used. GD2 is coming from the GD Graphics Library.

In some cases you download a icon set which is not containing gd2 files but only png files. In this case you can make use of the pngtogd2 utility. This utility is (for debian) part of the libgd-tools package and can be installed via apt-get.

When using the pngtogd2 utiltiy please make sure you use the uncompressed option and chunck size of 0. Compressed gd2 files will make rendering the status map slower so if you do not really need to use compression than don’t use it.

1 comment:

Monty Cantsin said...

... e.g. (on GNU/Linux Debian)
cd /usr/share/nagios/htdocs/images/logos/base/
pngtogd2 yourPNGfile.png yourGD2file.gd2 0 1

.. done!
note: chunk size 0 and no compression 1, otherwise nagios won't render the file.

rgrds, MC