NRPE issue

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.
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: NRPE issue

Post by slansing »

I believe he meant:

Code: Select all

su nagios
Then run the command via the command line as that user, to verify you get the same results when the Nagios user executes the check.
jiggityjog
Posts: 20
Joined: Mon Apr 22, 2013 5:14 pm

Re: NRPE issue

Post by jiggityjog »

That's what I thought but the output wasn't reassuring.
Attachments
sunagios.jpg
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: NRPE issue

Post by slansing »

It appears you are still using the jason account, you should be able to use "su nagios" to switch user to nagios, after inputting the correct password your username should change from jason@morta11a to nagios@morta11a.
jiggityjog
Posts: 20
Joined: Mon Apr 22, 2013 5:14 pm

Re: NRPE issue

Post by jiggityjog »

That's what I meant about the output not being reassuring. When I actually logout and then log back in using nagios' credentials, I'm logged in very briefly (half a second) then booted back to the login screen.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: NRPE issue

Post by abrist »

You will not be able to "log in" to user nagios as there should be no password set. You need to switch user to root, either by logging in to root or "su root". Once you are root, you can "su nagios" to switch to the user nagios. If you set a password for the nagios user, you should remove it as that will break all sorts of stuff.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
jiggityjog
Posts: 20
Joined: Mon Apr 22, 2013 5:14 pm

Re: NRPE issue

Post by jiggityjog »

That's good to know, but it's not working.
Attachments
funagios.jpg
jiggityjog
Posts: 20
Joined: Mon Apr 22, 2013 5:14 pm

Re: NRPE issue

Post by jiggityjog »

Here's some debug/log info...

Code: Select all

