summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/check_snmp.c156
1 files changed, 78 insertions, 78 deletions
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c
index 937b3a5..bd1940e 100644
--- a/plugins/check_snmp.c
+++ b/plugins/check_snmp.c
@@ -86,82 +86,82 @@ const char *email = "devel@monitoring-plugins.org";
86 86
87 87
88 88
89int process_arguments (int, char **); 89static int process_arguments (int, char **);
90int validate_arguments (void); 90static int validate_arguments (void);
91char *thisarg (char *str); 91static char *thisarg (char *str);
92char *nextarg (char *str); 92static char *nextarg (char *str);
93void print_usage (void); 93void print_usage (void);
94void print_help (void); 94static void print_help (void);
95char *multiply (char *str); 95static char *multiply (char *str);
96 96
97#include "regex.h" 97#include "regex.h"
98char regex_expect[MAX_INPUT_BUFFER] = ""; 98static char regex_expect[MAX_INPUT_BUFFER] = "";
99regex_t preg; 99static regex_t preg;
100regmatch_t pmatch[10]; 100static regmatch_t pmatch[10];
101char errbuf[MAX_INPUT_BUFFER] = ""; 101static char errbuf[MAX_INPUT_BUFFER] = "";
102char perfstr[MAX_INPUT_BUFFER] = "| "; 102static char perfstr[MAX_INPUT_BUFFER] = "| ";
103int cflags = REG_EXTENDED | REG_NOSUB | REG_NEWLINE; 103static int cflags = REG_EXTENDED | REG_NOSUB | REG_NEWLINE;
104int eflags = 0; 104static int eflags = 0;
105int errcode, excode; 105static int errcode, excode;
106 106
107char *server_address = NULL; 107static char *server_address = NULL;
108char *community = NULL; 108static char *community = NULL;
109char **contextargs = NULL; 109static char **contextargs = NULL;
110char *context = NULL; 110static char *context = NULL;
111char **authpriv = NULL; 111static char **authpriv = NULL;
112char *proto = NULL; 112static char *proto = NULL;
113char *seclevel = NULL; 113static char *seclevel = NULL;
114char *secname = NULL; 114static char *secname = NULL;
115char *authproto = NULL; 115static char *authproto = NULL;
116char *privproto = NULL; 116static char *privproto = NULL;
117char *authpasswd = NULL; 117static char *authpasswd = NULL;
118char *privpasswd = NULL; 118static char *privpasswd = NULL;
119int nulloid = STATE_UNKNOWN; 119static int nulloid = STATE_UNKNOWN;
120char **oids = NULL; 120static char **oids = NULL;
121size_t oids_size = 0; 121static size_t oids_size = 0;
122char *label; 122static char *label;
123char *units; 123static char *units;
124char *port; 124static char *port;
125char *snmpcmd; 125static char *snmpcmd;
126char string_value[MAX_INPUT_BUFFER] = ""; 126static char string_value[MAX_INPUT_BUFFER] = "";
127int invert_search=0; 127static int invert_search=0;
128char **labels = NULL; 128static char **labels = NULL;
129char **unitv = NULL; 129static char **unitv = NULL;
130size_t nlabels = 0; 130static size_t nlabels = 0;
131size_t labels_size = OID_COUNT_STEP; 131static size_t labels_size = OID_COUNT_STEP;
132size_t nunits = 0; 132static size_t nunits = 0;
133size_t unitv_size = OID_COUNT_STEP; 133static size_t unitv_size = OID_COUNT_STEP;
134size_t numoids = 0; 134static size_t numoids = 0;
135int numauthpriv = 0; 135static int numauthpriv = 0;
136int numcontext = 0; 136static int numcontext = 0;
137int verbose = 0; 137static int verbose = 0;
138bool usesnmpgetnext = false; 138static bool usesnmpgetnext = false;
139char *warning_thresholds = NULL; 139static char *warning_thresholds = NULL;
140char *critical_thresholds = NULL; 140static char *critical_thresholds = NULL;
141thresholds **thlds; 141static thresholds **thlds;
142size_t thlds_size = OID_COUNT_STEP; 142static size_t thlds_size = OID_COUNT_STEP;
143double *response_value; 143static double *response_value;
144size_t response_size = OID_COUNT_STEP; 144static size_t response_size = OID_COUNT_STEP;
145int retries = 0; 145static int retries = 0;
146int *eval_method; 146static int *eval_method;
147size_t eval_size = OID_COUNT_STEP; 147static size_t eval_size = OID_COUNT_STEP;
148char *delimiter; 148static char *delimiter;
149char *output_delim; 149static char *output_delim;
150char *miblist = NULL; 150static char *miblist = NULL;
151bool needmibs = false; 151static bool needmibs = false;
152int calculate_rate = 0; 152static int calculate_rate = 0;
153double offset = 0.0; 153static double offset = 0.0;
154int rate_multiplier = 1; 154static int rate_multiplier = 1;
155state_data *previous_state; 155static state_data *previous_state;
156double *previous_value; 156static double *previous_value;
157size_t previous_size = OID_COUNT_STEP; 157static size_t previous_size = OID_COUNT_STEP;
158int perf_labels = 1; 158static int perf_labels = 1;
159char* ip_version = ""; 159static char* ip_version = "";
160double multiplier = 1.0; 160static double multiplier = 1.0;
161char *fmtstr = ""; 161static char *fmtstr = "";
162bool fmtstr_set = false; 162static bool fmtstr_set = false;
163char buffer[DEFAULT_BUFFER_SIZE]; 163static char buffer[DEFAULT_BUFFER_SIZE];
164bool ignore_mib_parsing_errors = false; 164static bool ignore_mib_parsing_errors = false;
165 165
166static char *fix_snmp_range(char *th) 166static char *fix_snmp_range(char *th)
167{ 167{
@@ -1030,7 +1030,7 @@ selected.</para>
1030 1030
1031 1031
1032 1032
1033int 1033static int
1034validate_arguments () 1034validate_arguments ()
1035{ 1035{
1036 /* check whether to load locally installed MIBS (CPU/disk intensive) */ 1036 /* check whether to load locally installed MIBS (CPU/disk intensive) */
@@ -1139,7 +1139,7 @@ validate_arguments ()
1139/* trim leading whitespace 1139/* trim leading whitespace
1140 if there is a leading quote, make sure it balances */ 1140 if there is a leading quote, make sure it balances */
1141 1141
1142char * 1142static char *
1143thisarg (char *str) 1143thisarg (char *str)
1144{ 1144{
1145 str += strspn (str, " \t\r\n"); /* trim any leading whitespace */ 1145 str += strspn (str, " \t\r\n"); /* trim any leading whitespace */
@@ -1156,7 +1156,7 @@ thisarg (char *str)
1156 set the trailing quote to '\x0' 1156 set the trailing quote to '\x0'
1157 if the string continues, advance beyond the comma */ 1157 if the string continues, advance beyond the comma */
1158 1158
1159char * 1159static char *
1160nextarg (char *str) 1160nextarg (char *str)
1161{ 1161{
1162 if (str[0] == '\'') { 1162 if (str[0] == '\'') {
@@ -1188,7 +1188,7 @@ nextarg (char *str)
1188 1188
1189 1189
1190/* multiply result (values 0 < n < 1 work as divider) */ 1190/* multiply result (values 0 < n < 1 work as divider) */
1191char * 1191static char *
1192multiply (char *str) 1192multiply (char *str)
1193{ 1193{
1194 char *endptr; 1194 char *endptr;
@@ -1225,7 +1225,7 @@ multiply (char *str)
1225} 1225}
1226 1226
1227 1227
1228void 1228static void
1229print_help (void) 1229print_help (void)
1230{ 1230{
1231 print_revision (progname, NP_VERSION); 1231 print_revision (progname, NP_VERSION);