Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Return-code in POE::Compoent::Server::NRPE

by chris01 (Novice)
on Nov 08, 2012 at 16:28 UTC ( #1002942=perlquestion: print w/ replies, xml ) Need Help??
chris01 has asked for the wisdom of the Perl Monks concerning the following question:

hi!

My question is pretty specific but I am a bit desperate here since some time.

I am using POE and POE::Component::Server::NRPE to implement a Nagios NRPEd.

Its fine but I am not able to return the correct value in the command. but the text is ok.
use POE; use POE::Component::Server::NRPE; # test with: check_nrpe -H localhost -c test; echo $? my $nrped = POE::Component::Server::NRPE->spawn (port => 5666); $nrped->add_command (command => "test", program => sub { print STDOUT "test CRITICAL\n"; return 2; #### always 0??? }); $poe_kernel->run (); return 0;
In the modules site at cpan there is some reference to return_result but I am not aware how to use it.

Maybe someone can give me a quick advise? I would like to return a value not equal to 0.

thanks a lot! cheers, chris

Comment on Return-code in POE::Compoent::Server::NRPE
Download Code
Replies are listed 'Best First'.
Re: Return-code in POE::Compoent::Server::NRPE
by rcaputo (Chaplain) on Nov 08, 2012 at 18:14 UTC

    Edit: There might be a documentation error. It may be necessary to exit(2) from the test program rather than return it.

    Original: The sub you've written above returns 2. What do you expect it to do? What unexpected thing happens instead? To where should the return value go?

      no, exit does not help :-(

        Congratulations! You've found a bug in the module. Three of us are working on it over on irc.perl.org #poe. The author is applying pull requests almost as fast as we can send them. You should see a new release on CPAN soon.

      hello!

      the sub return 2 but in the NRPE-response is 0. I need to set the nrpe-response-code. the response-text is set correctly (print stdout)

      I am not familiar with Perl POE but as described in the cpans-site of POE::COmponent::Server::NRPE there is a fuction return_result.

      but I have no idea how to use this funktion. think has something todo with POE sessions.

      best regards, chris

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1002942]
Approved by marto
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (5)
As of 2015-08-02 23:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The oldest computer book still on my shelves (or on my digital media) is ...













    Results (18 votes), past polls