title: Why does ps only return one line of output in my Perl script when I call it with Nagios?
body: <p>I have this running:</p>
  
  <pre><code>if (open(PS_ELF, "/bin/ps -eLf|")) {
    while (&lt;PS_ELF&gt;) {
      if ($_ =~ m/some regex/) {
        # do some stuff
      }
    }
  }
  </code></pre>
  
  <p>If called locally, the loop runs just fine, once for every output line of <code>ps -eLf</code></p>
  
  <p>Now if the same script is called from <a href="http://www.nagios.org" rel="nofollow noreferrer">Nagios</a> via <a href="http://nagios.sourceforge.net/docs/3_0/addons.html" rel="nofollow noreferrer">NRPE</a>, <code>PS_ELF</code> does only contain one line (the first line output by <code>ps</code>).</p>
  
  <p>This puzzles me; what could be the reason?</p>
  
  <p>Maybe this is not limited to/caused by Nagios at all, I just included it for the sake of completeness.</p>
  
  <p>I'm on SUSE Enterprise Linux 10 SP2 and perl v5.8.8.</p>