[Nagiosplug-devel] spopen and pipes?

Andrew Perron droopy at neap.net
Fri Feb 4 19:40:43 CET 2005


I've taken over some old netsaint plugins that a developer made for us and they 
were not working in nagios, so I was trying to convert them (i.e. rewrite from 
scratch).

One thing, in comparing how he did it vs. what the guide recommends is the use 
of popen instead of spopen and writing information to temporary files.

I would like to do what amounts to the following to a log file on a syslog 
server:

- use grep to find relevant entries (many)
- use sort to ensure that they are in order (may not be)
- use tail to get the most recent entry

Seems only under certain specific circumstances can I use pipes or redirects in 
the spopen command string, so my question is whether there's a way to pipe the 
output of spopen pipes from one to another or if there is another workaround.

I tried using the output from the command executed and then writing to a file, 
but due to the volume this seems to cause unreasonable delays causing plugins to 
timeout.

Thanks for any help.

Regards,

Droopy




More information about the Devel mailing list