nagios自身有个map功能,十分强大,配置也也十分简单 。只需要简单的配置就可以理由网络架构。直接先上两个图先:
如上图所示,可以直接一目了然了解网企业的网络架构。在nagios里想要实现上图的效果非常简单,只需要两个配置参数即可。一个是parents,用于定义其上层节点;一个是statusmap_image,用于指定该节点使用的图片名称,其图片默认从/App/nagios/share/images/logos位置获取。具体配置如下:
1、先定义一个交换机或防火墙(也可以是其他设备)
define host{ use linux-server host_name huzhou alias huzhou statusmap_image switch40.jpg address 61.153.XXX.X notification_interval 0 process_perf_data 1 action_url /pnp4nagios/graph?host=$HOSTNAME$ }
2、在一个主机的配置里定义其父节点的名字,并配图
define host{ use linux-server host_name 361way statusmap_image linux40.jpg parents huzhou alias 192.168.8.7 address 192.168.8.7 notification_interval 60 process_perf_data 1 action_url /pnp4nagios/graph?host=$HOSTNAME$ }
另外,需要提醒的是,此处配置的图片最好是GD格式的,这一点在nagios的cgi.cfg 文件里有相关说明:
# STATUSMAP BACKGROUND IMAGE # This option allows you to specify an image to be used as a # background in the statusmap CGI. It is assumed that the image # resides in the HTML images path (i.e. /usr/local/nagios/share/images). # This path is automatically determined by appending "/images" # to the path specified by the 'physical_html_path' directive. # Note: The image file may be in GIF, PNG, JPEG, or GD2 format. # However, I recommend that you convert your image to GD2 format # (uncompressed), as this will cause less CPU load when the CGI # generates the image.