summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorBenoit Mortier <opensides@users.sourceforge.net>2006-10-19 23:56:04 (GMT)
committerBenoit Mortier <opensides@users.sourceforge.net>2006-10-19 23:56:04 (GMT)
commita99ce595ef496e9b40dbdd285c9c145b95c6182c (patch)
tree617ae8d8cff900cf5f9bc9d655bcf5c44db2a9e3 /plugins
parentd8ecf6bfc264717c611a983fe8ccb0488669791a (diff)
downloadmonitoring-plugins-a99ce595ef496e9b40dbdd285c9c145b95c6182c.tar.gz
adding missing check_snmp
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1510 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins')
-rw-r--r--plugins/check_snmp.c33
1 files changed, 14 insertions, 19 deletions
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c
index ac2c58c..7ba9684 100644
--- a/plugins/check_snmp.c
+++ b/plugins/check_snmp.c
@@ -11,6 +11,9 @@
11* 11*
12* This file contains the check_snmp plugin 12* This file contains the check_snmp plugin
13* 13*
14* Check status of remote machines and obtain sustem information via SNMP
15*
16*
14* License Information: 17* License Information:
15* 18*
16* This program is free software; you can redistribute it and/or modify 19* This program is free software; you can redistribute it and/or modify
@@ -93,8 +96,8 @@ char regex_expect[MAX_INPUT_BUFFER] = "";
93regex_t preg; 96regex_t preg;
94regmatch_t pmatch[10]; 97regmatch_t pmatch[10];
95char timestamp[10] = ""; 98char timestamp[10] = "";
96char errbuf[MAX_INPUT_BUFFER] = ""; 99char errbuf[MAX_INPUT_BUFFER];
97char perfstr[MAX_INPUT_BUFFER] = ""; 100char perfstr[MAX_INPUT_BUFFER];
98int cflags = REG_EXTENDED | REG_NOSUB | REG_NEWLINE; 101int cflags = REG_EXTENDED | REG_NOSUB | REG_NEWLINE;
99int eflags = 0; 102int eflags = 0;
100int errcode, excode; 103int errcode, excode;
@@ -151,7 +154,8 @@ main (int argc, char **argv)
151 char *ptr = NULL; 154 char *ptr = NULL;
152 char *p2 = NULL; 155 char *p2 = NULL;
153 char *show = NULL; 156 char *show = NULL;
154 char type[8] = ""; 157 char type[8];
158 char *str[MAX_INPUT_BUFFER];
155 159
156 setlocale (LC_ALL, ""); 160 setlocale (LC_ALL, "");
157 bindtextdomain (PACKAGE, LOCALEDIR); 161 bindtextdomain (PACKAGE, LOCALEDIR);
@@ -253,10 +257,6 @@ main (int argc, char **argv)
253 } 257 }
254 258
255 /* We strip out the datatype indicator for PHBs */ 259 /* We strip out the datatype indicator for PHBs */
256
257 /* Clean up type array - Sol10 does not necessarily zero it out */
258 bzero(type, sizeof(type));
259
260 if (strstr (response, "Gauge: ")) 260 if (strstr (response, "Gauge: "))
261 show = strstr (response, "Gauge: ") + 7; 261 show = strstr (response, "Gauge: ") + 7;
262 else if (strstr (response, "Gauge32: ")) 262 else if (strstr (response, "Gauge32: "))
@@ -348,11 +348,8 @@ main (int argc, char **argv)
348 348
349 i++; 349 i++;
350 350
351 strcat(perfstr, "="); 351 asprintf(str, "=%s%s;;;; ", show, type ? type : "");
352 strcat(perfstr, show); 352 strcat(perfstr, *str);
353 if (type)
354 strcat(perfstr, type);
355 strcat(perfstr, " ");
356 353
357 } /* end while (ptr) */ 354 } /* end while (ptr) */
358 355
@@ -1002,11 +999,9 @@ void
1002print_usage (void) 999print_usage (void)
1003{ 1000{
1004 printf (_("Usage:")); 1001 printf (_("Usage:"));
1005 printf ("%s -H <ip_address> -o <OID> [-w warn_range] [-c crit_range] \n\ 1002 printf ("%s -H <ip_address> -o <OID> [-w warn_range] [-c crit_range]\n",progname);
1006 [-C community] [-s string] [-r regex] [-R regexi]\n\ 1003 printf ("[-C community] [-s string] [-r regex] [-R regexi] [-t timeout] [-e retries]\n");
1007 [-t timeout] [-e retries]\n\ 1004 printf ("[-l label] [-u units] [-p port-number] [-d delimiter] [-D output-delimiter]\n");
1008 [-l label] [-u units] [-p port-number] [-d delimiter]\n\ 1005 printf ("[-m miblist] [-P snmp version] [-L seclevel] [-U secname] [-a authproto]\n");
1009 [-D output-delimiter] [-m miblist] [-P snmp version]\n\ 1006 printf ("[-A authpasswd] [-X privpasswd]\n");
1010 [-L seclevel] [-U secname] [-a authproto] [-A authpasswd]\n\
1011 [-X privpasswd]\n", progname);
1012} 1007}