summaryrefslogtreecommitdiffstats
path: root/plugins/t
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/t')
0 files changed, 0 insertions, 0 deletions
diff --git a/plugins/check_mrtgtraf.c b/plugins/check_mrtgtraf.c
index 32ba050..3b038cf 100644
--- a/plugins/check_mrtgtraf.c
+++ b/plugins/check_mrtgtraf.c
@@ -148,37 +148,37 @@ main (int argc, char **argv)
148 148
149 /* report incoming traffic in Bytes/sec */ 149 /* report incoming traffic in Bytes/sec */
150 if (incoming_rate < 1024) { 150 if (incoming_rate < 1024) {
151 strcpy (incoming_speed_rating, "B/s"); 151 strcpy (incoming_speed_rating, "B");
152 adjusted_incoming_rate = (double) incoming_rate; 152 adjusted_incoming_rate = (double) incoming_rate;
153 } 153 }
154 154
155 /* report incoming traffic in KBytes/sec */ 155 /* report incoming traffic in KBytes/sec */
156 else if (incoming_rate < (1024 * 1024)) { 156 else if (incoming_rate < (1024 * 1024)) {
157 strcpy (incoming_speed_rating, "KB/s"); 157 strcpy (incoming_speed_rating, "KB");
158 adjusted_incoming_rate = (double) (incoming_rate / 1024.0); 158 adjusted_incoming_rate = (double) (incoming_rate / 1024.0);
159 } 159 }
160 160
161 /* report incoming traffic in MBytes/sec */ 161 /* report incoming traffic in MBytes/sec */
162 else { 162 else {
163 strcpy (incoming_speed_rating, "MB/s"); 163 strcpy (incoming_speed_rating, "MB");
164 adjusted_incoming_rate = (double) (incoming_rate / 1024.0 / 1024.0); 164 adjusted_incoming_rate = (double) (incoming_rate / 1024.0 / 1024.0);
165 } 165 }
166 166
167 /* report outgoing traffic in Bytes/sec */ 167 /* report outgoing traffic in Bytes/sec */
168 if (outgoing_rate < 1024) { 168 if (outgoing_rate < 1024) {
169 strcpy (outgoing_speed_rating, "B/s"); 169 strcpy (outgoing_speed_rating, "B");
170 adjusted_outgoing_rate = (double) outgoing_rate; 170 adjusted_outgoing_rate = (double) outgoing_rate;
171 } 171 }
172 172
173 /* report outgoing traffic in KBytes/sec */ 173 /* report outgoing traffic in KBytes/sec */
174 else if (outgoing_rate < (1024 * 1024)) { 174 else if (outgoing_rate < (1024 * 1024)) {
175 strcpy (outgoing_speed_rating, "KB/s"); 175 strcpy (outgoing_speed_rating, "KB");
176 adjusted_outgoing_rate = (double) (outgoing_rate / 1024.0); 176 adjusted_outgoing_rate = (double) (outgoing_rate / 1024.0);
177 } 177 }
178 178
179 /* report outgoing traffic in MBytes/sec */ 179 /* report outgoing traffic in MBytes/sec */
180 else { 180 else {
181 strcpy (outgoing_speed_rating, "MB/s"); 181 strcpy (outgoing_speed_rating, "MB");
182 adjusted_outgoing_rate = (double) (outgoing_rate / 1024.0 / 1024.0); 182 adjusted_outgoing_rate = (double) (outgoing_rate / 1024.0 / 1024.0);
183 } 183 }
184 184
@@ -191,7 +191,7 @@ main (int argc, char **argv)
191 result = STATE_WARNING; 191 result = STATE_WARNING;
192 } 192 }
193 193
194 xasprintf (&error_message, _("%s. In = %0.1f %s, %s. Out = %0.1f %s|%s %s\n"), 194 xasprintf (&error_message, _("%s. In = %0.1f %s/s, %s. Out = %0.1f %s/s|%s %s\n"),
195 (use_average == TRUE) ? _("Avg") : _("Max"), adjusted_incoming_rate, 195 (use_average == TRUE) ? _("Avg") : _("Max"), adjusted_incoming_rate,
196 incoming_speed_rating, (use_average == TRUE) ? _("Avg") : _("Max"), 196 incoming_speed_rating, (use_average == TRUE) ? _("Avg") : _("Max"),
197 adjusted_outgoing_rate, outgoing_speed_rating, 197 adjusted_outgoing_rate, outgoing_speed_rating,
diff --git a/plugins/check_nt.c b/plugins/check_nt.c
index fefbfb7..f621b0a 100644
--- a/plugins/check_nt.c
+++ b/plugins/check_nt.c
@@ -197,19 +197,40 @@ int main(int argc, char **argv){
197 197
198 case CHECK_UPTIME: 198 case CHECK_UPTIME:
199 199
200 xasprintf(&send_buffer, "%s&3", req_password); 200 if (value_list == NULL) {
201 fetch_data (server_address, server_port, send_buffer); 201 value_list = "minutes";
202 uptime=strtoul(recv_buffer,NULL,10); 202 }
203 updays = uptime / 86400; 203 if (strncmp(value_list, "seconds", strlen("seconds") + 1 ) &&
204 uphours = (uptime % 86400) / 3600; 204 strncmp(value_list, "minutes", strlen("minutes") + 1) &&
205 upminutes = ((uptime % 86400) % 3600) / 60; 205 strncmp(value_list, "hours", strlen("hours") + 1) &&
206 xasprintf(&output_message,_("System Uptime - %u day(s) %u hour(s) %u minute(s)|uptime=%lu"), updays, uphours, upminutes, uptime); 206 strncmp(value_list, "days", strlen("days") + 1)) {
207 if (check_critical_value==TRUE && uptime <= critical_value) 207
208 return_code=STATE_CRITICAL; 208 output_message = strdup (_("wrong -l argument"));
209 else if (check_warning_value==TRUE && uptime <= warning_value) 209 } else {
210 return_code=STATE_WARNING; 210 xasprintf(&send_buffer, "%s&3", req_password);
211 else 211 fetch_data (server_address, server_port, send_buffer);
212 return_code=STATE_OK; 212 uptime=strtoul(recv_buffer,NULL,10);
213 updays = uptime / 86400;
214 uphours = (uptime % 86400) / 3600;
215 upminutes = ((uptime % 86400) % 3600) / 60;
216
217 if (!strncmp(value_list, "minutes", strlen("minutes")))
218 uptime = uptime / 60;
219 else if (!strncmp(value_list, "hours", strlen("hours")))
220 uptime = uptime / 3600;
221 else if (!strncmp(value_list, "days", strlen("days")))
222 uptime = uptime / 86400;
223 /* else uptime in seconds, nothing to do */
224
225 xasprintf(&output_message,_("System Uptime - %u day(s) %u hour(s) %u minute(s) |uptime=%lu"),updays, uphours, upminutes, uptime);
226
227 if (check_critical_value==TRUE && uptime <= critical_value)
228 return_code=STATE_CRITICAL;
229 else if (check_warning_value==TRUE && uptime <= warning_value)
230 return_code=STATE_WARNING;
231 else
232 return_code=STATE_OK;
233 }
213 break; 234 break;
214 235
215 case CHECK_USEDDISKSPACE: 236 case CHECK_USEDDISKSPACE:
@@ -713,7 +734,9 @@ void print_help(void)
713 printf (" %s\n", "ie: -l 60,90,95,120,90,95"); 734 printf (" %s\n", "ie: -l 60,90,95,120,90,95");
714 printf (" %s\n", "UPTIME ="); 735 printf (" %s\n", "UPTIME =");
715 printf (" %s\n", _("Get the uptime of the machine.")); 736 printf (" %s\n", _("Get the uptime of the machine."));
716 printf (" %s\n", _("No specific parameters. No warning or critical threshold")); 737 printf (" %s\n", _("-l <unit> "));
738 printf (" %s\n", _("<unit> = seconds, minutes, hours, or days. (default: minutes)"));
739 printf (" %s\n", _("Thresholds will use the unit specified above."));
717 printf (" %s\n", "USEDDISKSPACE ="); 740 printf (" %s\n", "USEDDISKSPACE =");
718 printf (" %s\n", _("Size and percentage of disk use.")); 741 printf (" %s\n", _("Size and percentage of disk use."));
719 printf (" %s\n", _("Request a -l parameter containing the drive letter only.")); 742 printf (" %s\n", _("Request a -l parameter containing the drive letter only."));
diff --git a/plugins/check_real.c b/plugins/check_real.c
index 1816bf5..00bd4d2 100644
--- a/plugins/check_real.c
+++ b/plugins/check_real.c
@@ -163,17 +163,17 @@ main (int argc, char **argv)
163 163
164 /* Part I - Server Check */ 164 /* Part I - Server Check */
165 165
166 /* send the OPTIONS request */ 166 /* send the DESCRIBE request */
167 sprintf (buffer, "DESCRIBE rtsp://%s:%d%s RTSP/1.0\n", host_name, 167 sprintf (buffer, "DESCRIBE rtsp://%s:%d%s RTSP/1.0\r\n", host_name,
168 server_port, server_url); 168 server_port, server_url);
169 result = send (sd, buffer, strlen (buffer), 0); 169 result = send (sd, buffer, strlen (buffer), 0);
170 170
171 /* send the header sync */ 171 /* send the header sync */
172 sprintf (buffer, "CSeq: 2\n"); 172 sprintf (buffer, "CSeq: 2\r\n");
173 result = send (sd, buffer, strlen (buffer), 0); 173 result = send (sd, buffer, strlen (buffer), 0);
174 174
175 /* send a newline so the server knows we're done with the request */ 175 /* send a newline so the server knows we're done with the request */
176 sprintf (buffer, "\n"); 176 sprintf (buffer, "\r\n");
177 result = send (sd, buffer, strlen (buffer), 0); 177 result = send (sd, buffer, strlen (buffer), 0);
178 178
179 /* watch for the REAL connection string */ 179 /* watch for the REAL connection string */
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c
index 2c62a23..9d966fa 100644
--- a/plugins/check_snmp.c
+++ b/plugins/check_snmp.c
@@ -104,6 +104,8 @@ int errcode, excode;
104 104
105char *server_address = NULL; 105char *server_address = NULL;
106char *community = NULL; 106char *community = NULL;
107char **contextargs = NULL;
108char *context = NULL;
107char **authpriv = NULL; 109char **authpriv = NULL;
108char *proto = NULL; 110char *proto = NULL;
109char *seclevel = NULL; 111char *seclevel = NULL;
@@ -128,6 +130,7 @@ size_t nunits = 0;
128size_t unitv_size = OID_COUNT_STEP; 130size_t unitv_size = OID_COUNT_STEP;
129int numoids = 0; 131int numoids = 0;
130int numauthpriv = 0; 132int numauthpriv = 0;
133int numcontext = 0;
131int verbose = 0; 134int verbose = 0;
132int usesnmpgetnext = FALSE; 135int usesnmpgetnext = FALSE;
133char *warning_thresholds = NULL; 136char *warning_thresholds = NULL;
@@ -297,8 +300,8 @@ main (int argc, char **argv)
297 snmpcmd = strdup (PATH_TO_SNMPGET); 300 snmpcmd = strdup (PATH_TO_SNMPGET);
298 } 301 }
299 302
300 /* 10 arguments to pass before authpriv options + 1 for host and numoids. Add one for terminating NULL */ 303 /* 10 arguments to pass before context and authpriv options + 1 for host and numoids. Add one for terminating NULL */
301 command_line = calloc (10 + numauthpriv + 1 + numoids + 1, sizeof (char *)); 304 command_line = calloc (10 + numcontext + numauthpriv + 1 + numoids + 1, sizeof (char *));
302 command_line[0] = snmpcmd; 305 command_line[0] = snmpcmd;
303 command_line[1] = strdup ("-Le"); 306 command_line[1] = strdup ("-Le");
304 command_line[2] = strdup ("-t"); 307 command_line[2] = strdup ("-t");
@@ -310,23 +313,27 @@ main (int argc, char **argv)
310 command_line[8] = "-v"; 313 command_line[8] = "-v";
311 command_line[9] = strdup (proto); 314 command_line[9] = strdup (proto);
312 315
316 for (i = 0; i < numcontext; i++) {
317 command_line[10 + i] = contextargs[i];
318 }
319
313 for (i = 0; i < numauthpriv; i++) { 320 for (i = 0; i < numauthpriv; i++) {
314 command_line[10 + i] = authpriv[i]; 321 command_line[10 + numcontext + i] = authpriv[i];
315 } 322 }
316 323
317 xasprintf (&command_line[10 + numauthpriv], "%s:%s", server_address, port); 324 xasprintf (&command_line[10 + numcontext + numauthpriv], "%s:%s", server_address, port);
318 325
319 /* This is just for display purposes, so it can remain a string */ 326 /* This is just for display purposes, so it can remain a string */
320 xasprintf(&cl_hidden_auth, "%s -Le -t %d -r %d -m %s -v %s %s %s:%s", 327 xasprintf(&cl_hidden_auth, "%s -Le -t %d -r %d -m %s -v %s %s %s %s:%s",
321 snmpcmd, timeout_interval, retries, strlen(miblist) ? miblist : "''", proto, "[authpriv]", 328 snmpcmd, timeout_interval, retries, strlen(miblist) ? miblist : "''", proto, "[context]", "[authpriv]",
322 server_address, port); 329 server_address, port);
323 330
324 for (i = 0; i < numoids; i++) { 331 for (i = 0; i < numoids; i++) {
325 command_line[10 + numauthpriv + 1 + i] = oids[i]; 332 command_line[10 + numcontext + numauthpriv + 1 + i] = oids[i];
326 xasprintf(&cl_hidden_auth, "%s %s", cl_hidden_auth, oids[i]); 333 xasprintf(&cl_hidden_auth, "%s %s", cl_hidden_auth, oids[i]);
327 } 334 }
328 335
329 command_line[10 + numauthpriv + 1 + numoids] = NULL; 336 command_line[10 + numcontext + numauthpriv + 1 + numoids] = NULL;
330 337
331 if (verbose) 338 if (verbose)
332 printf ("%s\n", cl_hidden_auth); 339 printf ("%s\n", cl_hidden_auth);
@@ -567,6 +574,18 @@ main (int argc, char **argv)
567 len = sizeof(perfstr)-strlen(perfstr)-1; 574 len = sizeof(perfstr)-strlen(perfstr)-1;
568 strncat(perfstr, show, len>ptr-show ? ptr-show : len); 575 strncat(perfstr, show, len>ptr-show ? ptr-show : len);
569 576
577 if (warning_thresholds) {
578 strncat(perfstr, ";", sizeof(perfstr)-strlen(perfstr)-1);
579 strncat(perfstr, warning_thresholds, sizeof(perfstr)-strlen(perfstr)-1);
580 }
581
582 if (critical_thresholds) {
583 if (!warning_thresholds)
584 strncat(perfstr, ";", sizeof(perfstr)-strlen(perfstr)-1);
585 strncat(perfstr, ";", sizeof(perfstr)-strlen(perfstr)-1);
586 strncat(perfstr, critical_thresholds, sizeof(perfstr)-strlen(perfstr)-1);
587 }
588
570 if (type) 589 if (type)
571 strncat(perfstr, type, sizeof(perfstr)-strlen(perfstr)-1); 590 strncat(perfstr, type, sizeof(perfstr)-strlen(perfstr)-1);
572 strncat(perfstr, " ", sizeof(perfstr)-strlen(perfstr)-1); 591 strncat(perfstr, " ", sizeof(perfstr)-strlen(perfstr)-1);
@@ -646,6 +665,7 @@ process_arguments (int argc, char **argv)
646 {"retries", required_argument, 0, 'e'}, 665 {"retries", required_argument, 0, 'e'},
647 {"miblist", required_argument, 0, 'm'}, 666 {"miblist", required_argument, 0, 'm'},
648 {"protocol", required_argument, 0, 'P'}, 667 {"protocol", required_argument, 0, 'P'},
668 {"context", required_argument, 0, 'N'},
649 {"seclevel", required_argument, 0, 'L'}, 669 {"seclevel", required_argument, 0, 'L'},
650 {"secname", required_argument, 0, 'U'}, 670 {"secname", required_argument, 0, 'U'},
651 {"authproto", required_argument, 0, 'a'}, 671 {"authproto", required_argument, 0, 'a'},
@@ -675,7 +695,7 @@ process_arguments (int argc, char **argv)
675 } 695 }
676 696
677 while (1) { 697 while (1) {
678 c = getopt_long (argc, argv, "nhvVOt:c:w:H:C:o:e:E:d:D:s:t:R:r:l:u:p:m:P:L:U:a:x:A:X:", 698 c = getopt_long (argc, argv, "nhvVOt:c:w:H:C:o:e:E:d:D:s:t:R:r:l:u:p:m:P:N:L:U:a:x:A:X:",
679 longopts, &option); 699 longopts, &option);
680 700
681 if (c == -1 || c == EOF) 701 if (c == -1 || c == EOF)
@@ -713,6 +733,9 @@ process_arguments (int argc, char **argv)
713 case 'P': /* SNMP protocol version */ 733 case 'P': /* SNMP protocol version */
714 proto = optarg; 734 proto = optarg;
715 break; 735 break;
736 case 'N': /* SNMPv3 context */
737 context = optarg;
738 break;
716 case 'L': /* security level */ 739 case 'L': /* security level */
717 seclevel = optarg; 740 seclevel = optarg;
718 break; 741 break;
@@ -960,6 +983,13 @@ validate_arguments ()
960 authpriv[1] = strdup (community); 983 authpriv[1] = strdup (community);
961 } 984 }
962 else if ( strcmp (proto, "3") == 0 ) { /* snmpv3 args */ 985 else if ( strcmp (proto, "3") == 0 ) { /* snmpv3 args */
986 if (!(context == NULL)) {
987 numcontext = 2;
988 contextargs = calloc (numcontext, sizeof (char *));
989 contextargs[0] = strdup ("-n");
990 contextargs[1] = strdup (context);
991 }
992
963 if (seclevel == NULL) 993 if (seclevel == NULL)
964 xasprintf(&seclevel, "noAuthNoPriv"); 994 xasprintf(&seclevel, "noAuthNoPriv");
965 995
@@ -1103,6 +1133,8 @@ print_help (void)
1103 printf (" %s\n", _("Use SNMP GETNEXT instead of SNMP GET")); 1133 printf (" %s\n", _("Use SNMP GETNEXT instead of SNMP GET"));
1104 printf (" %s\n", "-P, --protocol=[1|2c|3]"); 1134 printf (" %s\n", "-P, --protocol=[1|2c|3]");
1105 printf (" %s\n", _("SNMP protocol version")); 1135 printf (" %s\n", _("SNMP protocol version"));
1136 printf (" %s\n", "-N, --context=CONTEXT");
1137 printf (" %s\n", _("SNMPv3 context"));
1106 printf (" %s\n", "-L, --seclevel=[noAuthNoPriv|authNoPriv|authPriv]"); 1138 printf (" %s\n", "-L, --seclevel=[noAuthNoPriv|authNoPriv|authPriv]");
1107 printf (" %s\n", _("SNMPv3 securityLevel")); 1139 printf (" %s\n", _("SNMPv3 securityLevel"));
1108 printf (" %s\n", "-a, --authproto=[MD5|SHA]"); 1140 printf (" %s\n", "-a, --authproto=[MD5|SHA]");
@@ -1210,6 +1242,6 @@ print_usage (void)
1210 printf ("%s -H <ip_address> -o <OID> [-w warn_range] [-c crit_range]\n",progname); 1242 printf ("%s -H <ip_address> -o <OID> [-w warn_range] [-c crit_range]\n",progname);
1211 printf ("[-C community] [-s string] [-r regex] [-R regexi] [-t timeout] [-e retries]\n"); 1243 printf ("[-C community] [-s string] [-r regex] [-R regexi] [-t timeout] [-e retries]\n");
1212 printf ("[-l label] [-u units] [-p port-number] [-d delimiter] [-D output-delimiter]\n"); 1244 printf ("[-l label] [-u units] [-p port-number] [-d delimiter] [-D output-delimiter]\n");
1213 printf ("[-m miblist] [-P snmp version] [-L seclevel] [-U secname] [-a authproto]\n"); 1245 printf ("[-m miblist] [-P snmp version] [-N context] [-L seclevel] [-U secname]\n");
1214 printf ("[-A authpasswd] [-x privproto] [-X privpasswd]\n"); 1246 printf ("[-a authproto] [-A authpasswd] [-x privproto] [-X privpasswd]\n");
1215} 1247}
diff --git a/plugins/check_ssh.c b/plugins/check_ssh.c
index b6187d6..3658965 100644
--- a/plugins/check_ssh.c
+++ b/plugins/check_ssh.c
@@ -253,18 +253,18 @@ ssh_connect (char *haddr, int hport, char *remote_version, char *remote_protocol
253 253
254 if (remote_version && strcmp(remote_version, ssh_server)) { 254 if (remote_version && strcmp(remote_version, ssh_server)) {
255 printf 255 printf
256 (_("SSH WARNING - %s (protocol %s) version mismatch, expected '%s'\n"), 256 (_("SSH CRITICAL - %s (protocol %s) version mismatch, expected '%s'\n"),
257 ssh_server, ssh_proto, remote_version); 257 ssh_server, ssh_proto, remote_version);
258 close(sd); 258 close(sd);
259 exit (STATE_WARNING); 259 exit (STATE_CRITICAL);
260 } 260 }
261 261
262 if (remote_protocol && strcmp(remote_protocol, ssh_proto)) { 262 if (remote_protocol && strcmp(remote_protocol, ssh_proto)) {
263 printf 263 printf
264 (_("SSH WARNING - %s (protocol %s) protocol version mismatch, expected '%s'\n"), 264 (_("SSH CRITICAL - %s (protocol %s) protocol version mismatch, expected '%s'\n"),
265 ssh_server, ssh_proto, remote_protocol); 265 ssh_server, ssh_proto, remote_protocol);
266 close(sd); 266 close(sd);
267 exit (STATE_WARNING); 267 exit (STATE_CRITICAL);
268 } 268 }
269 269
270 elapsed_time = (double)deltime(tv) / 1.0e6; 270 elapsed_time = (double)deltime(tv) / 1.0e6;
@@ -307,10 +307,10 @@ print_help (void)
307 printf (UT_CONN_TIMEOUT, DEFAULT_SOCKET_TIMEOUT); 307 printf (UT_CONN_TIMEOUT, DEFAULT_SOCKET_TIMEOUT);
308 308
309 printf (" %s\n", "-r, --remote-version=STRING"); 309 printf (" %s\n", "-r, --remote-version=STRING");
310 printf (" %s\n", _("Warn if string doesn't match expected server version (ex: OpenSSH_3.9p1)")); 310 printf (" %s\n", _("Alert if string doesn't match expected server version (ex: OpenSSH_3.9p1)"));
311 311
312 printf (" %s\n", "-P, --remote-protocol=STRING"); 312 printf (" %s\n", "-P, --remote-protocol=STRING");
313 printf (" %s\n", _("Warn if protocol doesn't match expected protocol version (ex: 2.0)")); 313 printf (" %s\n", _("Alert if protocol doesn't match expected protocol version (ex: 2.0)"));
314 314
315 printf (UT_VERBOSE); 315 printf (UT_VERBOSE);
316 316
diff --git a/plugins/check_swap.c b/plugins/check_swap.c
index 88a2a2a..25e0bac 100644
--- a/plugins/check_swap.c
+++ b/plugins/check_swap.c
@@ -1,6 +1,6 @@
1/***************************************************************************** 1/*****************************************************************************
2* 2*
3* Monitoring check_disk plugin 3* Monitoring check_swap plugin
4* 4*
5* License: GPL 5* License: GPL
6* Copyright (c) 2000 Karl DeBisschop (kdebisschop@users.sourceforge.net) 6* Copyright (c) 2000 Karl DeBisschop (kdebisschop@users.sourceforge.net)
@@ -352,6 +352,7 @@ main (int argc, char **argv)
352 percent_used = 100 * ((double) used_swap_mb) / ((double) total_swap_mb); 352 percent_used = 100 * ((double) used_swap_mb) / ((double) total_swap_mb);
353 } else { 353 } else {
354 percent_used = 100; 354 percent_used = 100;
355 status = "- Swap is either disabled, not present, or of zero size. ";
355 } 356 }
356 357
357 result = max_state (result, check_swap (percent_used, free_swap_mb)); 358 result = max_state (result, check_swap (percent_used, free_swap_mb));