1、 背景介绍
在监控web页面上显示主机都为问号,如下图所示:
本文的主要目的就是将监控的图片添加进去,让监控图像变得美观。
2、 图片的下载地址
图片的下载地址如下:
https://exchange.nagios.org/directory/Graphics-and-Logos/Images-and-Logos
图片下载之后,解压缩上传的服务器路径如下:
3、 nagios设置
可以设置图标的配置文件如下:
主要可以设置的地方就是定义主机的地方,如下所示:
也可以在模板中进行定义,如下所示:
两个参数的说明的如下:
参数icon_image主要是用来设置鼠标在悬浮状态下信息显示的时候有图标出现
参数statusmap_image主要用来设置在map选项界面中的图标,如下所示:
4、 重启nagios
在进行设置完成之后,重启nagios服务即可:
5、几个需要注意的地方
statusmap_image:
此图标用来定义在状态图的时候的图标,可以使用的格式为JPEG,PNG和GIF,在使用这些格式的时候,会占用大量的CPU时间,从而推荐使用gd2格式的图形。
icon_image:
此图标可以使用的格式为jpeg,PNG和GIF格式图形,主要用来显示和主机有关的界面。
icon_image: This variable is used to define the name of a GIF, PNG, orJPG image that should be associated with this host. This image will bedisplayed in the various places in the CGIs. The image will look best if it is40x40 pixels in size. Images for hosts are assumed to be in the logos/subdirectory in your HTML images directory (i.e. /usr/local/nagios/share/images/logos).
statusmap_image: This variable is used to define the name of an image thatshould be associated with this host in the statusmap CGI. You can specify a JPEG, PNG, and GIFimage if you want, although I would strongly suggest using a GD2 format image,as other image formats will result in a lot of wasted CPU time when thestatusmap image is generated. GD2 images can be created from PNG images by usingthe pngtogd2 utility supplied with Thomas Boutell's gd library. The GD2 images should be created in uncompressed formatin order to minimize CPU load when the statusmap CGI is generating the networkmap image. The image will look best if it is 40x40 pixels in size. You canleave these option blank if you are not using the statusmap CGI. Images forhosts are assumed to be in the logos/ subdirectory in your HTML imagesdirectory (i.e. /usr/local/nagios/share/images/logos).