diff options
Diffstat (limited to 'plugins/check_procs.c')
-rw-r--r-- | plugins/check_procs.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/plugins/check_procs.c b/plugins/check_procs.c index 15ec76f5..671190ca 100644 --- a/plugins/check_procs.c +++ b/plugins/check_procs.c | |||
@@ -85,7 +85,9 @@ main (int argc, char **argv) | |||
85 | char *input_line; | 85 | char *input_line; |
86 | char *procprog; | 86 | char *procprog; |
87 | 87 | ||
88 | pid_t mypid = 0; | ||
88 | int procuid = 0; | 89 | int procuid = 0; |
90 | int procpid = 0; | ||
89 | int procppid = 0; | 91 | int procppid = 0; |
90 | int procvsz = 0; | 92 | int procvsz = 0; |
91 | int procrss = 0; | 93 | int procrss = 0; |
@@ -106,11 +108,12 @@ main (int argc, char **argv) | |||
106 | int expected_cols = PS_COLS - 1; | 108 | int expected_cols = PS_COLS - 1; |
107 | int warn = 0; /* number of processes in warn state */ | 109 | int warn = 0; /* number of processes in warn state */ |
108 | int crit = 0; /* number of processes in crit state */ | 110 | int crit = 0; /* number of processes in crit state */ |
111 | procetime[0]='\0'; /* keep this clean because -vvv always prints it */ | ||
109 | int i = 0; | 112 | int i = 0; |
110 | 113 | ||
111 | int result = STATE_UNKNOWN; | 114 | int result = STATE_UNKNOWN; |
112 | 115 | ||
113 | setlocale (LC_ALL, ""); | 116 | //setlocale (LC_ALL, ""); |
114 | bindtextdomain (PACKAGE, LOCALEDIR); | 117 | bindtextdomain (PACKAGE, LOCALEDIR); |
115 | textdomain (PACKAGE); | 118 | textdomain (PACKAGE); |
116 | 119 | ||
@@ -123,6 +126,9 @@ main (int argc, char **argv) | |||
123 | if (process_arguments (argc, argv) == ERROR) | 126 | if (process_arguments (argc, argv) == ERROR) |
124 | usage4 (_("Could not parse arguments")); | 127 | usage4 (_("Could not parse arguments")); |
125 | 128 | ||
129 | /* get our pid */ | ||
130 | mypid = getpid(); | ||
131 | |||
126 | /* Set signal handling and alarm timeout */ | 132 | /* Set signal handling and alarm timeout */ |
127 | if (signal (SIGALRM, popen_timeout_alarm_handler) == SIG_ERR) { | 133 | if (signal (SIGALRM, popen_timeout_alarm_handler) == SIG_ERR) { |
128 | usage4 (_("Cannot catch SIGALRM")); | 134 | usage4 (_("Cannot catch SIGALRM")); |
@@ -182,15 +188,13 @@ main (int argc, char **argv) | |||
182 | procseconds = convert_to_seconds(procetime); | 188 | procseconds = convert_to_seconds(procetime); |
183 | 189 | ||
184 | if (verbose >= 3) | 190 | if (verbose >= 3) |
185 | printf ("%d %d %d %d %d %.2f %s %s %s %s\n", | 191 | printf ("%d %d %d %d %d %d %.2f %s %s %s %s\n", |
186 | procs, procuid, procvsz, procrss, | 192 | procs, procuid, procvsz, procrss, |
187 | procppid, procpcpu, procstat, | 193 | procpid, procppid, procpcpu, procstat, |
188 | procetime, procprog, procargs); | 194 | procetime, procprog, procargs); |
189 | 195 | ||
190 | /* Ignore self */ | 196 | /* Ignore self */ |
191 | if (strcmp (procprog, progname) == 0) { | 197 | if (mypid == procpid) continue; |
192 | continue; | ||
193 | } | ||
194 | 198 | ||
195 | if ((options & STAT) && (strstr (statopts, procstat))) | 199 | if ((options & STAT) && (strstr (statopts, procstat))) |
196 | resultsum |= STAT; | 200 | resultsum |= STAT; |
@@ -639,9 +643,6 @@ convert_to_seconds(char *etime) { | |||
639 | (minutes * 60) + | 643 | (minutes * 60) + |
640 | seconds; | 644 | seconds; |
641 | 645 | ||
642 | if (verbose >= 3) { | ||
643 | printf("seconds: %d\n", total); | ||
644 | } | ||
645 | return total; | 646 | return total; |
646 | } | 647 | } |
647 | 648 | ||