Bad result code in a PERL plugin

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.
andresrinaldi_uy
Posts: 13
Joined: Wed Oct 28, 2015 11:19 am

Re: Bad result code in a PERL plugin

Post by andresrinaldi_uy »

It's the number of interface, doesn't matter which interface I check, the result (OK, CRITICAL or WARNING), always shows orange (UNKNOWN).
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: Bad result code in a PERL plugin

Post by tgriep »

It could be the embedded perl setting causing the error.
Can you edit your nagios.cfg file and change the following line from

Code: Select all

enable_embedded_perl=1
to

Code: Select all

enable_embedded_perl=0
Save the file and restart nagios.

Wait for the check to run and see if the unknown status is gone and it is OK.
Be sure to check out our Knowledgebase for helpful articles and solutions!
andresrinaldi_uy
Posts: 13
Joined: Wed Oct 28, 2015 11:19 am

Re: Bad result code in a PERL plugin

Post by andresrinaldi_uy »

I did this but the result was worst. With this in mind I did some research and I found this article:

https://assets.nagios.com/downloads/nag ... dperl.html

Change this setting from 1 to 0 for testing purpose

use_embedded_perl_implicitly=0

And it worked, but CPU consumption was too high so I kept reading and found something interesting:
Plugin-Specific Use of the Perl Interpreter

Beginning with Nagios 3, you can specify which Perl plugins or scripts should or should not be run under the embedded Perl interpreter. This is particularly useful if you have troublesome Perl scripts which do not work well with the Perl interpreter.

To explicitly tell Nagios whether or not to use the embedded Perl interpreter for a particular perl script, add one of the following entries to your Perl script/plugin...

To tell Nagios to use the Perl interpreter for a particular script, add this line to the Perl script:

# nagios: +epn
To tell Nagios to NOT use the embedded Perl interpreter for a particular script, add this line to the Perl script:

# nagios: -epn
Either line must be located within the first 10 lines of a script for Nagios to detect it.
So I added "# nagios: -epn" to the plugin and this solved the problem.

In conclusion, this plugin works as should without the Nagios embedded perl.

Image

Thanks a lot for all your help.
Attachments
okstatus.png
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: Bad result code in a PERL plugin

Post by dwhitfield »

Glad to hear it is resolved. I am going to lock the thread. Please feel free to post again if you have you another issue. Thank you for using the Nagios forums!
Locked