[Nagiosplug-devel] Python plugin without output

Tarjei Huse tarjei at scanmine.com
Tue Oct 21 16:19:14 CEST 2008


matthias eble wrote:
> On Tue, 2008-10-21 at 09:22 +0200, Tarjei Huse wrote:
>   
>> Ingo Lantschner wrote: 
>>     
>>> Am 20.10.2008 um 16:32 schrieb Tarjei Huse:
>>>
>>>   
>>>       
>>>> My problem is that when I use this plugin from nagios it ends up  
>>>> saying
>>>> that the reported output was "(null)". Now, I've tested the plugin on
>>>> the commandline, as a nagios user without problems.
>>>>     
>>>>         
>>> Are you using NRPE or Nagios directly?
>>>   
>>>       
>> It uses Nagios directly.
>>     
>>> Does your plugin write to stdout?
>>>   
>>>       
>> Yes
>>     
>
> Stack traces are written to stderdd so I'd suppose
> you run in an uncaught exception.
>
> you can add 
> 2>&1 | cat  
>   
That solved it! This one should be in the manual under debugging :)

It ended up being a problem with the python egg cache. I ended up adding:
if 'root' in cache:
    
os.environ['PYTHON_EGG_CACHE']=os.path.expanduser("~nagios")+"/.python-eggs"
     pkg_resources.cleanup_resources()
     pkg_resources.set_extraction_path(os.environ['PYTHON_EGG_CACHE'])
     pkg_resources.cleanup_resources()

This solved the problem.

Thanks for helping me solve this one. I've been scratching my head for
quite some time.

regards,
Tarjei

> to your check command. Tracebacks are printed in the UI then.
> However your exit code won't be appropriate. Maybe someone has a smarter
> solution to get stderr also printed in nagios.
>
> HTH
> Matthias
>
>
>
>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________________
> Nagios Plugin Development Mailing List Nagiosplug-devel at lists.sourceforge.net
> Unsubscribe at https://lists.sourceforge.net/lists/listinfo/nagiosplug-devel
> ::: Please include plugins version (-v) and OS when reporting any issue. 
> ::: Messages without supporting info will risk being sent to /dev/null
>   

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-plugins.org/archive/devel/attachments/20081021/fcb12b37/attachment.html>


More information about the Devel mailing list