[1368118882.069514] [016.1] [pid=1078] Handling check result for service 'CPU Load NRPE' on host 'mortalla'...
[1368118882.069525] [001.0] [pid=1078] handle_async_service_check_result()
[1368118882.069535] [016.0] [pid=1078] ** Handling check result for service 'CPU Load NRPE' on host 'mortalla'...
[1368118882.069545] [016.1] [pid=1078] HOST: mortalla, SERVICE: CPU Load NRPE, CHECK TYPE: Active, OPTIONS: 0, SCHEDULED: Yes, RESCHEDULE: Yes, EXITED OK: Yes, RETURN CODE: 3, OUTPUT: \nNRPE Plugin for Nagios\nCopyright (c) 1999-2008 Ethan Galstad (nagios@nagios.org)\nVersion: 2.12\nLast Modified: 03-10-2008\nLicense: GPL v2 with exemptions (-l for more info)\nSSL/TLS Available: Anonymous DH Mode, OpenSSL 0.9.6 or higher required\n\nUsage: check_nrpe -H <host> [-n] [-u] [-p <port>] [-t <timeout>] [-c <command>] [-a <arglist...>]\n\nOptions:\n -n         = Do no use SSL\n -u         = Make socket timeouts return an UNKNOWN state instead of CRITICAL\n <host>     = The address of the host running the NRPE daemon\n [port]     = The port on which the daemon is running (default=5666)\n [timeout]  = Number of seconds before connection times out (default=10)\n [command]  = The name of the command that the remote daemon should run\n [arglist]  = Optional arguments that should be passed to the command.  Multiple\n              arguments should be separated by a space.  If provided, this must be\n              the last option supplied on the command line.\n -h,--help    Print this short help.\n -l,--license Print licensing information.\n -n,--no-ssl  Do not initial an ssl handshake with the server, talk in plaintext.\n\nNote:\nThis plugin requires that you have the NRPE daemon running on the remote host.\nYou must also have configured the daemon to associate a specific plugin command\nwith the [command] option you are specifying here.  Upon receipt of the\n[command] argument, the NRPE daemon will run the appropriate plugin command and\nsend the plugin output and return code back to *this* plugin.  This allows you\nto execute plugins on remote hosts and 'fake' the results to make Nagios think\nthe plugin is being run locally.\n\n
[1368118882.069706] [016.2] [pid=1078] Parsing check output...
[1368118882.069725] [016.2] [pid=1078] Short Output: (No output returned from plugin)
[1368118882.069735] [016.2] [pid=1078] Long Output:  NRPE Plugin for Nagios\nCopyright (c) 1999-2008 Ethan Galstad (nagios@nagios.org)\nVersion: 2.12\nLast Modified: 03-10-2008\nLicense: GPL v2 with exemptions (-l for more info)\nSSL/TLS Available: Anonymous DH Mode, OpenSSL 0.9.6 or higher required\n\nUsage: check_nrpe -H <host> [-n] [-u] [-p <port>] [-t <timeout>] [-c <command>] [-a <arglist...>]\n\nOptions:\n -n         = Do no use SSL\n -u         = Make socket timeouts return an UNKNOWN state instead of CRITICAL\n <host>     = The address of the host running the NRPE daemon\n [port]     = The port on which the daemon is running (default=5666)\n [timeout]  = Number of seconds before connection times out (default=10)\n [command]  = The name of the command that the remote daemon should run\n [arglist]  = Optional arguments that should be passed to the command.  Multiple\n              arguments should be separated by a space.  If provided, this must be\n              the last option supplied on the command line.\n -h,--help    Print this short help.\n -l,--license Print licensing information.\n -n,--no-ssl  Do not initial an ssl handshake with the server, talk in plaintext.\n\nNote:\nThis plugin requires that you have the NRPE daemon running on the remote host.\nYou must also have configured the daemon to associate a specific plugin command\nwith the [command] option you are specifying here.  Upon receipt of the\n[command] argument, the NRPE daemon will run the appropriate plugin command and\nsend the plugin output and return code back to *this* plugin.  This allows you\nto execute plugins on remote hosts and 'fake' the results to make Nagios think\nthe plugin is being run locally.\n\n
[1368118882.069750] [016.2] [pid=1078] Perf Data:    NULL
[1368118882.069760] [016.2] [pid=1078] ST: HARD  CA: 4  MA: 4  CS: 3  LS: 3  LHS: 3
[1368118882.069772] [016.1] [pid=1078] Service is in a non-OK state!
[1368118882.069906] [016.1] [pid=1078] Host is currently UP, so we'll recheck its state to make sure...
[1368118882.069942] [016.1] [pid=1078] * Using last known host state: 0
[1368118882.069954] [016.1] [pid=1078] Current/Max Attempt(s): 4/4
[1368118882.069964] [016.1] [pid=1078] Service has reached max number of rechecks, so we'll handle the error...
[1368118882.069974] [001.0] [pid=1078] check_for_service_flapping()
[1368118882.069983] [016.1] [pid=1078] Checking service 'CPU Load NRPE' on host 'mortalla' for flapping...
[1368118882.069995] [016.2] [pid=1078] LFT=5.00, HFT=20.00, CPC=0.00, PSC=0.00%
[1368118882.070017] [016.1] [pid=1078] Service is not flapping (0.00% state change).
[1368118882.070030] [001.0] [pid=1078] check_for_host_flapping()
[1368118882.070039] [016.1] [pid=1078] Checking host 'mortalla' for flapping...
[1368118882.070058] [016.2] [pid=1078] LFT=5.00, HFT=20.00, CPC=0.00, PSC=0.00%
[1368118882.070078] [016.1] [pid=1078] Host is not flapping (0.00% state change).
[1368118882.070091] [001.0] [pid=1078] service_notification()
[1368118882.070130] [032.0] [pid=1078] ** Service Notification Attempt ** Host: 'mortalla', Service: 'CPU Load NRPE', Type: 0, Options: 0, Current State: 3, Last Notification: Wed May  8 06:22:32 2013
[1368118882.070148] [001.0] [pid=1078] check_service_notification_viability()
[1368118882.070158] [001.0] [pid=1078] check_time_against_period()
[1368118882.070188] [001.0] [pid=1078] check_service_dependencies()
[1368118882.070206] [001.0] [pid=1078] check_host_dependencies()
[1368118882.070217] [032.1] [pid=1078] We shouldn't re-notify contacts about this service problem.
[1368118882.070243] [032.0] [pid=1078] Notification viability test failed.  No notification will be sent out.
[1368118882.070254] [001.0] [pid=1078] obsessive_compulsive_service_check_processor()
[1368118882.070274] [016.1] [pid=1078] Rescheduling next check of service at Thu May  9 11:06:15 2013
[1368118882.070286] [001.0] [pid=1078] get_next_valid_time()
[1368118882.070295] [001.0] [pid=1078] check_time_against_period()
[1368118882.070314] [001.0] [pid=1078] schedule_service_check()
[1368118882.070334] [016.0] [pid=1078] Scheduling a non-forced, active check of service 'CPU Load NRPE' on host 'mortalla' @ Thu May  9 11:06:15 2013
[1368118882.070350] [016.2] [pid=1078] Scheduling new service check event.

