获取服务中指定的错误命令未在任何地方定义!
在服务'NFSV4'中为主机'NFS-01'指定的服务检查命令'check_nrpe!check_nfs4'未在任何地方定义!
root@Bastion-01:/usr/lib/nagios/plugins# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
Nagios Core 4.0.8
Website: http://www.nagios.org Reading configuration data... Read main config file okay... Read object config files okay...
Running pre-flight check on configuration data...
Checking objects... Error: Service check command 'check_nrpe!check_nfs4' specified in service 'NFSV4' for host 'Inksedge-NFS-01' not defined anywhere!
Total Warnings: 0 Total Errors: 1
在NFS主机上
root@NFS-01:/usr/lib/nagios/plugins# ll /usr/lib/nagios/plugins/check_nfs4.0.2.pl -rwxr-xr-- 1 root root 10079 Mar 29 2006 /usr/lib/nagios/plugins/check_nfs4.0.2.pl*
------>尝试使用user.group作为nagios.nasgios,但同样的错误
root@NFS-01:/usr/lib/nagios/plugins# vim /etc/nagios/nrpe.cfg
allowed_hosts=127.0.0.1,172.31.4.235
command[check_nfs4]=/usr/lib/nagios/plugins/check_nfs4.0.2.pl
root@NFS-01:/home/app# /usr/lib/nagios/plugins/check_nrpe -H nagios-serverip NRPE v2.15
Nagios Server上的:
/usr/local/nagios/etc/objects/nagios_Nfs.cfg
NFS Monitoring Plugin
define service { use generic-service
host_name NFS-01
service_description NFSV4
check_command check_nrpe!check_nfs4
}
check_nrpe -H nfs-if NRPE v2.15
请让我知道我错过了什么!如果想要更多信息,也可以!
ps我正在尝试安装Nrpe插件来监控nfs服务器! http://manoj7city.blogspot.in/2011/08/monitoring-nfs-with-nagios.html?showComment=1432735406553#c5559215890385838847
答案 0 :(得分:0)
找到解决方案我尝试了另一个脚本。发布步骤可能会有所帮助!!
为Nagios Server添加Nrpe插件以监控Nfs服务器
步骤:
注意:Nrpe应该同时安装在Nagios& Nfs服务器
sudo apt-get install nagios-nrpe-server sudo apt-get install nagios-plugins-basic nagios-plugins nagios-plugins-extra
在Nagios服务器上:
1)下载https://exchange.nagios.org/directory/Plugins/System-Metrics/File-System/NFS/check_nfs-2Esh/details 在/ usr / local / nagios / libexec /&将其重命名为check_nfs
2)root @ Bastion-01:/ usr / local / nagios / libexec #chmod 755 check_nfs
3)root @Bastion-01#vim /etc/nagios/nrpe.cfg ------>添加到第220行附近,您将找到现有的硬编码命令
command [check_users] = / usr / lib / nagios / plugins / check_users -w 5 -c 10 command [check_load] = / usr / lib / nagios / plugins / check_load -w 15,10,5 -c 30,25,20 command [check_hda1] = / usr / lib / nagios / plugins / check_disk -w 20%-c 10%-p / dev / hda1 command [check_zombie_procs] = / usr / lib / nagios / plugins / check_procs -w 5 -c 10 -s Z 命令[check_total_procs] = / usr / lib / nagios / plugins / check_procs -w 150 -c 200
<强>命令[check_nfs4] = / USR /本地/的nagios /的libexec / check_nfs 强>
同样添加到第81行(逗号后空格这个空格会出错;)
<强> allowed_hosts = 127.0.0.1,您的-NFS-服务器IP 强>
4)root @Bastion-01:/ usr / local / nagios / etc / objects#vim commands.cfg ------&gt;添加
define command { command_name check_nfs command_line $ USER1 $ / check_nfs }
5)root @ Bastion-01:/ usr / local / nagios / libexec #vim /usr/local/nagios/etc/objects/nagios_Nfs.cfg -----&gt;添加
定义服务{ 使用通用服务 host_name Inksedge-NFS-01 service_description NFS check_command check_nfs }
6)root @ Bastion-01:/ usr / local / nagios / libexec#/ usr / local / nagios / bin / nagios -v /usr/local/nagios/etc/nagios.cfg
7)root @ Bastion-01:/ usr / local / nagios / libexec#service nagios reload
8)检查nrpe是否与nfs服务器进行通信
在Nfs服务器上:
1)检查nrpe是否与Nagios服务器通信
2)将我们在Nagios服务器上使用的相同插件复制到/ usr / lib / nagios / plugins
注意:此路径可能有所不同,即可能是/ usr / local / nagios / libexec /取决于您的实现
3)root @ NFS-01:/ usr / lib / nagios / plugins# chmod 755 check_nfs
4)root @ NFS-01:/ usr / lib / nagios / plugins #vim /etc/nagios/nrpe.cfg ------&gt;添加到第220行附近,您将找到现有的硬编码命令
command [check_users] = / usr / lib / nagios / plugins / check_users -w 5 -c 10 command [check_load] = / usr / lib / nagios / plugins / check_load -w 15,10,5 -c 30,25,20 command [check_hda1] = / usr / lib / nagios / plugins / check_disk -w 20%-c 10%-p / dev / hda1 command [check_zombie_procs] = / usr / lib / nagios / plugins / check_procs -w 5 -c 10 -s Z 命令[check_total_procs] = / usr / lib / nagios / plugins / check_procs -w 150 -c 200
<强>命令[check_nfs4] = / usr / lib中/的nagios /插件/ check_nfs 强>
同样添加到第81行(逗号后空格这个空格会出错;)
<强> allowed_hosts = 127.0.0.1,您的-的Nagios - 服务器 - IP 强>
5)root @ NFS-01:/ usr / lib / nagios / plugins#/ etc / init.d / nagios-nrpe -server restart
输出
NFS-01
当前负载
行 06-03-2015 07:40:42 182d 22h 8m 29s 1/3 好 - 平均负载:0.00,0.01,0.05 当前用户
行 06-03-2015 07:38:20 182d 22h 10m 49s 1/3 USERS OK - 目前有3位用户登录 NFS
行 06-03-2015 07:36:20 0d 19h 36m 27s 1/3 确定 - NFS挂载在正常运行参数范围内运行