check_smtp | Return code of 127 is out of bounds

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.
Locked
steffi
Posts: 25
Joined: Wed Mar 06, 2019 9:43 am

check_smtp | Return code of 127 is out of bounds

Post by steffi »

Hi.
When using check_smtp, I am getting this Message:
Return code of 127 is out of bounds - plugin may be missing

When I trigger the check from cli, I get this:
root@mail-2018:~# /usr/lib/nagios/plugins/check_smtp -H localhost --port 25
SMTP OK - 0,043 sec. response time|time=0,042863s;;;0,000000

So I think the Plugin is not missing.
What am I doing wrong?

Thanks,
Steffi

Code: Select all

[define service {
        host_name       localhost
        service_description     smtpd-25
        check_period    24x7
        check_command   check_smtpd_25!localhost|25
        contact_groups  admins
        notification_period     24x7
        initial_state   o
        check_interval  5.000000
        retry_interval  1.000000
        max_check_attempts      4
        is_volatile     0
        parallelize_check       1
        active_checks_enabled   1
        passive_checks_enabled  1
        obsess_over_service     1
        event_handler_enabled   1
        low_flap_threshold      0.000000
        high_flap_threshold     0.000000
        flap_detection_enabled  1
        flap_detection_options  o,w,u,c
        freshness_threshold     0
        check_freshness 0
        notification_options    u,w,c,r
        notifications_enabled   1
        notification_interval   0.000000
        first_notification_delay        0.000000
        stalking_options        n
        process_perf_data       1
        failure_prediction_enabled      1
        retain_status_information       1
        retain_nonstatus_information    1
        }/code]

[code]define command{
        command_name check_smtpd_25
        command_line $USER1$/check_smtp -H $ARG1$ --port $ARG2$
}
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: check_smtp | Return code of 127 is out of bounds

Post by tgriep »

Couple of things that could cause this.
1. A permission issue. When nagios runs a plugin, it runs it as the nagios user and of the permissions for the plugin are not set for the nagios user, it could generate that error.
To set the permissions, run the following as root.

Code: Select all

chown nagios.nagios /usr/lib/nagios/plugins/check_smtp
chmod a+x /usr/lib/nagios/plugins/check_smtp

2. The command is using the $USER1$ macro for the plugin's path on the file system.
Make sure the $USER1$ macro in the resource.cfg file is set to

Code: Select all

/usr/lib/nagios/plugins/
If not, update it and restart nagios for the change to take effect.
Be sure to check out our Knowledgebase for helpful articles and solutions!
steffi
Posts: 25
Joined: Wed Mar 06, 2019 9:43 am

Re: check_smtp | Return code of 127 is out of bounds

Post by steffi »

Thanks for taking care of my issue.
I double checked what you mentionend, but it was all set:

Code: Select all

# Sets $USER1$ to be the path to the plugins
$USER1$=/usr/lib/nagios/plugins

root@mail-2018:~# ll /usr/lib/nagios/plugins/check_smtp 
-rwxr-xr-x 1 root root 72592 Feb  6  2018 /usr/lib/nagios/plugins/check_smtp*
It is not working still.
Steffi
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: check_smtp | Return code of 127 is out of bounds

Post by tgriep »

Try running the plugin as the nagios user and echo out the status so we can see what it is.
Try running this in a shell. Post the full output.

Code: Select all

su - nagios
/usr/lib/nagios/plugins/check_smtp -H localhost --port 25
echo $?
Thanks.
Be sure to check out our Knowledgebase for helpful articles and solutions!
steffi
Posts: 25
Joined: Wed Mar 06, 2019 9:43 am

Re: check_smtp | Return code of 127 is out of bounds

Post by steffi »

Code: Select all

root@mail-2018:~# sudo -u nagios /usr/lib/nagios/plugins/check_smtp -H localhost --port 25 -v
HELOCMD: HELO mail-2018
250 mx18.mx.my.tld
sent QUIT
received 221 2.0.0 Bye

SMTP OK - 0,057 sec. response time, 221 2.0.0 Bye
|time=0,056918s;;;0,000000
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: check_smtp | Return code of 127 is out of bounds

Post by npolovenko »

@steffi, In the service definition that you posted you have | sign instead of ! dividing arguments. Look at the line:
check_command check_smtpd_25!localhost|25
You need to replace |with !
check_command check_smtpd_25!localhost!25

Code: Select all

define service {
        host_name       localhost
        service_description     smtpd-25
        check_period    24x7
        check_command   check_smtpd_25!localhost|25
        contact_groups  admins
        notification_period     24x7
        initial_state   o
        check_interval  5.000000
        retry_interval  1.000000
        max_check_attempts      4
        is_volatile     0
        parallelize_check       1
        active_checks_enabled   1
        passive_checks_enabled  1
        obsess_over_service     1
        event_handler_enabled   1
        low_flap_threshold      0.000000
        high_flap_threshold     0.000000
        flap_detection_enabled  1
        flap_detection_options  o,w,u,c
        freshness_threshold     0
        check_freshness 0
        notification_options    u,w,c,r
        notifications_enabled   1
        notification_interval   0.000000
        first_notification_delay        0.000000
        stalking_options        n
        process_perf_data       1
        failure_prediction_enabled      1
        retain_status_information       1
        retain_nonstatus_information    1
        }
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
steffi
Posts: 25
Joined: Wed Mar 06, 2019 9:43 am

Re: check_smtp | Return code of 127 is out of bounds

Post by steffi »

Wow. I was too blind to see.
Thank you so much| :-) It is working| :-)
Steffi
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: check_smtp | Return code of 127 is out of bounds

Post by scottwilkerson »

steffi wrote:Wow. I was too blind to see.
Thank you so much| :-) It is working| :-)
Steffi
Great!

Locking thread
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked