diff options
author | Ethan Galstad <egalstad@users.sourceforge.net> | 2002-02-28 06:42:51 (GMT) |
---|---|---|
committer | Ethan Galstad <egalstad@users.sourceforge.net> | 2002-02-28 06:42:51 (GMT) |
commit | 44a321cb8a42d6c0ea2d96a1086a17f2134c89cc (patch) | |
tree | a1a4d9f7b92412a17ab08f34f04eec45433048b7 /plugins/check_dummy.c | |
parent | 54fd5d7022ff2d6a59bc52b8869182f3fc77a058 (diff) | |
download | monitoring-plugins-44a321cb8a42d6c0ea2d96a1086a17f2134c89cc.tar.gz |
Initial revision
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@2 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins/check_dummy.c')
-rw-r--r-- | plugins/check_dummy.c | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/plugins/check_dummy.c b/plugins/check_dummy.c new file mode 100644 index 0000000..c2a5b7e --- /dev/null +++ b/plugins/check_dummy.c | |||
@@ -0,0 +1,100 @@ | |||
1 | /************************************************************* | ||
2 | * | ||
3 | * CHECK_DUMMY.C | ||
4 | * | ||
5 | * Program: Dummy plugin for Nagios | ||
6 | * License: GPL | ||
7 | * Copyright (c) 1999 Ethan Galstad (nagios@nagios.org) | ||
8 | * | ||
9 | * Last Modified: $Date$ | ||
10 | * | ||
11 | * Command line: CHECK_DUMMY <state> | ||
12 | * | ||
13 | * Description: | ||
14 | * | ||
15 | * This plugin will simply return the state corresponding to the | ||
16 | * numerical value of the <state> argument. | ||
17 | * | ||
18 | * License Information: | ||
19 | * | ||
20 | * This program is free software; you can redistribute it and/or modify | ||
21 | * it under the terms of the GNU General Public License as published by | ||
22 | * the Free Software Foundation; either version 2 of the License, or | ||
23 | * (at your option) any later version. | ||
24 | * | ||
25 | * This program is distributed in the hope that it will be useful, | ||
26 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
27 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
28 | * GNU General Public License for more details. | ||
29 | * | ||
30 | * You should have received a copy of the GNU General Public License | ||
31 | * along with this program; if not, write to the Free Software | ||
32 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
33 | * | ||
34 | **************************************************************/ | ||
35 | |||
36 | #include "config.h" | ||
37 | #include "common.h" | ||
38 | #include "utils.h" | ||
39 | |||
40 | void print_help (char *); | ||
41 | void print_usage (char *); | ||
42 | |||
43 | int | ||
44 | main (int argc, char **argv) | ||
45 | { | ||
46 | int result; | ||
47 | |||
48 | if (argc != 2) { | ||
49 | printf ("Incorrect number of arguments supplied\n"); | ||
50 | exit (STATE_UNKNOWN); | ||
51 | } | ||
52 | else if (strcmp (argv[1], "-V") == 0 || strcmp (argv[1], "--version") == 0) { | ||
53 | print_revision (argv[0], "$Revision$"); | ||
54 | exit (STATE_OK); | ||
55 | } | ||
56 | else if (strcmp (argv[1], "-h") == 0 || strcmp (argv[1], "--help") == 0) { | ||
57 | print_help (argv[0]); | ||
58 | exit (STATE_OK); | ||
59 | } | ||
60 | else if (!is_integer (argv[1])) { | ||
61 | print_usage (argv[0]); | ||
62 | exit (STATE_UNKNOWN); | ||
63 | } | ||
64 | result = atoi (argv[1]); | ||
65 | |||
66 | switch (result) { | ||
67 | case STATE_OK: | ||
68 | printf ("Status is OK\n"); | ||
69 | break; | ||
70 | case STATE_WARNING: | ||
71 | printf ("Status is at WARNING level\n"); | ||
72 | break; | ||
73 | case STATE_CRITICAL: | ||
74 | printf ("Status is CRITICAL\n"); | ||
75 | break; | ||
76 | default: | ||
77 | printf ("Status is UNKNOWN\n"); | ||
78 | result = STATE_UNKNOWN; | ||
79 | } | ||
80 | |||
81 | return result; | ||
82 | } | ||
83 | |||
84 | void | ||
85 | print_help (char *cmd) | ||
86 | { | ||
87 | print_revision (cmd, "$Revision$"); | ||
88 | printf ("Copyright (c) 1999 Ethan Galstad (nagios@nagios.org)\n" | ||
89 | "License: GPL\n\n"); | ||
90 | print_usage (cmd); | ||
91 | printf | ||
92 | ("\nThis plugin will simply return the state corresponding to the numeric value\n" | ||
93 | "of the <state> argument.\n"); | ||
94 | } | ||
95 | |||
96 | void | ||
97 | print_usage (char *cmd) | ||
98 | { | ||
99 | printf ("Usage: %s <integer state>\n", cmd); | ||
100 | } | ||