diff options
author | Ton Voon <tonvoon@users.sourceforge.net> | 2008-07-08 09:31:04 +0000 |
---|---|---|
committer | Ton Voon <tonvoon@users.sourceforge.net> | 2008-07-08 09:31:04 +0000 |
commit | b93562e6e235eabbe620dc969702bb381d3a0a07 (patch) | |
tree | ced6323b0cb4f863b30a33cfd1dbe029b588efec /lib/utils_cmd.c | |
parent | 830f3cc38a0b7ddcb80dc322f7f60f7f73ac9bfe (diff) | |
download | monitoring-plugins-b93562e6e235eabbe620dc969702bb381d3a0a07.tar.gz |
check_procs captures stderr and adds to plugin output. This is
from a merge of branch nagiosplug/branches/new_threshold_syntax 1979:1982
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@2019 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'lib/utils_cmd.c')
-rw-r--r-- | lib/utils_cmd.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/utils_cmd.c b/lib/utils_cmd.c index aaf055a9..5ba2f55e 100644 --- a/lib/utils_cmd.c +++ b/lib/utils_cmd.c @@ -45,6 +45,7 @@ #include "common.h" #include "utils_cmd.h" #include "utils_base.h" +#include <fcntl.h> #ifdef HAVE_SYS_WAIT_H # include <sys/wait.h> @@ -377,3 +378,20 @@ cmd_run_array (char *const *argv, output * out, output * err, int flags) return _cmd_close (fd); } + +int +cmd_file_read ( char *filename, output *out, int flags) +{ + int fd; + if(out) + memset (out, 0, sizeof(output)); + + if ((fd = open(filename, O_RDONLY)) == -1) { + die( STATE_UNKNOWN, _("Error opening %s: %s"), filename, strerror(errno) ); + } + + if(out) + out->lines = _cmd_fetch_output (fd, out, flags); + + return 0; +} |