check_mailq | Service check did not exit properly

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

check_mailq | Service check did not exit properly

Post by steffi »

Hi.
One of my remote servers to check is using the check_mailq service check.
I am on Ubuntu 18.04 using postfix.
My service check result is: (Service check did not exit properly).

What am I doing wrong?
Thanks,
Steffi

Code: Select all

define service {
        host_name       localhost
        service_description     mailq
        check_period    24x7
        check_command   check_mailqueue!100!200
        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
        }
User avatar
lmiltchev
Former Nagios Staff
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: check_mailq | Service check did not exit properly

Post by lmiltchev »

Can you show us the actual check run from the command line along with the output of it? Please add "-v" to the command (for verbose mode/debugging output).
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_mailq | Service check did not exit properly

Post by steffi »

Code: Select all

root@mail-2018:~# sudo -u nagios /usr/lib/nagios/plugins/check_mailq -w 10 -c 20 -v
OK: postfix mailq reports queue is empty|unsent=0;10;20;0
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: check_mailq | Service check did not exit properly

Post by npolovenko »

@steffi, Thank you. I would like to see how the check_mailqueue command is defined on your Nagios server.
The command is most likely located in this file:
/usr/local/nagios/etc/objects/commands.cfg
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_mailq | Service check did not exit properly

Post by steffi »

Hi.
Thanks for your support. This is the command definition:

Code: Select all

define command{
        command_name check_mailqueue
        command_line $USER1$/check_mailq  -w '$ARG1$' -c '$ARG2$' -M postfix
}
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: check_mailq | Service check did not exit properly

Post by scottwilkerson »

So based on this command your server would run the following, can you run it from the command line?

Code: Select all

sudo -u nagios /usr/lib/nagios/plugins/check_mailq -w 10 -c 20 -M postfix
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
steffi
Posts: 25
Joined: Wed Mar 06, 2019 9:43 am

Re: check_mailq | Service check did not exit properly

Post by steffi »

Hi Scott.
This is the output:

Code: Select all

root@mail-2018:~# sudo -u nagios /usr/lib/nagios/plugins/check_mailq -w 10 -c 20 -M postfix
OK: postfix mailq reports queue is empty|unsent=0;10;20;0
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: check_mailq | Service check did not exit properly

Post by scottwilkerson »

Per the plugin help

Code: Select all

This plugin uses the system mailq command (sendmail) or qmail-stat (qmail)
 to look at the queues. Mailq can usually only be accessed by root or
 a TrustedUser. You will have to set appropriate permissions for the plugin to work.
So your command would need to be prefixed with sudo

Code: Select all

define command{
        command_name check_mailqueue
        command_line sudo $USER1$/check_mailq  -w '$ARG1$' -c '$ARG2$' -M postfix
}
and you would need to add the appropriate line to your sudoers file allowing the nagios user sudo access to

Code: Select all

nagios ALL = NOPASSWD:/usr/lib/nagios/plugins/check_mailq *
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
steffi
Posts: 25
Joined: Wed Mar 06, 2019 9:43 am

Re: check_mailq | Service check did not exit properly

Post by steffi »

Ah, thanks.
This is what I did with the check_udp_port plugin also which uses nmap.

Will try.
Thanks.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: check_mailq | Service check did not exit properly

Post by scottwilkerson »

steffi wrote:Ah, thanks.
This is what I did with the check_udp_port plugin also which uses nmap.

Will try.
Thanks.
Let us know if you have further questions
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked