check_services OUTPUT: Unknown argument:

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
ahmadt
Posts: 7
Joined: Thu Nov 19, 2015 5:18 am

check_services OUTPUT: Unknown argument:

Post by ahmadt »

Dears,

i am trying to monitor some java processes using nagiosxi but i got the following error when i test the check command as the following


COMMAND: /usr/local/nagios/libexec/check_nrpe -H 10.10.11.106 -t 30 -c check_services -a 'java -cp /OnD/GrpAgent/GrpAgent/config/i18n/'
OUTPUT: Unknown argument: -cp

and when i change the command to
COMMAND: /usr/local/nagios/libexec/check_nrpe -H 10.10.11.106 -t 30 -c check_services -a,p egrep 'java -cp /OnD/GrpAgent/GrpAgent/config/i18n/'

the output is
OUTPUT: *** -a: Nok *** p: 202

but when i try the command to monitor only java as the following
COMMAND: /usr/local/nagios/libexec/check_nrpe -H 10.10.11.106 -t 30 -c check_services -a 'java'

i get correct results with the number of java processes which are running on the monitored redhat linux server, and these java processes are tomcat application server processes

your support is highly apreciated

Thanks
Ahmad
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: check_services OUTPUT: Unknown argument:

Post by mcapra »

From the remote machine, can you share the output of ps -aef? It might make more sense to examine the processes assigned to the tomcat user.

Also have you considered leveraging JMX to get richer information about the Tomcat servers?
https://assets.nagios.com/downloads/nag ... ios-XI.pdf
Former Nagios employee
https://www.mcapra.com/
nietonoshana
Posts: 26
Joined: Thu Jul 04, 2013 1:05 pm

Re: check_services OUTPUT: Unknown argument:

Post by nietonoshana »

Hello if you need check a process

you can use: check_procs

Code: Select all

/check_nrpe -H 10.10.11.106 -t 30 -c check_procs -a '-u root -C java -a /OnD/GrpAgent/GrpAgent/config/i18n/'
I supose:
user to execute its root
comand to execute it's java
and argumnet its /OnD/GrpAgent/GrpAgent/config/i18n/
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: check_services OUTPUT: Unknown argument:

Post by dwhitfield »

Thanks for jumping in @nietonoshana !

@ahmadt, does that help resolve your issue?
ahmadt
Posts: 7
Joined: Thu Nov 19, 2015 5:18 am

Re: check_services OUTPUT: Unknown argument:

Post by ahmadt »

Hi nietonoshana

thanks for your help, it worked but I have an issue when setting warning and critical level as I got the following

Code: Select all

[root@localhost libexec]# ./check_nrpe -H 10.10.11.106 -t 30 -c check_procs -w 1:1 -c 1:1  -a '-u root -a  Dprosrm.server.name=Tomcat'
./check_nrpe: invalid option -- 'w'

NRPE Plugin for Nagios
Copyright (c) 1999-2008 Ethan Galstad ([email protected])
Version: 2.15
Last Modified: 09-06-2013
License: GPL v2 with exemptions (-l for more info)
SSL/TLS Available: Anonymous DH Mode, OpenSSL 0.9.6 or higher required

Usage: check_nrpe -H <host> [ -b <bindaddr> ] [-4] [-6] [-n] [-u] [-p <port>] [-t <timeout>] [-c <command>] [-a <arglist...>]

Options:
 -n         = Do no use SSL
 -u         = Make socket timeouts return an UNKNOWN state instead of CRITICAL
 <host>     = The address of the host running the NRPE daemon
 <bindaddr> = bind to local address
 -4         = user ipv4 only
 -6         = user ipv6 only
 [port]     = The port on which the daemon is running (default=5666)
 [timeout]  = Number of seconds before connection times out (default=10)
 [command]  = The name of the command that the remote daemon should run
 [arglist]  = Optional arguments that should be passed to the command.  Multiple
              arguments should be separated by a space.  If provided, this must be
              the last option supplied on the command line.

