From 20630de1405d538478c0c613f9922f548c4b5172 Mon Sep 17 00:00:00 2001 From: Matthew Kent Date: Fri, 19 Nov 2004 03:44:13 +0000 Subject: Enabling timeout flag (1010097, Jason Martin) git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@908 f882894a-f735-0410-b71e-b25c423dba1c --- plugins/check_procs.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/plugins/check_procs.c b/plugins/check_procs.c index 402daa53..3eefdb44 100644 --- a/plugins/check_procs.c +++ b/plugins/check_procs.c @@ -119,6 +119,15 @@ main (int argc, char **argv) if (process_arguments (argc, argv) == ERROR) usage (_("Unable to parse command line\n")); + + /* Set signal handling and alarm timeout */ + if (signal (SIGALRM, popen_timeout_alarm_handler) == SIG_ERR) { + printf (_("Cannot catch SIGALRM")); + return STATE_UNKNOWN; + } + alarm (timeout_interval); + + if (verbose >= 2) printf (_("CMD: %s\n"), PS_COMMAND); @@ -603,7 +612,11 @@ Optional Arguments:\n\ PROCS - number of processes (default)\n\ VSZ - virtual memory size\n\ RSS - resident set memory size\n\ - CPU - percentage cpu\n\ + CPU - percentage cpu\n")); + + printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT); + + printf(_("\ -v, --verbose\n\ Extra information. Up to 3 verbosity levels\n")); @@ -664,7 +677,7 @@ print_usage (void) printf ("\ Usage: %s -w -c [-m metric] [-s state] [-p ppid]\n\ [-u user] [-r rss] [-z vsz] [-P %%cpu] [-a argument-array]\n\ - [-C command] [-v]\n", progname); + [-C command] [-t timeout] [-v]\n", progname); printf (_(UT_HLP_VRS), progname, progname); } -- cgit v1.2.3-74-g34f1