Nagio plugin installation error

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
robotto
Posts: 10
Joined: Sun Sep 22, 2013 12:08 am

Nagio plugin installation error

Post by robotto »

In reference to this topic: http://support.nagios.com/forum/viewtop ... 35&t=26852

I habe the same issue on Debian 7.5.

After installing gawak everything looks ok but I now I geht the following error.
Having no space between pattern and following word is deprecated at ./check_mailq line 613.
Bareword found where operator expected at ./check_mailq line 613, near "/usr/sbin"
(Missing operator before bin?)
Semicolon seems to be missing at ./check_mailq line 618.
syntax error at ./check_mailq line 613, near "/usr/sbin"
syntax error at ./check_mailq line 618, near "exim4 elsif"
syntax error at ./check_mailq line 623, near "nullmailer elsif"
syntax error at ./check_mailq line 670, near "}"
Execution of ./check_mailq aborted due to compilation errors.
The file /usr/local/nagios/libexec/check_mailq show this.

Code: Select all

        }else{
                if (defined $utils::PATH_TO_QMAIL_QSTAT
                    && -x $utils::PATH_TO_QMAIL_QSTAT)
                {
                        $mailq = 'qmail';
                }
/usr/sbin/postfix               elsif (-d '/var/lib/postfix' || -d '/var/local/lib/postfix'
/usr/sbin/postfix                      || -e '/usr/sbin/postfix' || -e '/usr/local/sbin/postfix')
                {
                        $mailq = 'postfix';
                }
exim4           elsif (-d '/usr/lib/exim4' || -d '/usr/local/lib/exim4'
exim                   || -e '/usr/sbin/exim' || -e '/usr/local/sbin/exim')
                {
                        $mailq = 'exim';
                }
nullmailer              elsif (-d '/usr/lib/nullmailer' || -d '/usr/local/lib/nullmailer'
                       || -e 'nullmailer-send'
                       || -e 'nullmailer-send')
                {
                        $mailq = 'nullmailer';
                }
                else {
                        $mailq = 'sendmail';
                }
        }
Last edited by tmcdonald on Tue May 13, 2014 2:14 pm, edited 2 times in total.
Reason: I have split your reply to that topic into its own for organization purposes.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Nagio plugin installation error

Post by tmcdonald »

That's very odd, and I have the same thing going on in my plugin.

The lines should be as follows:

Code: Select all

            }else{
                    if (defined $utils::PATH_TO_QMAIL_QSTAT
                        && -x $utils::PATH_TO_QMAIL_QSTAT)
                    {
                            $mailq = 'qmail';
                    }
                    elsif (-d '/var/lib/postfix' || -d '/var/local/lib/postfix'
                        || -e '/usr/sbin/postfix' || -e '/usr/local/sbin/postfix')
                    {
                            $mailq = 'postfix';
                    }
                    elsif (-d '/usr/lib/exim4' || -d '/usr/local/lib/exim4'
                        || -e '/usr/sbin/exim' || -e '/usr/local/sbin/exim')
                    {
                            $mailq = 'exim';
                    }
                    elsif (-d '/usr/lib/nullmailer' || -d '/usr/local/lib/nullmailer'
                           || -e 'nullmailer-send'
                           || -e 'nullmailer-send')
                    {
                            $mailq = 'nullmailer';
                    }
                    else {
                            $mailq = 'sendmail';
                    }
            }

Former Nagios employee
robotto
Posts: 10
Joined: Sun Sep 22, 2013 12:08 am

Re: Nagio plugin installation error

Post by robotto »

When I modify the file it works
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Nagio plugin installation error

Post by slansing »

You modified to what Tmcdonald showed? I'm going to check with the plugins dev today and see if it's currently still a dirty script in the development version they use.
robotto
Posts: 10
Joined: Sun Sep 22, 2013 12:08 am

Re: Nagio plugin installation error

Post by robotto »

When I modified the script it works.
Locked