aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Matthew Kent <mattkent@users.sourceforge.net> 2004-11-19 03:44:13 +0000
committerGravatar Matthew Kent <mattkent@users.sourceforge.net> 2004-11-19 03:44:13 +0000
commit20630de1405d538478c0c613f9922f548c4b5172 (patch)
tree190dd15069a9995575159fd38e514828a9ce3e1e
parent7ccca5ed7fe7623277243def84b5e369032b7e22 (diff)
downloadmonitoring-plugins-20630de1405d538478c0c613f9922f548c4b5172.tar.gz
Enabling timeout flag (1010097, Jason Martin)
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@908 f882894a-f735-0410-b71e-b25c423dba1c
-rw-r--r--plugins/check_procs.c17
1 files 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 <range> -c <range> [-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);
}