Monitoring IPCop via nrpe

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
mkot
Posts: 68
Joined: Tue Feb 25, 2014 1:47 am
Location: Poland

Re: Monitoring IPCop via nrpe

Post by mkot »

Hmm, at Nagios I've got status information:

Code: Select all

(Return code of 255 is out of bounds) 
but when I do sth lik this:

Code: Select all

 ssh root@<IP_Remote_Linux_Host> /usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /
and I get:

Code: Select all

DISK OK - free space: / 32975 MB (74% inode=96%);| /=11574MB;37546;42239;0;46933

EDIT:

infos from remote linux server:

Code: Select all

root@domena-wa:~# /usr/local/nagios/libexec/check_nrpe -H localhost
connect to address ::1 port 5666: Connection refused
CHECK_NRPE: Error - Could not complete SSL handshake.

root@domena-wa:~# /usr/local/nagios/libexec/check_nrpe -H <IP_Nagios_Server>
NRPE v2.15

EDIT2:
Is my command definition is correct?

Code: Select all


define command{
        command_name    check_nrpe
        command_line    $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ -t 20
        }
Now I'm getting error

Code: Select all

CHECK_NRPE: Error - Could not complete SSL handshake. 
mkot
Posts: 68
Joined: Tue Feb 25, 2014 1:47 am
Location: Poland

Re: Monitoring IPCop via nrpe

Post by mkot »

OK. I managed to enable active checks for Ubuntu, CentOS servers and it's working :)

Now I need to configure it at FreeBSD server, IPCopr routers. And I need to find solution for hardware raid monitoring (software raid is working fine ;))

EDIT:
I found plugin which can monitor hardware raid via mdstat (perl plugin - attachment, I had to add extension 'txt' to add it here). I configured command:

Code: Select all

command[check_raid]=/usr/local/nagios/libexec/check_raid
When I run /usr/local/nagios/libexec/check_raid at monitord host, I get:

Code: Select all

OK: dmraid:[pdc_biiebhfff: /dev/sdc(mirror, 931.40 MiB): ok, /dev/sdb(mirror, 931.40 MiB): ok]
but when I run it at Nagios Server ( Re-schedule the next check of this service) I get Status information:

Code: Select all

UNKNOWN: dmraid:[Plugin error]
Log from monitored host:

Code: Select all

Mar 27 13:39:58 domena-ld nrpe[16159]: Command completed with return code 3 and output: UNKNOWN: dmraid:[Plugin error]
Mar 27 13:39:58 domena-ld nrpe[16159]: Return Code: 3, Output: UNKNOWN: dmraid:[Plugin error]
And log from nagios Server:

Code: Select all

Mar 27 13:39:59 nagios nagios: EXTERNAL COMMAND: SCHEDULE_FORCED_SVC_CHECK;domena-ld;RAID Monitoring;1395923997
Mar 27 13:39:59 nagios nagios: SERVICE ALERT: domena-ld;RAID Monitoring;UNKNOWN;SOFT;3;UNKNOWN: dmraid:[Plugin error]
Attachments
check_raid.txt
(90.64 KiB) Downloaded 343 times
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Monitoring IPCop via nrpe

Post by slansing »

Can you show us the service configuration for this check on your nagios server, and also the check command it is using? If at all possible, output of manually running the check via the command line would be great as well.
mkot
Posts: 68
Joined: Tue Feb 25, 2014 1:47 am
Location: Poland

Re: Monitoring IPCop via nrpe

Post by mkot »

Hi, this is my command definition in nrpe.cfg file at host:

Code: Select all

command[check_raid]=/usr/local/nagios/libexec/check_raid
If I run /usr/local/nagios/libexec/check_raid (at this host) I'll get good informations:

Code: Select all

OK: dmraid:[pdc_biiebhfff: /dev/sdc(mirror, 931.40 MiB): ok, /dev/sdb(mirror, 931.40 MiB): ok]
At Nagios server in my linux-wa.cfg file I have service definition:

Code: Select all


# Monitorowanie Hardware RAID
define service{
        use                     local-service
        host_name               domena-ld
        service_description     RAID Monitoring
        check_command           check_nrpe!check_raid
        notifications_enabled   1
        flap_detection_enabled  0
        active_checks_enabled   1
        passive_checks_enabled  0
        }
It's sth like that (I can't establish VPN connection to my company network, so I can't check it good).
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: Monitoring IPCop via nrpe

Post by lmiltchev »

