≡ Menu

How To Monitor Remote Linux Host using Nagios 3.0

Nagios

In the previous post Nagios 3.0 Jumpstart guide , I explained the overview, installation and configuration of Nagios 3.0 on Red Hat Server. In the following three chapters, I’ll explain how to monitor a remote Linux host and the various services running on the remote host.  Also, please refer to all our Nagios articles.
 
I. Overview

II. 6 steps to install Nagios plugin and NRPE on remote host.

  1. Download Nagios Plugins and NRPE Add-on
  2. Create nagios account
  3. Install Nagios Plugins
  4. Install NRPE
  5. Setup NRPE to run as daemon
  6. Modify the /usr/local/nagios/etc/nrpe.cfg

III. 4 Configuration steps on the Nagios monitoring server to monitor remote host:

  1. Download NRPE Add-on
  2. Install check_nrpe
  3. Create host and service definition for remote host
  4. Restart the nagios service


I. Overview:

.

Following three steps will happen on a very high level when Nagios (installed on the nagios-servers) monitors a service (for e.g. disk space usage) on the remote Linux host.
 

  1. Nagios will execute check_nrpe command on nagios-server and request it to monitor disk usage on remote host using check_disk command.
  2. The check_nrpe on the nagios-server will contact the NRPE daemon on remote host and request it to execute the check_disk on remote host.
  3. The results of the check_disk command will be returned back by NRPE daemon to the check_nrpe on nagios-server.


Following flow summarizes the above explanation:

Nagios Server (check_nrpe) —–> Remote host (NRPE deamon) —–> check_disk

Nagios Server (check_nrpe) <—– Remote host (NRPE deamon) <—– check_disk (returns disk space usage)


II. 7 steps to install Nagios Plugins and NRPE on the remote host

.

1. Download Nagios Plugins and NRPE Add-on

Download following files from Nagios.org and move to /home/downloads:

  • nagios-plugins-1.4.11.tar.gz
  • nrpe-2.12.tar.gz

2. Create nagios account

[remotehost]# useradd nagios
[remotehost]# passwd nagios

3. Install nagios-plugin

[remotehost]# cd /home/downloads
[remotehost]# tar xvfz nagios-plugins-1.4.11.tar.gz
[remotehost]# cd nagios-plugins-1.4.11
[remotehost]# export LDFLAGS=-ldl

[remotehost]# ./configure --with-nagios-user=nagios --with-nagios-group=nagios --enable-redhat-pthread-workaround
[remotehost]# make
[remotehost]# make install

[remotehost]# chown nagios.nagios /usr/local/nagios
[remotehost]# chown -R nagios.nagios /usr/local/nagios/libexec/


Note: On Red Hat, For me the ./configure command was hanging with the the message: “checking for redhat spopen problem…”. Add --enable-redhat-pthread-workaround to the ./configure command as a work-around for the above problem.

4. Install NRPE

[remotehost]# cd /home/downloads
[remotehost]# tar xvfz nrpe-2.12.tar.gz
[remotehost]# cd nrpe-2.12

[remotehost]# ./configure
[remotehost]# make all
[remotehost]# make install-plugin
[remotehost]# make install-daemon
[remotehost]# make install-daemon-config
[remotehost]# make install-xinetd

5. Setup NRPE to run as daemon (i.e as part of xinetd):

  • Modify the /etc/xinetd.d/nrpe to add the ip-address of the Nagios monitoring server to the only_from directive. Note that there is a space after the 127.0.0.1 and the nagios monitoring server ip-address (in this example, nagios monitoring server ip-address is: 192.168.1.2)
       only_from       = 127.0.0.1 192.168.1.2
  • Modify the /etc/services and add the following at the end of the file.
       nrpe 5666/tcp # NRPE
  • Start the service
       [remotehost]#service xinetd restart
  • Verify whether NRPE is listening
       [remotehost]# netstat -at | grep nrpe
       tcp 0      0 *:nrpe *:*                         LISTEN
  • Verify to make sure the NRPE is functioning properly
[remotehost]# /usr/local/nagios/libexec/check_nrpe -H localhost
NRPE v2.12

6. Modify the /usr/local/nagios/etc/nrpe.cfg

The nrpe.cfg file located on the remote host contains the commands that are needed to check the services on the remote host. By default the nrpe.cfg comes with few standard check commands as samples. check_users and check_load are shown below as an example.

