1 /******************************************************************************
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2 of the License, or
6 (at your option) any later version.
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
13 You should have received a copy of the GNU General Public License
14 along with this program; if not, write to the Free Software
15 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 ******************************************************************************/
19 #include "common.h"
20 #include "utils.h"
22 const char *progname = "check_dummy";
23 const char *revision = "$Revision$";
24 const char *copyright = "1999-2003";
25 const char *email = "nagiosplug-devel@lists.sourceforge.net";
27 void print_help (void);
28 void print_usage (void);
32 int
33 main (int argc, char **argv)
34 {
35 int result;
37 if (argc != 2)
38 usage (_("Incorrect number of arguments supplied\n"));
39 else if (strcmp (argv[1], "-V") == 0 || strcmp (argv[1], "--version") == 0) {
40 print_revision (progname, revision);
41 exit (STATE_OK);
42 }
43 else if (strcmp (argv[1], "-h") == 0 || strcmp (argv[1], "--help") == 0) {
44 print_help ();
45 exit (STATE_OK);
46 }
47 else if (!is_integer (argv[1]))
48 usage (_("Arguments to check_dummy must be an integer\n"));
49 else
50 result = atoi (argv[1]);
52 switch (result) {
53 case STATE_OK:
54 printf ("Status is OK\n");
55 break;
56 case STATE_WARNING:
57 printf ("Status is at WARNING level\n");
58 break;
59 case STATE_CRITICAL:
60 printf ("Status is CRITICAL\n");
61 break;
62 case STATE_UNKNOWN:
63 printf ("Status is UNKNOWN\n");
64 break;
65 default:
66 printf ("Status %d is not a supported error state\n", result);
67 break;
68 }
70 return result;
71 }
75 void
76 print_help (void)
77 {
78 print_revision (progname, revision);
80 printf (_("Copyright (c) 1999 Ethan Galstad <nagios@nagios.org>\n"));
81 printf (_(COPYRIGHT), copyright, email);
83 print_usage ();
85 printf (_(UT_HELP_VRSN));
87 printf (_("\n\
88 This plugin will simply return the state corresponding to the numeric value\n\
89 of the <state> argument.\n"));
91 printf (_(UT_SUPPORT));
92 }
96 void
97 print_usage (void)
98 {
99 printf (_("Usage: %s <integer state>\n"), progname);
100 }