-1

Getting error command specified in service not defined anywhere!

Service check command 'check_nrpe!check_nfs4' specified in service 'NFSV4' for host 'NFS-01' not defined anywhere!

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

On NFS Host

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*

------> tried with user.group as nagios.nasgios but same error

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

on 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

Please let me know what I am missing! Also if want some more information!

ps I am trying to install Nrpe plugin to monitor nfs server! http://manoj7city.blogspot.in/2011/08/monitoring-nfs-with-nagios.html?showComment=1432735406553#c5559215890385838847

aronadaal
  • 9,083
  • 1
  • 19
  • 33
Ashish Karpe
  • 5,087
  • 7
  • 41
  • 66
  • You really should have a look at the Stackoverflow Tour http://stackoverflow.com/tour and other questions to get a first impression how this site is working and how *good* questions are written. Also helpful for you should be the highlighting guide to structure your question. http://stackoverflow.com/editing-help#comment-formatting – aronadaal May 29 '15 at 08:07

1 Answers1

0

Found solution i tried another script. Posting steps might be helpful !!

Adding Nrpe plugin for Nagios Server to monitor Nfs Server

Steps :

Note : Nrpe should be installed on both Nagios & Nfs server

sudo apt-get install nagios-nrpe-server sudo apt-get install nagios-plugins-basic nagios-plugins nagios-plugins-extra

On Nagios Server :

1) Download https://exchange.nagios.org/directory/Plugins/System-Metrics/File-System/NFS/check_nfs-2Esh/details in /usr/local/nagios/libexec/ & rename it to check_nfs

2) root@Bastion-01:/usr/local/nagios/libexec# chmod 755 check_nfs

3) root@Bastion-01# vim /etc/nagios/nrpe.cfg ------> Add to near about line number 220 where you will find already existing hardcoded commands

The following examples use hardcoded command arguments...

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 command[check_total_procs]=/usr/lib/nagios/plugins/check_procs -w 150 -c 200

Ashish command for nfs plugin

command[check_nfs4]=/usr/local/nagios/libexec/check_nfs

Also Add to line 81 (Becareful here space after comma will give error ;) )

allowed_hosts=127.0.0.1,your-NFS-Server-ip

4) root@Bastion-01:/usr/local/nagios/etc/objects# vim commands.cfg ------> Add

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 -----> Add

define service{ use generic-service 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) Check Whether nrpe is Communicating with nfs server

root@Bastion-01:/usr/local/nagios/libexec# /usr/local/nagios/libexec/check_nrpe -H localhost NRPE v2.15 -----> output

root@Bastion-01:/usr/local/nagios/libexec# /usr/local/nagios/libexec/check_nrpe -H your-nfs-server-ip NRPE v2.15 -----> output

On Nfs Server :

1) Check Whether nrpe is Communicating with Nagios server

root@root@NFS-01:/usr/local/nagios/libexec# /usr/local/nagios/libexec/check_nrpe -H localhost NRPE v2.15 -----> output

root@root@NFS-01:/usr/local/nagios/libexec# /usr/local/nagios/libexec/check_nrpe -H your-nagios-server-ip NRPE v2.15 -----> output

2) Copy same plugin which we used on Nagios server to /usr/lib/nagios/plugins

Note : this path may vary ie it might be /usr/local/nagios/libexec/ depends on your implementation

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 ------> Add to near about line number 220 where you will find already existing hardcoded commands

The following examples use hardcoded command arguments...

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 command[check_total_procs]=/usr/lib/nagios/plugins/check_procs -w 150 -c 200

Ashish command for nfs plugin

command[check_nfs4]=/usr/lib/nagios/plugins/check_nfs

Also Add to line 81 (Becareful here space after comma will give error ;) )

allowed_hosts=127.0.0.1,your-Nagios-Server-ip

5) root@NFS-01:/usr/lib/nagios/plugins# /etc/init.d/nagios-nrpe-server restart

Output :

NFS-01

Current Load

OK 06-03-2015 07:40:42 182d 22h 8m 29s 1/3 OK - load average: 0.00, 0.01, 0.05  Current Users

OK 06-03-2015 07:38:20 182d 22h 10m 49s 1/3 USERS OK - 3 users currently logged in  NFS

OK 06-03-2015 07:36:20 0d 19h 36m 27s 1/3 OK - NFS mounts are functioning within normal operating parameters 

Ashish Karpe
  • 5,087
  • 7
  • 41
  • 66