command[check_users]=/usr/local/nagios/libexec/check_users -w 5 -c 10
command[check_load]=/usr/local/nagios/libexec/check_load -w 15,10,5 -c 30,25,20


In all the check commands, the “-w” stands for “Warning” and “-c” stands for “Critical”. for e.g. in the check_disk command below, if the available disk space gets to 20% of less, nagios will send warning message. If it gets to 10% or less, nagios will send critical message. Change the value of “-c” and “-w” parameter below depending on your environment.

command[check_disk]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/hda1


Note: You can execute any of the commands shown in the nrpe.cfg on the command line on remote host and see the results for yourself. For e.g. When I executed the check_disk command on the command line, it displayed the following:

[remotehost]#/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/hda1
DISK CRITICAL - free space: / 6420 MB (10% inode=98%);| /=55032MB;51792;58266;0;64741


In the above example, since the free disk space on /dev/hda1 is only 10% , it is displaying the CRITICAL message, which will be returned to nagios server.


III. 4 Configuration steps on the Nagios monitoring server to monitor remote host:

.

1. Download NRPE Add-on

Download nrpe-2.12.tar.gz from Nagios.org and move to /home/downloads:

2. Install check_nrpe on the nagios monitoring server

[nagios-server]# tar xvfz nrpe-2.12.tar.gz
[nagios-server]# cd nrpe-2.1.2
[nagios-server]# ./configure
[nagios-server]# make all
[nagios-server]# make install-plugin

./configure will give a configuration summary as shown below:

*** Configuration summary for nrpe 2.12 05-31-2008 ***:

General Options:
————————-
NRPE port: 5666
NRPE user: nagios
NRPE group: nagios
Nagios user: nagios
Nagios group: nagios

 

Note: I got the “checking for SSL headers… configure: error: Cannot find ssl headers” error message while performing ./configure. Install openssl-devel as shown below and run the ./configure again to fix the problem.

[nagios-server]# rpm -ivh openssl-devel-0.9.7a-43.16.i386.rpm krb5-devel-1.3.4-47.i386.rpm zlib-devel-1.2.1.2-1.2.i386.rpm e2fsprogs-devel-1.35-12.5.
el4.i386.rpm
warning: openssl-devel-0.9.7a-43.16.i386.rpm: V3 DSA signature: NOKEY, key ID db42a60e
Preparing… ########################################### [100%]
1:e2fsprogs-devel ########################################### [ 25%]
2:krb5-devel ########################################### [ 50%]
3:zlib-devel ########################################### [ 75%]
4:openssl-devel ########################################### [100%]

Verify whether nagios monitoring server can talk to the remotehost.

[nagios-server]#/usr/local/nagios/libexec/check_nrpe -H 192.168.1.3
NRPE v2.12


Note: 192.168.1.3 in the ip-address of the remotehost where the NRPE and nagios plugin was installed as explained in Section II above.

3. Create host and service definition for remotehost

Create a new configuration file /usr/local/nagios/etc/objects/remotehost.cfg to define the host and service definition for this particular remotehost. It is good to take the localhost.cfg and copy it as remotehost.cfg and start modifying it according to your needs.
 

host definition sample:

define host{
use linux-server
host_name remotehost
alias Remote Host
address 192.168.1.3
contact_groups admins
}


Service definition sample:

define service{
use generic-service
service_description Root Partition
contact_groups admins
check_command check_nrpe!check_disk
}

Note: In all the above examples, replace remotehost with the corresponding hostname of your remotehost.

4. Restart the nagios service

