summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl DeBisschop <kdebisschop@users.sourceforge.net>2003-08-04 11:38:27 (GMT)
committerKarl DeBisschop <kdebisschop@users.sourceforge.net>2003-08-04 11:38:27 (GMT)
commit6c19f400fdb3e4a111f068d960065d99e6d99919 (patch)
tree99d72b4c0eeff3a5ff6780c3177b55c1b2dc7aec
parentc878b033f7f732ba37a398d13c3bbff7e08b6a7d (diff)
downloadmonitoring-plugins-6c19f400fdb3e4a111f068d960065d99e6d99919.tar.gz
markup for translation
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@645 f882894a-f735-0410-b71e-b25c423dba1c
-rw-r--r--plugins/check_users.c126
-rw-r--r--plugins/urlize.c89
2 files changed, 102 insertions, 113 deletions
diff --git a/plugins/check_users.c b/plugins/check_users.c
index 5085107..d4480e7 100644
--- a/plugins/check_users.c
+++ b/plugins/check_users.c
@@ -1,49 +1,62 @@
1/***************************************************************************** 1/*****************************************************************************
2* 2
3* This program is free software; you can redistribute it and/or modify 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 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 5 the Free Software Foundation; either version 2 of the License, or
6* (at your option) any later version. 6 (at your option) any later version.
7* 7
8* This program is distributed in the hope that it will be useful, 8 This program is distributed in the hope that it will be useful,
9* but WITHOUT ANY WARRANTY; without even the implied warranty of 9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11* GNU General Public License for more details. 11 GNU General Public License for more details.
12* 12
13* You should have received a copy of the GNU General Public License 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 14 along with this program; if not, write to the Free Software
15* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 15 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
16* 16
17*****************************************************************************/ 17*****************************************************************************/
18 18
19const char *progname = "check_users";
20const char *revision = "$Revision$";
21const char *copyright = "2000-2003";
22const char *email = "nagiosplug-devel@lists.sourceforge.net";
23
19#include "common.h" 24#include "common.h"
20#include "popen.h" 25#include "popen.h"
21#include "utils.h" 26#include "utils.h"
22 27
23const char *progname = "check_users"; 28void
24const char *revision = "$Revision$"; 29print_usage (void)
25const char *copyright = "2002-2003"; 30{
26const char *authors = "Nagios Plugin Development Team"; 31 printf ("Usage: %s -w <users> -c <users>\n", progname);
27const char *email = "nagiosplug-devel@lists.sourceforge.net"; 32 printf (_(UT_HLP_VRS), progname, progname);
33}
28 34
29const char *summary = "\ 35void
36print_help (void)
37{
38 print_revision (progname, revision);
39
40 printf (_("Copyright (c) 1999 Ethan Galstad\n"));
41 printf (_(COPYRIGHT), copyright, email);
42
43 printf (_("\
30This plugin checks the number of users currently logged in on the local\n\ 44This plugin checks the number of users currently logged in on the local\n\
31system and generates an error if the number exceeds the thresholds specified.\n"; 45system and generates an error if the number exceeds the thresholds specified.\n"));
46
47 print_usage ();
32 48
33const char *option_summary = "-w <users> -c <users>"; 49 printf (_(UT_HELP_VRSN));
34 50
35const char *options = "\ 51 printf (_("\
36 -w, --warning=INTEGER\n\ 52 -w, --warning=INTEGER\n\
37 Set WARNING status if more than INTEGER users are logged in\n\ 53 Set WARNING status if more than INTEGER users are logged in\n\
38 -c, --critical=INTEGER\n\ 54 -c, --critical=INTEGER\n\
39 Set CRITICAL status if more than INTEGER users are logged in\n"; 55 Set CRITICAL status if more than INTEGER users are logged in\n"));
40
41const char *standard_options = "\
42 -h, --help\n\
43 Print detailed help screen\n\
44 -V, --version\n\
45 Print version information\n\n";
46 56
57 printf (_(UT_SUPPORT));
58}
59
47#define possibly_set(a,b) ((a) == 0 ? (b) : 0) 60#define possibly_set(a,b) ((a) == 0 ? (b) : 0)
48 61
49int process_arguments (int, char **); 62int process_arguments (int, char **);
@@ -61,18 +74,18 @@ main (int argc, char **argv)
61 char input_buffer[MAX_INPUT_BUFFER]; 74 char input_buffer[MAX_INPUT_BUFFER];
62 75
63 if (process_arguments (argc, argv) == ERROR) 76 if (process_arguments (argc, argv) == ERROR)
64 usage ("Could not parse arguments\n"); 77 usage (_("Could not parse arguments\n"));
65 78
66 /* run the command */ 79 /* run the command */
67 child_process = spopen (WHO_COMMAND); 80 child_process = spopen (WHO_COMMAND);
68 if (child_process == NULL) { 81 if (child_process == NULL) {
69 printf ("Could not open pipe: %s\n", WHO_COMMAND); 82 printf (_("Could not open pipe: %s\n"), WHO_COMMAND);
70 return STATE_UNKNOWN; 83 return STATE_UNKNOWN;
71 } 84 }
72 85
73 child_stderr = fdopen (child_stderr_array[fileno (child_process)], "r"); 86 child_stderr = fdopen (child_stderr_array[fileno (child_process)], "r");
74 if (child_stderr == NULL) 87 if (child_stderr == NULL)
75 printf ("Could not open stderr for %s\n", WHO_COMMAND); 88 printf (_("Could not open stderr for %s\n"), WHO_COMMAND);
76 89
77 users = 0; 90 users = 0;
78 91
@@ -85,7 +98,7 @@ main (int argc, char **argv)
85 } 98 }
86 99
87 /* get total logged in users */ 100 /* get total logged in users */
88 if (sscanf (input_buffer, "# users=%d", &users) == 1) 101 if (sscanf (input_buffer, _("# users=%d"), &users) == 1)
89 break; 102 break;
90 103
91 } 104 }
@@ -108,9 +121,9 @@ main (int argc, char **argv)
108 result = STATE_OK; 121 result = STATE_OK;
109 122
110 if (result == STATE_UNKNOWN) 123 if (result == STATE_UNKNOWN)
111 printf ("Unable to read output\n"); 124 printf (_("Unable to read output\n"));
112 else 125 else
113 printf ("USERS %s - %d users currently logged in\n", state_text (result), 126 printf (_("USERS %s - %d users currently logged in\n"), state_text (result),
114 users); 127 users);
115 128
116 return result; 129 return result;
@@ -146,7 +159,7 @@ process_arguments (int argc, char **argv)
146 159
147 switch (c) { 160 switch (c) {
148 case '?': /* print short usage statement if args not parsable */ 161 case '?': /* print short usage statement if args not parsable */
149 printf ("%s: Unknown argument: %s\n\n", progname, optarg); 162 printf (_("%s: Unknown argument: %s\n\n"), progname, optarg);
150 print_usage (); 163 print_usage ();
151 exit (STATE_UNKNOWN); 164 exit (STATE_UNKNOWN);
152 case 'h': /* help */ 165 case 'h': /* help */
@@ -157,12 +170,12 @@ process_arguments (int argc, char **argv)
157 exit (STATE_OK); 170 exit (STATE_OK);
158 case 'c': /* critical */ 171 case 'c': /* critical */
159 if (!is_intnonneg (optarg)) 172 if (!is_intnonneg (optarg))
160 usage ("Critical threshold must be a nonnegative integer\n"); 173 usage (_("Critical threshold must be a nonnegative integer\n"));
161 cusers = atoi (optarg); 174 cusers = atoi (optarg);
162 break; 175 break;
163 case 'w': /* warning */ 176 case 'w': /* warning */
164 if (!is_intnonneg (optarg)) 177 if (!is_intnonneg (optarg))
165 usage ("Warning threshold must be a nonnegative integer\n"); 178 usage (_("Warning threshold must be a nonnegative integer\n"));
166 wusers = atoi (optarg); 179 wusers = atoi (optarg);
167 break; 180 break;
168 } 181 }
@@ -171,44 +184,15 @@ process_arguments (int argc, char **argv)
171 c = optind; 184 c = optind;
172 if (wusers == -1 && argc > c) { 185 if (wusers == -1 && argc > c) {
173 if (is_intnonneg (argv[c]) == FALSE) 186 if (is_intnonneg (argv[c]) == FALSE)
174 usage ("Warning threshold must be a nonnegative integer\n"); 187 usage (_("Warning threshold must be a nonnegative integer\n"));
175 wusers = atoi (argv[c++]); 188 wusers = atoi (argv[c++]);
176 } 189 }
177 190
178 if (cusers == -1 && argc > c) { 191 if (cusers == -1 && argc > c) {
179 if (is_intnonneg (argv[c]) == FALSE) 192 if (is_intnonneg (argv[c]) == FALSE)
180 usage ("Warning threshold must be a nonnegative integer\n"); 193 usage (_("Warning threshold must be a nonnegative integer\n"));
181 cusers = atoi (argv[c]); 194 cusers = atoi (argv[c]);
182 } 195 }
183 196
184 return OK; 197 return OK;
185} 198}
186
187
188
189
190
191void
192print_help (void)
193{
194 print_revision (progname, revision);
195 printf ("Copyright (c) %s %s\n\t<%s>\n\n", copyright, authors, email);
196 printf (summary);
197 print_usage ();
198 printf ("\nOptions:\n");
199 printf (options);
200 printf (standard_options);
201 support ();
202}
203
204
205
206
207
208void
209print_usage (void)
210{
211 printf ("Usage: %s %s\n", progname, option_summary);
212 printf (" %s (-h|--help)\n", progname);
213 printf (" %s (-V|--version)\n", progname);
214}
diff --git a/plugins/urlize.c b/plugins/urlize.c
index b921707..12fb3ec 100644
--- a/plugins/urlize.c
+++ b/plugins/urlize.c
@@ -38,14 +38,52 @@
38 *****************************************************************************/ 38 *****************************************************************************/
39 39
40const char *progname = "urlize"; 40const char *progname = "urlize";
41const char *revision = "$Revision$";
42const char *copyright = "2000-2003";
43const char *email = "nagiosplug-devel@lists.sourceforge.net";
41 44
42#include "common.h" 45#include "common.h"
43#include "utils.h" 46#include "utils.h"
44#include "popen.h" 47#include "popen.h"
45 48
46void print_usage (const char *); 49void
47void print_help (const char *); 50print_usage (void)
51{
52 printf (_("Usage:\n %s <url> <plugin> <arg1> ... <argN>\n"), progname);
53}
54
55void
56print_help (void)
57{
58 print_revision (progname, revision);
48 59
60 printf (_("Copyright (c) 2000 Karl DeBisschop <kdebisschop@users.sourceforge.net>\n"));
61 printf (_(COPYRIGHT), copyright, email);
62
63 printf (_("\n\
64This plugin wraps the text output of another command (plugin) in HTML\n\
65<A> tags, thus displaying the plugin output in as a clickable link in\n\
66the Nagios status screen. The return status is the same as the invoked\n\
67plugin.\n\n"));
68
69 print_usage ();
70
71 printf (_("\n\
72Pay close attention to quoting to ensure that the shell passes the expected\n\
73data to the plugin. For example, in:\n\
74\n\
75 urlize http://example.com/ check_http -H example.com -r 'two words'\n\
76\n\
77the shell will remove the single quotes and urlize will see:\n\
78\n\
79 urlize http://example.com/ check_http -H example.com -r two words\n\
80\n\
81You probably want:\n\
82\n\
83 urlize http://example.com/ \"check_http -H example.com -r 'two words'\"\n"));
84 exit (STATE_OK);
85}
86
49int 87int
50main (int argc, char **argv) 88main (int argc, char **argv)
51{ 89{
@@ -54,22 +92,22 @@ main (int argc, char **argv)
54 char input_buffer[MAX_INPUT_BUFFER]; 92 char input_buffer[MAX_INPUT_BUFFER];
55 93
56 if (argc < 2) { 94 if (argc < 2) {
57 print_usage (progname); 95 print_usage ();
58 exit (STATE_UNKNOWN); 96 exit (STATE_UNKNOWN);
59 } 97 }
60 98
61 if (!strcmp (argv[1], "-h") || !strcmp (argv[1], "--help")) { 99 if (!strcmp (argv[1], "-h") || !strcmp (argv[1], "--help")) {
62 print_help (argv[0]); 100 print_help ();
63 exit (STATE_OK); 101 exit (STATE_OK);
64 } 102 }
65 103
66 if (!strcmp (argv[1], "-V") || !strcmp (argv[1], "--version")) { 104 if (!strcmp (argv[1], "-V") || !strcmp (argv[1], "--version")) {
67 print_revision (progname, "$Revision$"); 105 print_revision (progname, revision);
68 exit (STATE_OK); 106 exit (STATE_OK);
69 } 107 }
70 108
71 if (argc < 2) { 109 if (argc < 2) {
72 print_usage (progname); 110 print_usage ();
73 exit (STATE_UNKNOWN); 111 exit (STATE_UNKNOWN);
74 } 112 }
75 113
@@ -80,13 +118,13 @@ main (int argc, char **argv)
80 118
81 child_process = spopen (cmd); 119 child_process = spopen (cmd);
82 if (child_process == NULL) { 120 if (child_process == NULL) {
83 printf ("Could not open pipe: %s\n", cmd); 121 printf (_("Could not open pipe: %s\n"), cmd);
84 exit (STATE_UNKNOWN); 122 exit (STATE_UNKNOWN);
85 } 123 }
86 124
87 child_stderr = fdopen (child_stderr_array[fileno (child_process)], "r"); 125 child_stderr = fdopen (child_stderr_array[fileno (child_process)], "r");
88 if (child_stderr == NULL) { 126 if (child_stderr == NULL) {
89 printf ("Could not open stderr for %s\n", cmd); 127 printf (_("Could not open stderr for %s\n"), cmd);
90 } 128 }
91 129
92 printf ("<A href=\"%s\">", argv[1]); 130 printf ("<A href=\"%s\">", argv[1]);
@@ -102,7 +140,7 @@ main (int argc, char **argv)
102 } 140 }
103 141
104 if (!found) { 142 if (!found) {
105 printf ("%s problem - No data recieved from host\nCMD: %s</A>\n", argv[0], 143 printf (_("%s problem - No data recieved from host\nCMD: %s</A>\n"), argv[0],
106 cmd); 144 cmd);
107 exit (STATE_UNKNOWN); 145 exit (STATE_UNKNOWN);
108 } 146 }
@@ -120,36 +158,3 @@ main (int argc, char **argv)
120 printf ("</A>\n"); 158 printf ("</A>\n");
121 return result; 159 return result;
122} 160}
123
124void
125print_usage (const char *cmd)
126{
127 printf ("Usage:\n %s <url> <plugin> <arg1> ... <argN>\n", cmd);
128}
129
130void
131print_help (const char *cmd)
132{
133 print_revision (progname, "$Revision$");
134 printf ("\
135Copyright (c) 2000 Karl DeBisschop (kdebiss@alum.mit.edu)\n\n\
136\nThis plugin wraps the text output of another command (plugin) in HTML\n\
137<A> tags, thus displaying the plugin output in as a clickable link in\n\
138the Nagios status screen. The return status is the same as the invoked\n\
139plugin.\n\n");
140 print_usage (cmd);
141 printf ("\n\
142Pay close attention to quoting to ensure that the shell passes the expected\n\
143data to the plugin. For example, in:\n\
144\n\
145 urlize http://example.com/ check_http -H example.com -r 'two words'\n\
146\n\
147the shell will remove the single quotes and urlize will see:\n\
148\n\
149 urlize http://example.com/ check_http -H example.com -r two words\n\
150\n\
151You probably want:\n\
152\n\
153 urlize http://example.com/ \"check_http -H example.com -r 'two words'\"\n");
154 exit (STATE_OK);
155}