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 setlocale (LC_ALL, "");
38 bindtextdomain (PACKAGE, LOCALEDIR);
39 textdomain (PACKAGE);
41 if (argc != 2)
42 usage (_("Incorrect number of arguments supplied\n"));
43 else if (strcmp (argv[1], "-V") == 0 || strcmp (argv[1], "--version") == 0) {
44 print_revision (progname, revision);
45 exit (STATE_OK);
46 }
47 else if (strcmp (argv[1], "-h") == 0 || strcmp (argv[1], "--help") == 0) {
48 print_help ();
49 exit (STATE_OK);
50 }
51 else if (!is_integer (argv[1]))
52 usage (_("Arguments to check_dummy must be an integer\n"));
53 else
54 result = atoi (argv[1]);
56 switch (result) {
57 case STATE_OK:
58 printf ("Status is OK\n");
59 break;
60 case STATE_WARNING:
61 printf ("Status is at WARNING level\n");
62 break;
63 case STATE_CRITICAL:
64 printf ("Status is CRITICAL\n");
65 break;
66 case STATE_UNKNOWN:
67 printf ("Status is UNKNOWN\n");
68 break;
69 default:
70 printf ("Status %d is not a supported error state\n", result);
71 break;
72 }
74 return result;
75 }
79 void
80 print_help (void)
81 {
82 print_revision (progname, revision);
84 printf (_("Copyright (c) 1999 Ethan Galstad <nagios@nagios.org>\n"));
85 printf (_(COPYRIGHT), copyright, email);
87 print_usage ();
89 printf (_(UT_HELP_VRSN));
91 printf (_("\n\
92 This plugin will simply return the state corresponding to the numeric value\n\
93 of the <state> argument.\n"));
95 printf (_(UT_SUPPORT));
96 }
100 void
101 print_usage (void)
102 {
103 printf (_("Usage: %s <integer state>\n"), progname);
104 }