Restart the nagios as shown below and login to the nagios web (http://nagios-server/nagios/) to verify the status of the remotehost linux sever that was added to nagios for monitoring.

[nagios-server]# service nagios reload

Best Nagios Book

Nagios Core 3 eBook – I’ve been using Nagios for several years, and I can sleep peacefully at night knowing that Nagios is monitoring all my systems and will warn me about any potential issue, before it becomes critical. I strongly recommend that you read Nagios Core 3 ebook to gain detailed understanding on Nagios. Since Nagios is free software, spending few dollars on the book can be the best investment you can make.

Awesome Nagios Articles

Following are few awesome Nagios articles that you might find helpful.

If you enjoyed this article, you might also like..

  1. 50 Linux Sysadmin Tutorials
  2. 50 Most Frequently Used Linux Commands (With Examples)
  3. Top 25 Best Linux Performance Monitoring and Debugging Tools
  4. Mommy, I found it! – 15 Practical Linux Find Command Examples
  5. Linux 101 Hacks 2nd Edition eBook Linux 101 Hacks Book

Bash 101 Hacks Book Sed and Awk 101 Hacks Book Nagios Core 3 Book Vim 101 Hacks Book

{ 64 comments… add one }

  • David Ducos June 4, 2008, 4:55 am

    You may also modify commands.cfg to add check_nrpe that was not by default in that file.
    I find nexts lines in a forum:
    # ‘check_nrpe’ command definition
    define command{
    command_name check_nrpe
    command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -t 30 -c $ARG1$
    }
    Thanks for this guide!!

  • Jaspreet June 5, 2008, 2:48 am

    Nice article i did everything but still i dnt know hw to monitor the remote host through the nagios server through web interface .
    Can you please help me on this ..?

  • David Ducos June 12, 2008, 7:17 am

    Jaspreet: you have to edit several file in /usr/local/nagios/etc/ folder. First with nagios.cfg and then each objetc that you wanna monitor.

  • Ramesh June 22, 2008, 3:17 pm

    @David,

    Thanks for your comment about check_nrpe and following up with Jaspreet on his questions.

    @Jaspreet,

    You need to explain little bit more on what configuration you’ve done so far and what exactly the problem you are facing. If you need any additional help send me an email to ramesh (at) thegeekstuff (dot) com , and I’ll help you out.

  • Alan Fullmer June 23, 2008, 3:04 pm

    Great article. Jaspreet, I’m guessing you don’t have the cfg set up right on your host server. I always verify the config as well with the nagios -v [path/to/config.cfg], maybe that would also help.

  • Simon July 12, 2008, 8:02 pm

    Now an explanation of the “NRPE” abbreviation would make the whole read less frustrating.

  • Ramesh July 13, 2008, 11:48 pm

    @Simon,

    NRPE stands for “Nagios Remote Plug-Ins Executor”

  • hp September 17, 2008, 3:29 am

    Hi Ramesh

    i set up nagios server (in singapore) and a client (malaysia) but i got this error when i wanted to see if server talks to client correctly, can you help with this thanks ?

    [root@nagios etc]# /usr/local/nagios/libexec/check_nrpe -H 172.16.1.248
    CHECK_NRPE: Socket timeout after 10 seconds.

  • Jhon Grados September 18, 2008, 10:01 am

    According the first message …

    You may also modify commands.cfg to add check_nrpe that was not by default in that file.
    I find nexts lines in a forum:
    # ‘check_nrpe’ command definition
    define command{
    command_name check_nrpe
    command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -t 30 -c $ARG1$
    }

  • Will September 21, 2008, 5:16 pm

    I couldn’t get the nagios server to monitor the remote host. Do I need to configure the nagios.cfg file with the path of the remothost.cfg file. I did this and I get a config error when I reload nagios. Am I missing something?

  • Mr-lol September 23, 2008, 2:45 am

    Thanks Ramesh good work, one thing though your # “configure …. ” lines will be a bit frustrating for newbies since you have omitted the # “./configure ….. ” and also ” – “instead of ” — ” on your how-to.

    Thanks a mil once again :)

  • Mr-lol September 23, 2008, 2:46 am

    That should have been ” – -“

  • hoberion October 8, 2008, 4:25 pm

    thank you!

  • Sidster October 28, 2008, 10:12 pm

    Thanks for your guide. I have got server talking to client (linux) using NRPE. Now there are 4 more other machines but I cannot install any agent on those. Reading through websites, there is a way…can you please suggest me something.

    Thanks in advance.

  • Ramesh December 22, 2008, 2:14 pm

    Mr-lol,

    Yes. It should be “--” in the “./configure”. I’ve fixed it. Thanks for pointing it out.

  • Clemente January 8, 2009, 2:52 pm

    hi, thank you very much for your help, but now I’ve to ask you some more help because: I carefully followed your instructions for the installation of NREP and the server gives me the following answer when I try to execute the verify on it:

    /usr/local/nagios/libexec/check_nrpe -H 192.168.1.105 (remote linux host ip)
    Connection refused by host

    Do you think it could be the firewall on client? If so, how can I solve the problem?

  • Mike Call January 17, 2009, 9:53 am

    FYI, Simon… NRPE stands for “Nagios Remote Plug-Ins Executor”

  • mrudula March 4, 2009, 5:47 am

    I have installed nagios3 on a linux box. I m tryng to configure a remote linux machine. I m following the above steps as mentioned by you. I have also modified commands.cfg to add check_nrpe

    However i getting following message in web in status information colm
    NRPE: Command ‘check_disk’ not defined

    My check_disk in commands.cfg looks like this
    # ‘check_disk’ command definition
    define command{
    command_name check_disk
    command_line $USER1$/check_disk -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$ -p $ARG3$
    }

  • Gautam Kashyap June 1, 2009, 1:27 am

    Hi,
    I am getting following error when i run this command on nagios server(Fedora8).192.168.1.201 is the ip of remote host (CentOS release 5.2)

    [root@mail nrpe-2.12]# /usr/local/nagios/libexec/check_nrpe -H 192.168.1.201
    CHECK_NRPE: Error – Could not complete SSL handshake.

    Though Openssl is installed in my system

    [root@mail nrpe-2.12]# rpm -qa |grep openssl
    openssl-0.9.8b-17.fc8
    openssl-devel-0.9.8b-17.fc8
    openssl-perl-0.9.8b-17.fc8
    [root@mail nrpe-2.12]#

  • raj June 19, 2009, 9:34 am

    hi… i have done the following with Nagios 3.0

    1) copied the localhost.cfg file and created a remotehost.cfg file
    2) i have then added a remote linux host to the remotehost.cfg file
    3) how do i see the remote host on the nagios server….?

  • Arunkeerthan October 11, 2009, 12:32 pm

    My remote host is configured with the static ip.But my NAgios server is behind the Aitel router with Lan ip provided by router dhcp.Should i enter my WAN ip in remote host as server’s ip address or should i enter my local ip in remote host as server’s ip address….Please help me….
    I dont know which ip address i should enter as server’s ip in remote host in this case…Please help me…..

  • emreCEB October 28, 2009, 9:17 am

    I have status by nagios server marked as “unknown” and i cant get rid of it.
    i followed every step here and seems it all fine.
    what i am missing, any help might be good.
    ty

  • Paul October 29, 2009, 10:00 am

    For some reason I am unable to install NRPE onto a CentOS release 4.7. I had to rename Makefile.in to Makefile just to get the “make all” command to work. But when I go to use “make install” I get the following error message.

    # make install-plugin
    cd ./src/ && make install-plugin
    make[1]: Entering directory `/root/nrpe-2.12/src’
    make[1]: *** No rule to make target `install-plugin’. Stop.
    make[1]: Leaving directory `/root/nrpe-2.12/src’
    make: *** [install-plugin] Error 2

    I am running this command as root and I ran the ./configure.

  • Raghu Nandan Shukla December 1, 2009, 7:59 am

    Thanks Ramesh for article i am done with above great job!
    newbies
    also dont forget to include
    cfg_file=/usr/local/nagios/etc/objects/remotehost.cfg
    in /usr/local/nagios/etc/nagios.cfg
    if u have configured remotehost.cfg file as above
    :-))

  • Prof.Luís Eduardo March 23, 2010, 7:01 am

    Solution for problems with ssl in Ubuntu:
    http://ubuntuforums.org/showthread.php?t=875240

  • Leog April 20, 2010, 11:07 am

    [remotehost]# ./configure
    [remotehost]# make all <<<<—- Doesn´t work for me.
    make: *** No rule to make target `all'. Stop.

    why?

    thx

  • Kamran Ansari April 23, 2010, 11:12 am

    Hi Ramesh,
    Thanks for all your articles – very helpful indeed.

    I am new to the Linux world and just getting my feet wet. I am researching options for monitoring system performance on a Redhat (RHEL 5.5) cluster from a windows machine. My environment consists of half a dozen Windows Server 2008 machines and another 6 machines running RHEL 5.5. I am required to collect Performance metrics on both clusters through a program I wrote in C# running on one of the Windows machines. I am using Perfmon for the Windows servers and it’s working great so far. However, I haven’t been able to find a solution for monitoring my Linux machines from my Windows box yet.

    Does Nagios provide such a functionality? What are my options? I’d appreciate if you could point me to other useful resources.

    Thanks once again!

  • Jay Tobio April 27, 2010, 1:32 am

    @ Will,

    You don’t need to create a remotehost.cfg file. Just edit the localhost.cfg and include the config needed to monitor the remote host.

  • Jay Tobio April 27, 2010, 1:34 am

    @ raj

    It should appear when you click “Services” at the left pane

  • Chris J May 10, 2010, 7:52 am

    This is a very good article, but Jay is correct just add the second host configuration to the localhost.cfg. This is how I got it to work monitoring another CentOS box.

  • sreenu August 6, 2010, 1:54 am

    [remotehost]# make all <<<<—- Doesn´t work for me.
    make: *** No rule to make target `all'. Stop.

    why?

    thx

  • newguy August 6, 2010, 6:08 am

    friends,

    Please help , i am a new user of nagios and am exploring its various features. I have successfully installed nagios on the test server and can access its GUI.

    SERVER IP : 10.1.51.182

    i can access the url through

    http://10.1.51.182:/nagios

    Presently i am able to view only one monitored server “localhost” which is my nagios server.

    I have another test machine available with me installed with RHEL45 .

    i have followed the following steps to configure the remote host.

    Download Nagios Plugins and NRPE Add-on
    Create nagios account
    Install Nagios Plugins
    Install NRPE
    Setup NRPE to run as daemon
    Modify the /usr/local/nagios/etc/nrpe.cfg

    The following has been done at the Nagios server :

    Download NRPE Add-on
    Install check_nrpe
    Create host and service definition for remote host
    Restart the nagios service

    pwd
    /usr/local/nagios/etc/objects

    cd /usr/local/nagios/etc/objects

    created the configuration file for the host

    ###############################################################################
    ###############################################################################
    #
    # HOST DEFINITION
    #
    ###############################################################################
    ###############################################################################

    # Define a host for the local machine

    define host{
    use linux-server ; Name of host template to use
    ; This host definition will inherit all variables that are defined
    ; in (or inherited by) the linux-server host template definition.
    host_name lidump
    alias localhost
    address 10.1.51.83
    }

    define service{
    use generic-service ; Name of service template to use
    host_name lidump
    service_description PING
    check_command check_ping!100.0,20%!500.0,60%
    }

    I am unable to view this host in the nagios URL GUI.
    PLease help

  • VIKAS September 7, 2010, 10:51 am

    Hi Newguy,

    I was also facing the same problem. Add this line
    cfg_file=/usr/local/nagios/etc/objects/remotehost.cfg
    to
    /usr/local/nagios/etc/nagios.cfg

    This solved my problem. At least now I can see my remote host in Nagios Web Browser.

    BUT still all my services configured in /usr/local/nagios/etc/objects/remotehost.cfg on Nagios Server are NOT visible in Nagios Web Browser.

    I have also sent an email to Ramesh, still waiting for his reply.

  • VIKAS September 7, 2010, 1:19 pm
  • Roberto September 8, 2010, 12:07 pm

    Hi all,

    when I run check_nrpe command I receive an error:

    /usr/local/nagios/libexec/check_nrpe -H 172.21.1.41
    CHECK_NRPE: Error – Could not complete SSL handshake.

    I view logs an found:

    Sep 8 12:26:26 lindes xinetd[14787]: START: nrpe pid=14794 from=172.21.2.56
    Sep 8 12:26:26 lindes xinetd[14794]: libwrap refused connection to nrpe (libwrap=nrpe) from 172.21.2.56
    Sep 8 12:26:26 lindes xinetd[14794]: FAIL: nrpe libwrap from=172.21.2.56
    Sep 8 12:26:26 lindes xinetd[14787]: EXIT: nrpe status=0 pid=14794 duration=0(sec)

    The service is running and I have the next line in file /etc/xinetd.d/nrpe:

    only_from = 127.0.0.1 172.21.2.56

    Somewhere (i dont remember where) I read something about tcpwrapper and nagios, I view my /etc/hosts.deny, it has one line:

    ALL:ALL

    I think that this is the problem. I add the next line to my file /etc/hosts.allow:

    nrpe:172.21.2.56

    And Ii works without problems!!!

    /usr/local/nagios/libexec/check_nrpe -H 172.21.1.41
    NRPE v2.12

    my server IP: 172.21.2.56
    my client IP: 172.21.1.41

    I

  • Ramaswamy October 6, 2010, 8:48 am

    Hi,
    I configured nagios-3 as per documentation. But I am unable to login with authentication. when I give http://localhost/nagios with username and password, it is giving you don’t have permission to access /nagios. Please suggest me.
    Thankcyou.

  • sztupi October 20, 2010, 3:38 am

    Hi,

    I use nagios3 and nagios-plugins.
    I set up a Disk Space check :

    define service{
    use generic-service ; Name of service template to use
    host_name gollam, frodo,flanders,flan
    service_description Disk Space
    check_command check_disk!20%!10% !/HOME
    }

    runing Nagios and the error message say:
    DISK CRITICAL – /HOME is not accessible: No such file or directory

  • Jovin November 3, 2010, 2:53 pm

    Hi…

    I’m getting an error when running this command:

    ■Verify to make sure the NRPE is functioning properly
    [remotehost]# /usr/local/nagios/libexec/check_nrpe -H localhost

    I would get:
    CEHCK_NRPE: Error – Could not complete SSL handshake.

    I’ve even tried using the nagios server’s IP address – same result.

    What was your fix in resolving this issue?

    Needp help – Thank you.

  • royal charlie December 30, 2010, 11:20 am

    What’s the solution for the issue already raised

    [remotehost]# make all <<<<—- Doesn´t work for me.
    make: *** No rule to make target `all'. Stop.

  • royal charlie December 30, 2010, 11:43 am

    Reply to below issue.

    After reading some forum searches, the nrpe make all will fail if there is a failure during the ./configure bit. Ensure that there is no failure upon running ./configure. In my case, there it was “checking for SSL headers… configure: error: Cannot find ssl headers”. I had to manually install the openssl-devel as am using CentOS. After the successful installation, re-run ./configure and all make steps completed like a flash.

    Hope this helps newbies like me who will come across this blog. Regards.

    ==================================
    What’s the solution for the issue already raised

    [remotehost]# make all <<<<—- Doesn´t work for me.
    make: *** No rule to make target `all'. Stop.

  • Thanh Pham January 5, 2011, 2:50 am

    I have read this article, and applied it to my company administrator tasks.
    It is really useful! Thank you very much for your hardwork!

  • Raj January 19, 2011, 8:50 am

    I want to configure check_http plugin to monitor http url in a host. I can add the following in nrpe.cfg and restart the nrpe service:
    command[check_http]=/usr/local/nagios/libexec/check_http -H myhost -I 127.0.0.1 -u http://myurl.com -w 30 -c 60 -t 15

    After this do we need to do any changes in Nagios server?

  • vilas January 31, 2011, 5:35 am

    how to monitor multipal linux partition in nagios through nrpe

  • Bijohn Vincent April 12, 2011, 1:43 pm

    If anyone getting the error “checking for SSL headers… configure: error: Cannot find ssl headers” in Ubuntu, run sudo apt-get install libssl-dev .

  • Sachikanta September 30, 2011, 2:01 pm

    You need to open port 5666 for NRPE plugin and lots of other configuration also needs to be done for NRPE plugin. so its better to use check_by_ssh plug. its working fine.

    I am using it and monitoring our 25 Linux Servers.

  • Sachikanta September 30, 2011, 2:05 pm

    Vilas, you need to add an another host.cfg file under objects folder (inside nagios home directory). and need to modify the nagios.cfg file too. then u can monitor as much as Linux Servers.

  • shu November 23, 2011, 10:04 pm

    i hav installed the nagios, when i’m browsn m gtng the first page.bt ts nt shwng anythn abt the service nd when m clickin on any buttons on the right side ts showing below error…

    Internal Server Error

    The server encountered an internal error or misconfiguration and was unable to complete your request.

    Please contact the server administrator, root@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.

    More information about this error may be available in the server error log.
    Apache/2.2.15 (CentOS) Server at 172.22.1.248 Port 80

    please any1 help mi…..

  • aman November 24, 2011, 12:21 am

    when i click on maps in the right side , i am getting the following error
    Not Found

    The requested URL /nagios/cgi-bin/statusmap.cgi was not found on this server.
    Apache/2.2.15 (CentOS) Server at 172.22.1.248 Port 80

    please help me .. how to resolve this .

  • Sri November 29, 2011, 4:27 pm

    Hi,

    I tried this one. But I keep getting a Error receiving data from daemon when doing a check_nrpe. I am on version 3.0-dev from git and am running icinga server 1.5.0. Ive even put the ip addresses of all interfaces locally onto the allowed_hosts in nrpe.cfg (but that shouldnt make a difference when running in xinetd – where I have specified this in only_from parameter).

    The only difference is I am installing icinga in /home/icinga instead of the default path (/usr/local i think).

    This is just eating my head in. Any ideas?

    Thanks in advance
    Sri

  • tan December 11, 2011, 5:49 am

    aman , try to restart
    apache , then restart nagios, it is solved

  • tan February 12, 2012, 12:22 pm

    i have added few linux hosts to monitor , but the services for each remote host are same as the nagios server; can anybody tell why iam getting same values

  • seena March 20, 2012, 6:33 am

    Hi Ramesh,

    Great tutorial !! I have done exactly what you explained. It seems you missed one step and it took a while for me to figure out the problem

    After the complete configuration I was able to check the version and load from the remote nagios server command line using following command:

    /usr/lib64/nagios/plugins/check_nrpe -H
    /usr/lib64/nagios/plugins/check_nrpe -H -c check_load

    However the result was not coming nagios web interface and the configuration check was giving an error

    “‘command ‘check_nrpe’ specified in service ‘Current load’ for host ” hostname” not defined anywhere! “”

    Finally I had to add the following in /objects/commands.cfg of the Nagios server.

    define command{
    command_name check_nrpe
    command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
    }

    Thanks
    Seena

  • firaas June 27, 2012, 8:59 am

    hi ramesh,

    i’ve a problem, while verify whether nagios monitoring server can talk to the remotehost, i get the following repport: “Connection refused or timed out”
    could you help me

  • Rajesh Sharma July 20, 2012, 6:11 am

    i am trying to monitor asterisk through NAGIOS. I downloaded check_asterisk plugin from website. put this plugin in /usr/local/nagios/libexec/.

    i added below in /usr/local/nagios/etc/object/command.cfg

    define command{
    command_name check_asterisk
    command_line $USER1$/check_asterisk -U $ARG1$ -P $ARG2$ -w 500 -c 1000
    }

    and i added below code in /usr/local/nagios/etc/objests/localhost.cfg

    define service{
    use local-service
    host_name localhost
    service_description Asterisk
    check_command check_asterisk
    }

    Now in nagios GUI it is showing UNKNOWN error:-**ePN /usr/local/nagios/libexec/check_asterisk: “Can not open ASTFILE file: Permission denied at (eval 1) line 16,”.

    ———————————————————————————————————-

    code inside check_plugin

    my $what = $ARGV[0];
    my %ERRORS=(‘OK’=>0,’WARNING’=>1,’CRITICAL’=>2);
    my ($asterisk,$statd);
    my $astd = “/var/run/asterisk/asterisk.pid”; #Where is your asterisk PID file
    my $grep = “ps ax |grep”;

    unless (-e $astd) {
    print “CRITICAL – Asterisk\n”;
    exit $ERRORS{‘CRITICAL’};
    }
    open ASTFILE,”$astd” or die “Can not open ASTFILE file: $!”;
    $statd = readline(*ASTFILE);
    chomp $statd;
    $statd = `$grep $statd`;
    unless ($statd =~ m|asterisk|) {
    print “CRITICAL -Asterisk\n”;
    exit $ERRORS{‘CRITICAL’};
    } else {
    print “OK – Asterisk\n”;
    exit $ERRORS{‘OK’};

    }

    mys asterisk PID location is: /var/run/asterisk/asterisk.PID
    i changed ownership of check_asterisk. But still the same issue persist.

    Please help

  • Sameer gautam August 19, 2012, 4:32 am

    I followed exactly as you stated above but I can not find my remote linux machine listed under hosts in the web-interface of my nagios. however, I can run all the commands (eg: /usr/local/nagios/libexex/check_nrpe -H -c check_users) from the console quite successfully.
    can you tell why is that so?
    thank you

  • sandeep September 27, 2012, 2:35 am

    Hi,

    I am defined a command in nagois slave machines as command[check_ProcessName]=/usr/lib/nagios/plugins/check_procs -c 1:2 -a ‘ProcessName’
    When I ran command
    /usr/lib/nagios/plugins/check_procs -c 1:2 -C ProcessName
    it’s showing status as
    PROCS CRITICAL: 0 processes with command name ‘ProcessName’,
    this process status is correct.
    The same command when I ran with check_nrpe using command
    /usr/lib/nagios/plugins/check_nrpe -H hostname -c check_ProcessName
    its showing as
    PROCS OK: 1 process with args ‘ProcessName’.
    Hear check_nrpe is showing ProcessName as running even though its not running.
    Any one please update me if there is any mistake with command.

    Thanks

  • Lukas March 13, 2013, 5:26 pm

    Awesome article. Worked a treat.

    I had a few problems with make’ing the nagios plugins and NRPE on Ubuntu but a bit of googling resolved that; I was missing some stuff and just needed to install the following and then ‘make clean’ and start again (ie.. from the configure statement).

    sudo apt-get install libssl-dev (before installing Nagios Plugins)
    sudo apt-get install xinetd (before installing NRPE)

    Also if you are using Ubuntu, remember to use ‘sudo’ before all the ‘make’ commands and ‘useradd’ etc.

    I may have said it before, but I’ll say it again: Ramesh, your articles are always crystal clear and very thorough. I have come across your site a few times now and am always pleased with the experience. Keep up the good work, you are a true gentleman and a scholar and the Linux community could use more people like you. :)

  • shailendra khade March 24, 2013, 1:00 am

    how many kernel i can install in RHEL 5 or any version

  • albert April 4, 2013, 12:37 am

    Mr. Ramesh Natarajan i want to be your apprentice for linux administrator kindly teach me how to use it easily

  • Jitendra kirar June 18, 2013, 11:02 pm

    Hi,
    can any one help me to find those RPM openssl-devel-0.9.7a-43.16.i386.rpm krb5-devel-1.3.4-47.i386.rpm zlib-devel-1.2.1.2-1.2.i386.rpm e2fsprogs-devel-1.35-12.5.
    el4.i386.rpm

    Please give me the link to download those RPM’s

    After installed the rpm’s and run ./configure i am getting below error.
    checking for SSL headers… SSL headers found in /usr
    checking for SSL libraries… configure: error: Cannot find ssl libraries

    Please provide me the solution for this ASAP.

  • Basel September 23, 2013, 10:29 am

    Cannot start xinetd.d/nrpe getting permission denied even with root user:
    bash: /etc/xinetd.d/nrpe: Permission denied

    Command: /etc/xinetd.d/nrpe restart

    Your help is greatly appreciated.

  • Nazir July 4, 2014, 4:21 am

    can anyone pls show ur remote machine’s nrpe.cfg file so that i can know what mistakes i made.

    Thanks
    Nazir

  • Jonus Joseph November 19, 2014, 3:51 am

    Hello Ramesh,

    My question is : How to add icon/image in front of host or services on nagios portal.
    for example i have one host in nagios it is RHEL7 i want to keep icon/image of REDHAT in front of host on nagios portal so that i can recognize easily.
    how to do this process through nagios configurations ?
    Thank you very much in advance.
    -Jonus Joseph

  • Jonus Joseph December 9, 2014, 12:37 pm

    Hello,

    To monitor any Linux hosts we install nrpe,
    My concern is how does nrpe execute its command from nagios to remote host ?

    Eg:
    Remote Server: NRPE file (nrep.cfg):
    command[check_cpu_jonus]=/usr/local/nagios/libexec/check_cpu -w 80 -c 90
    Nagios Side:
    #/usr/local/nagios/libexec/check_nrpe -H 192.168.6.1 -p 5666 -c check_cpu_jonus

    My question is how does nagios execute this check (check_cpu_jonus) on remote server through SSH ? or any other protocol ?
    or in other words i can say if we remove SSH from remote host will this check (check_cpu_jonus) will execute on remote host and give output to nagios server ?
    Please help me to understand how does NRPE works from nagios server to remote server which we want to monitoring.

    Thanks in advance.

    -Jonus Joseph

Leave a Comment