Note:
This plugin requires that you have the NRPE daemon running on the remote host.
You must also have configured the daemon to associate a specific plugin command
with the [command] option you are specifying here.  Upon receipt of the
[command] argument, the NRPE daemon will run the appropriate plugin command and
send the plugin output and return code back to *this* plugin.  This allows you
to execute plugins on remote hosts and 'fake' the results to make Nagios think
the plugin is being run locally.
and without the flags w&c it works

Code: Select all

./check_nrpe -H 10.10.11.106 -t 30 -c check_procs -a '-u root -a  Dprosrm.server.name=Tomcat'
PROCS OK: 1 process with UID = 0 (root), args 'Dprosrm.server.name=Tomcat' | procs=1;;;0;
so the when I tested by stopping the process I got on nagios

Code: Select all

PROCS OK: 0 process with UID = 0 (root), args 'Dprosrm.server.name=Tomcat' | procs=1;;;0;
I got process OK! even the process is stopped.

please advice :)

Thanks
Ahmad
Last edited by dwhitfield on Thu Dec 08, 2016 4:15 pm, edited 1 time in total.
Reason: code blocks FTW
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: check_services OUTPUT: Unknown argument:

Post by dwhitfield »

Have you looked at the JMX plugin? It might be a better option. https://exchange.nagios.org/directory/P ... mx/details

Also, what's the output of ps -aef from the remote machine?
nietonoshana
Posts: 26
Joined: Thu Jul 04, 2013 1:05 pm

Re: check_services OUTPUT: Unknown argument:

Post by nietonoshana »

Hello
I think your command should be as follow:

./check_nrpe -H 10.10.11.106 -t 30 -c check_procs -a '-c 1:1 -u root -a Dprosrm.server.name=Tomcat'

Because warning is check_procs parameter, not check_nrpe

An apology for my bad english
ahmadt wrote:Hi nietonoshana

thanks for your help, it worked but I have an issue when setting warning and critical level as I got the following

Code: Select all

[root@localhost libexec]# ./check_nrpe -H 10.10.11.106 -t 30 -c check_procs -w 1:1 -c 1:1  -a '-u root -a  Dprosrm.server.name=Tomcat'
./check_nrpe: invalid option -- 'w'

NRPE Plugin for Nagios
Copyright (c) 1999-2008 Ethan Galstad ([email protected])
Version: 2.15
Last Modified: 09-06-2013
License: GPL v2 with exemptions (-l for more info)
SSL/TLS Available: Anonymous DH Mode, OpenSSL 0.9.6 or higher required

Usage: check_nrpe -H <host> [ -b <bindaddr> ] [-4] [-6] [-n] [-u] [-p <port>] [-t <timeout>] [-c <command>] [-a <arglist...>]

Options:
 -n         = Do no use SSL
 -u         = Make socket timeouts return an UNKNOWN state instead of CRITICAL
 <host>     = The address of the host running the NRPE daemon
 <bindaddr> = bind to local address
 -4         = user ipv4 only
 -6         = user ipv6 only
 [port]     = The port on which the daemon is running (default=5666)
 [timeout]  = Number of seconds before connection times out (default=10)
 [command]  = The name of the command that the remote daemon should run
 [arglist]  = Optional arguments that should be passed to the command.  Multiple
              arguments should be separated by a space.  If provided, this must be
              the last option supplied on the command line.

Note:
This plugin requires that you have the NRPE daemon running on the remote host.
You must also have configured the daemon to associate a specific plugin command
with the [command] option you are specifying here.  Upon receipt of the
[command] argument, the NRPE daemon will run the appropriate plugin command and
send the plugin output and return code back to *this* plugin.  This allows you
to execute plugins on remote hosts and 'fake' the results to make Nagios think
the plugin is being run locally.
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: check_services OUTPUT: Unknown argument:

Post by dwhitfield »

Thanks for jumping in @nietonoshana!

@ahmadt, does that help resolve your issue?
Locked