Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

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:


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

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 #poe. The author is applying pull requests almost as fast as we can send them. You should see a new release on CPAN soon.


      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?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1002942]
Approved by marto
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2018-01-21 18:35 GMT
Find Nodes?
    Voting Booth?
    How did you see in the new year?

    Results (229 votes). Check out past polls.