Code: Select all

[1368118822.141476] [016.1] [pid=1078] Handling check result for service 'Check Users' on host 'mortalla'...
[1368118822.141488] [001.0] [pid=1078] handle_async_service_check_result()
[1368118822.141498] [016.0] [pid=1078] ** Handling check result for service 'Check Users' on host 'mortalla'...
[1368118822.141508] [016.1] [pid=1078] HOST: mortalla, SERVICE: Check Users, CHECK TYPE: Active, OPTIONS: 0, SCHEDULED: Yes, RESCHEDULE: Yes, EXITED OK: Yes, RETURN CODE: 3, OUTPUT: \nNRPE Plugin for Nagios\nCopyright (c) 1999-2008 Ethan Galstad (nagios@nagios.org)\nVersion: 2.12\nLast Modified: 03-10-2008\nLicense: GPL v2 with exemptions (-l for more info)\nSSL/TLS Available: Anonymous DH Mode, OpenSSL 0.9.6 or higher required\n\nUsage: check_nrpe -H <host> [-n] [-u] [-p <port>] [-t <timeout>] [-c <command>] [-a <arglist...>]\n\nOptions:\n -n         = Do no use SSL\n -u         = Make socket timeouts return an UNKNOWN state instead of CRITICAL\n <host>     = The address of the host running the NRPE daemon\n [port]     = The port on which the daemon is running (default=5666)\n [timeout]  = Number of seconds before connection times out (default=10)\n [command]  = The name of the command that the remote daemon should run\n [arglist]  = Optional arguments that should be passed to the command.  Multiple\n              arguments should be separated by a space.  If provided, this must be\n              the last option supplied on the command line.\n -h,--help    Print this short help.\n -l,--license Print licensing information.\n -n,--no-ssl  Do not initial an ssl handshake with the server, talk in plaintext.\n\nNote:\nThis plugin requires that you have the NRPE daemon running on the remote host.\nYou must also have configured the daemon to associate a specific plugin command\nwith the [command] option you are specifying here.  Upon receipt of the\n[command] argument, the NRPE daemon will run the appropriate plugin command and\nsend the plugin output and return code back to *this* plugin.  This allows you\nto execute plugins on remote hosts and 'fake' the results to make Nagios think\nthe plugin is being run locally.\n\n
[1368118822.141824] [016.2] [pid=1078] Parsing check output...
[1368118822.141853] [016.2] [pid=1078] Short Output: (No output returned from plugin)
[1368118822.141864] [016.2] [pid=1078] Long Output:  NRPE Plugin for Nagios\nCopyright (c) 1999-2008 Ethan Galstad (nagios@nagios.org)\nVersion: 2.12\nLast Modified: 03-10-2008\nLicense: GPL v2 with exemptions (-l for more info)\nSSL/TLS Available: Anonymous DH Mode, OpenSSL 0.9.6 or higher required\n\nUsage: check_nrpe -H <host> [-n] [-u] [-p <port>] [-t <timeout>] [-c <command>] [-a <arglist...>]\n\nOptions:\n -n         = Do no use SSL\n -u         = Make socket timeouts return an UNKNOWN state instead of CRITICAL\n <host>     = The address of the host running the NRPE daemon\n [port]     = The port on which the daemon is running (default=5666)\n [timeout]  = Number of seconds before connection times out (default=10)\n [command]  = The name of the command that the remote daemon should run\n [arglist]  = Optional arguments that should be passed to the command.  Multiple\n              arguments should be separated by a space.  If provided, this must be\n              the last option supplied on the command line.\n -h,--help    Print this short help.\n -l,--license Print licensing information.\n -n,--no-ssl  Do not initial an ssl handshake with the server, talk in plaintext.\n\nNote:\nThis plugin requires that you have the NRPE daemon running on the remote host.\nYou must also have configured the daemon to associate a specific plugin command\nwith the [command] option you are specifying here.  Upon receipt of the\n[command] argument, the NRPE daemon will run the appropriate plugin command and\nsend the plugin output and return code back to *this* plugin.  This allows you\nto execute plugins on remote hosts and 'fake' the results to make Nagios think\nthe plugin is being run locally.\n\n
[1368118822.141879] [016.2] [pid=1078] Perf Data:    NULL
[1368118822.141889] [016.2] [pid=1078] ST: HARD  CA: 4  MA: 4  CS: 3  LS: 3  LHS: 3
[1368118822.141902] [016.1] [pid=1078] Service is in a non-OK state!
[1368118822.141911] [016.1] [pid=1078] Host is currently UP, so we'll recheck its state to make sure...
[1368118822.141920] [016.1] [pid=1078] * Using last known host state: 0
[1368118822.141930] [016.1] [pid=1078] Current/Max Attempt(s): 4/4
[1368118822.141940] [016.1] [pid=1078] Service has reached max number of rechecks, so we'll handle the error...
[1368118822.141950] [001.0] [pid=1078] check_for_service_flapping()
[1368118822.141975] [016.1] [pid=1078] Checking service 'Check Users' on host 'mortalla' for flapping...
[1368118822.141988] [016.2] [pid=1078] LFT=5.00, HFT=20.00, CPC=0.00, PSC=0.00%
[1368118822.142012] [016.1] [pid=1078] Service is not flapping (0.00% state change).
[1368118822.142027] [001.0] [pid=1078] check_for_host_flapping()
[1368118822.142036] [016.1] [pid=1078] Checking host 'mortalla' for flapping...
[1368118822.142053] [016.2] [pid=1078] LFT=5.00, HFT=20.00, CPC=0.00, PSC=0.00%
[1368118822.142073] [016.1] [pid=1078] Host is not flapping (0.00% state change).
[1368118822.142086] [001.0] [pid=1078] service_notification()
[1368118822.142118] [032.0] [pid=1078] ** Service Notification Attempt ** Host: 'mortalla', Service: 'Check Users', Type: 0, Options: 0, Current State: 3, Last Notification: Wed May  8 08:54:25 2013
[1368118822.142134] [001.0] [pid=1078] check_service_notification_viability()
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: NRPE issue

Post by abrist »

Try the following as root (you may not have a shell set for nagios in /etc/passwd):

Code: Select all

su -s /bin/bash nagios
If that does not work, post the output of:

Code: Select all

cat /etc/passwd | grep nagios
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
jiggityjog
Posts: 20
Joined: Mon Apr 22, 2013 5:14 pm

Re: NRPE issue

Post by jiggityjog »

That worked abrist (! thanks!) and here are the results:
Attachments
iamnagios.jpg
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: NRPE issue

Post by abrist »

Looks like some checks are working while others are not. Could you post (*in code wraps*) your remote nrpe.cfg and your nagios server's commands.cfg?
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Locked