Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

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

Comment on Return-code in POE::Compoent::Server::NRPE
Download Code
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?


      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
      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.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (6)
As of 2015-04-27 00:33 GMT
Find Nodes?
    Voting Booth?

    Who makes your decisions?

    Results (492 votes), past polls