1.nagios要添加一个监控服务,监控客户端上扫描引擎的的数量,引擎运行在kvm虚拟机上,如下:
[[email protected] libexec]# virsh list
Id Name State
----------------------------------
31 avpscan_000 running
32 avpscan_001 running
33 avpscan_002 running
34 avpscan_003 running
35 avpscan_004 running
36 avpscan_005 running
37 avpscan_006 running
38 avpscan_007 running
39 avpscan_008 running
40 avpscan_009 running
41 avpscan_010 running
43 avpscan_012 running
44 avpscan_013 running
45 avpscan_014 running
46 avpscan_011 running
我原先在脚本插件中用这个命令查看煤股份引擎的数量:
num=`virsh list | grep avpscan | grep -v grep | wc -l`
但是发现这个值传到监控主服务器时现实的值却是0,不知道是怎么回事。但是换成如下命令后,发现传过去的是准确的值:
num=`ps axu |grep qemu-kvm |grep avp | wc -l`
2.在使用nagios的时候,经常发现有这么一个问题,选择某个服务的链接,却显示没有权限查看,如图:
网上查了半天,要么是要修改
/usr/local/nagios/etc/cgi.cfg
CGI脚本控制文件cgi.cfg
首先确保use_authentication=1 变为0
要么是这样把下面的选项加上nagiosadmin用户
authorized_for_system_information=nagiosadmin,nagios
authorized_for_configuration_information=nagiosadmin,nagios
authorized_for_system_commands=nagiosadmin,nagios
authorized_for_all_services=nagiosadmin,nagios
authorized_for_all_hosts=nagiosadmin,nagios
试了都没有效果。
最后分析发现是配置主机名称时使用了中文字符,如果想要正常使用需要安装中文插件,不然就改成英文。