diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/check_nagios.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/plugins/check_nagios.c b/plugins/check_nagios.c index ea79d24..d19445a 100644 --- a/plugins/check_nagios.c +++ b/plugins/check_nagios.c | |||
@@ -30,7 +30,7 @@ | |||
30 | #include "popen.h" | 30 | #include "popen.h" |
31 | #include "utils.h" | 31 | #include "utils.h" |
32 | 32 | ||
33 | #define PROGNAME "check_nagios" | 33 | const char *PROGNAME = "check_nagios"; |
34 | 34 | ||
35 | int process_arguments (int, char **); | 35 | int process_arguments (int, char **); |
36 | void print_usage (void); | 36 | void print_usage (void); |
@@ -93,9 +93,9 @@ main (int argc, char **argv) | |||
93 | printf ("Could not open stderr for %s\n", PS_RAW_COMMAND); | 93 | printf ("Could not open stderr for %s\n", PS_RAW_COMMAND); |
94 | } | 94 | } |
95 | 95 | ||
96 | /* cound the number of matching Nagios processes... */ | 96 | /* count the number of matching Nagios processes... */ |
97 | while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process)) { | 97 | while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process)) { |
98 | if (strstr (input_buffer, process_string)) | 98 | if (!strstr(input_buffer, argv[0]) && strstr(input_buffer, process_string)) |
99 | proc_entries++; | 99 | proc_entries++; |
100 | } | 100 | } |
101 | 101 | ||
@@ -183,14 +183,14 @@ process_arguments (int argc, char **argv) | |||
183 | 183 | ||
184 | switch (c) { | 184 | switch (c) { |
185 | case '?': /* print short usage statement if args not parsable */ | 185 | case '?': /* print short usage statement if args not parsable */ |
186 | printf ("%s: Unknown argument: %c\n\n", my_basename (argv[0]), optopt); | 186 | printf ("%s: Unknown argument: %c\n\n", PROGNAME, optopt); |
187 | print_usage (); | 187 | print_usage (); |
188 | exit (STATE_UNKNOWN); | 188 | exit (STATE_UNKNOWN); |
189 | case 'h': /* help */ | 189 | case 'h': /* help */ |
190 | print_help (); | 190 | print_help (); |
191 | exit (STATE_OK); | 191 | exit (STATE_OK); |
192 | case 'V': /* version */ | 192 | case 'V': /* version */ |
193 | print_revision (my_basename (argv[0]), "$Revision$"); | 193 | print_revision (PROGNAME, "$Revision$"); |
194 | exit (STATE_OK); | 194 | exit (STATE_OK); |
195 | case 'F': /* hostname */ | 195 | case 'F': /* hostname */ |
196 | status_log = optarg; | 196 | status_log = optarg; |
@@ -263,5 +263,5 @@ print_help (void) | |||
263 | "-V, --version\n" | 263 | "-V, --version\n" |
264 | " Print version information\n\n" | 264 | " Print version information\n\n" |
265 | "Example:\n" | 265 | "Example:\n" |
266 | " ./check_nagios -H /usr/local/nagios/var/status.log -e 5 -C /usr/local/nagios/bin/nagios\n"); | 266 | " ./check_nagios -F /usr/local/nagios/var/status.log -e 5 -C /usr/local/nagios/bin/nagios\n"); |
267 | } | 267 | } |