summaryrefslogtreecommitdiffstats
path: root/plugins/check_nagios.c
diff options
context:
space:
mode:
authorKarl DeBisschop <kdebisschop@users.sourceforge.net>2003-08-10 06:53:22 (GMT)
committerKarl DeBisschop <kdebisschop@users.sourceforge.net>2003-08-10 06:53:22 (GMT)
commitf4f92be60c94fd4e0dd4b2b4b3101543eedb706a (patch)
tree28d25bd0ab624d82435823c940a186370947ad4d /plugins/check_nagios.c
parentcbf702f51f839af5a8e9c66bdae7d6a3dc363ace (diff)
downloadmonitoring-plugins-f4f92be60c94fd4e0dd4b2b4b3101543eedb706a.tar.gz
the last round of pedantic compiler warnings
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@676 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins/check_nagios.c')
-rw-r--r--plugins/check_nagios.c106
1 files changed, 58 insertions, 48 deletions
diff --git a/plugins/check_nagios.c b/plugins/check_nagios.c
index a678e2a..5b21ba1 100644
--- a/plugins/check_nagios.c
+++ b/plugins/check_nagios.c
@@ -25,48 +25,9 @@ const char *email = "nagiosplug-devel@lists.sourceforge.net";
25#include "popen.h" 25#include "popen.h"
26#include "utils.h" 26#include "utils.h"
27 27
28void
29print_usage (void)
30{
31 printf (_("\
32Usage: %s -F <status log file> -e <expire_minutes> -C <process_string>\n"),
33 progname);
34}
35
36void
37print_help (void)
38{
39 print_revision (progname, revision);
40
41 printf (_(COPYRIGHT), copyright, email);
42
43 printf (_("\
44This plugin attempts to check the status of the Nagios process on the local\n\
45machine. The plugin will check to make sure the Nagios status log is no older\n\
46than the number of minutes specified by the <expire_minutes> option. It also\n\
47uses the /bin/ps command to check for a process matching whatever you specify\n\
48by the <process_string> argument.\n"));
49
50 print_usage ();
51
52 printf (_(UT_HELP_VRSN));
53
54 printf (_("\
55-F, --filename=FILE\n\
56 Name of the log file to check\n\
57-e, --expires=INTEGER\n\
58 Seconds aging afterwhich logfile is condsidered stale\n\
59-C, --command=STRING\n\
60 Command to search for in process table\n"));
61
62 printf (_("\
63Example:\n\
64 ./check_nagios -e 5 \\\
65 -F /usr/local/nagios/var/status.log \\\
66 -C /usr/local/nagios/bin/nagios\n"));
67}
68
69int process_arguments (int, char **); 28int process_arguments (int, char **);
29void print_help (void);
30void print_usage (void);
70 31
71char *status_log = NULL; 32char *status_log = NULL;
72char *process_string = NULL; 33char *process_string = NULL;
@@ -198,8 +159,8 @@ process_arguments (int argc, char **argv)
198{ 159{
199 int c; 160 int c;
200 161
201 int option_index = 0; 162 int option = 0;
202 static struct option long_options[] = { 163 static struct option longopts[] = {
203 {"filename", required_argument, 0, 'F'}, 164 {"filename", required_argument, 0, 'F'},
204 {"expires", required_argument, 0, 'e'}, 165 {"expires", required_argument, 0, 'e'},
205 {"command", required_argument, 0, 'C'}, 166 {"command", required_argument, 0, 'C'},
@@ -225,7 +186,7 @@ process_arguments (int argc, char **argv)
225 } 186 }
226 187
227 while (1) { 188 while (1) {
228 c = getopt_long (argc, argv, "+hVvF:C:e:", long_options, &option_index); 189 c = getopt_long (argc, argv, "+hVvF:C:e:", longopts, &option);
229 190
230 if (c == -1 || c == EOF || c == 1) 191 if (c == -1 || c == EOF || c == 1)
231 break; 192 break;
@@ -252,8 +213,8 @@ process_arguments (int argc, char **argv)
252 expire_minutes = atoi (optarg); 213 expire_minutes = atoi (optarg);
253 else 214 else
254 die (STATE_UNKNOWN, 215 die (STATE_UNKNOWN,
255 _("Expiration time must be an integer (seconds)\nType '%s -h' for additional help\n"), 216 _("Expiration time must be an integer (seconds)\nType '%s -h' for additional help\n"),
256 progname); 217 progname);
257 break; 218 break;
258 case 'v': 219 case 'v':
259 verbose++; 220 verbose++;
@@ -264,8 +225,8 @@ process_arguments (int argc, char **argv)
264 225
265 if (status_log == NULL) 226 if (status_log == NULL)
266 die (STATE_UNKNOWN, 227 die (STATE_UNKNOWN,
267 _("You must provide the status_log\nType '%s -h' for additional help\n"), 228 _("You must provide the status_log\nType '%s -h' for additional help\n"),
268 progname); 229 progname);
269 else if (process_string == NULL) 230 else if (process_string == NULL)
270 die (STATE_UNKNOWN, 231 die (STATE_UNKNOWN,
271 _("You must provide a process string\nType '%s -h' for additional help\n"), 232 _("You must provide a process string\nType '%s -h' for additional help\n"),
@@ -273,3 +234,52 @@ process_arguments (int argc, char **argv)
273 234
274 return OK; 235 return OK;
275} 236}
237
238
239
240
241
242
243void
244print_help (void)
245{
246 print_revision (progname, revision);
247
248 printf (_(COPYRIGHT), copyright, email);
249
250 printf (_("\
251This plugin attempts to check the status of the Nagios process on the local\n\
252machine. The plugin will check to make sure the Nagios status log is no older\n\
253than the number of minutes specified by the <expire_minutes> option. It also\n\
254uses the /bin/ps command to check for a process matching whatever you specify\n\
255by the <process_string> argument.\n"));
256
257 print_usage ();
258
259 printf (_(UT_HELP_VRSN));
260
261 printf (_("\
262-F, --filename=FILE\n\
263 Name of the log file to check\n\
264-e, --expires=INTEGER\n\
265 Seconds aging afterwhich logfile is condsidered stale\n\
266-C, --command=STRING\n\
267 Command to search for in process table\n"));
268
269 printf (_("\
270Example:\n\
271 ./check_nagios -e 5 \\\
272 -F /usr/local/nagios/var/status.log \\\
273 -C /usr/local/nagios/bin/nagios\n"));
274}
275
276
277
278
279void
280print_usage (void)
281{
282 printf (_("\
283Usage: %s -F <status log file> -e <expire_minutes> -C <process_string>\n"),
284 progname);
285}