What is the output of the following two commands run on the nagios server (from the plugins directory)?

Code: Select all

./check_nrpe -H <client ip>
./check_nrpe -H <client ip> -c check_raid
Be sure to check out our Knowledgebase for helpful articles and solutions!
mkot
Posts: 68
Joined: Tue Feb 25, 2014 1:47 am
Location: Poland

Re: Monitoring IPCop via nrpe

Post by mkot »

1.

Code: Select all

root@nagios:/usr/local/nagios/libexec# ./check_nrpe -H <ip_host>
NRPE v2.15
2.

Code: Select all

root@nagios:/usr/local/nagios/libexec# ./check_nrpe -H 172.17.24.12 -c check_raid
UNKNOWN: dmraid:[Plugin error]
:(

But when I run check_raid at this host I get good values:

Code: Select all

OK: dmraid:[pdc_biiebhfff: /dev/sdc(mirror, 931.40 MiB): ok, /dev/sdb(mirror, 931.40 MiB): ok]
Maybe Nagios dont understand it?
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Monitoring IPCop via nrpe

Post by slansing »

Can you attach a copy of the nrpe.cfg or /etc/xinetd.d/nrpe file from that host? I'd like to see how you have that command defined.
mkot
Posts: 68
Joined: Tue Feb 25, 2014 1:47 am
Location: Poland

Re: Monitoring IPCop via nrpe

Post by mkot »

/etc/xinet.d/nrpe

Code: Select all

# default: on
# description: NRPE (Nagios Remote Plugin Executor)
service nrpe
{
        flags           = REUSE
        socket_type     = stream
        port            = 5666
        wait            = no
        user            = nagios
        group           = nagios
        server          = /usr/local/nagios/bin/nrpe
        server_args     = -c /usr/local/nagios/etc/nrpe.cfg -i
        log_on_failure  += USERID
        disable         = no
        only_from       = <IP_Nagios_Server>,127.0.0.1
}
/usr/local/nagios/etc/nrpe.cfg

Code: Select all

log_facility=daemon

pid_file=/var/run/nrpe.pid

server_port=5666

nrpe_user=nagios

nrpe_group=nagios

allowed_hosts=<IP_Nagios_Server>

dont_blame_nrpe=0

allow_bash_command_substitution=0

debug=1

command_timeout=60

connection_timeout=300

command[check_mem]=/usr/local/nagios/libexec/check_mem.pl -w 98 -c 99
command[check_cpu]=/usr/local/nagios/libexec/check_cpu.sh -w 98 -c 99
command[check_/]=/usr/local/nagios/libexec/check_disk -w 1% -c 0% -p /dev/mapper/pdc_dfagcaei1
command[check_/mnt/backup]=/usr/local/nagios/libexec/check_disk -w 1% -c 0% -p /dev/sda1
command[check_/home]=/usr/local/nagios/libexec/check_disk -w 1% -c 0% -p /dev/mapper/pdc_dfagcaei6
command[check_/home/domena/raporty]=/usr/local/nagios/libexec/check_disk -w 1% -c 0% -p /dev/mapper/pdc_jifggjdg6
command[check_/home/domena/wymiana_miedzyoddzial]=/usr/local/nagios/libexec/check_disk -w 1% -c 0% -p /dev/mapper/pdc_jifggjdg5
command[check_raid]=/usr/local/nagios/libexec/check_raid
EDIT:

I don't know if it's important, but at this host (not Nagios Serwer) when I do:
root@domena-wa:/usr/local/nagios/libexec# ./check_nrpe -H localhost
or
root@domena-wa:/usr/local/nagios/libexec# ./check_nrpe -H localhost -c check_raid
I get

Code: Select all

connect to address ::1 port 5666: Connection refused
CHECK_NRPE: Error - Could not complete SSL handshake.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Monitoring IPCop via nrpe

Post by tmcdonald »

Ironically it looks like a firewall issue. Did you open port 5666 on the device throwing that "Connection refused" error?
Former Nagios employee
mkot
Posts: 68
Joined: Tue Feb 25, 2014 1:47 am
Location: Poland

Re: Monitoring IPCop via nrpe

Post by mkot »

Yes, I added to /etc/services:

Code: Select all

nrpe 5666/tcp
And my iptables is empty (we don't use it).

Code: Select all

root@host:~# iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination
Technically if I wouldn't add it, my other checks (check_disk, check_mem.sh, check_cpu.pl) wouldn't work to, but they're working fine ;)
Locked