diff options
author | RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> | 2024-09-27 09:57:38 (GMT) |
---|---|---|
committer | RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> | 2024-09-27 09:57:38 (GMT) |
commit | 3ba660889a8e7a8fc992cfafc910a8f91eafb354 (patch) | |
tree | 7c19f6f2d75c09e6c7f2f1b547f6ba0992f497b8 /plugins | |
parent | a378134ddc042d72d6fde7b018de66e98d9e41d5 (diff) | |
download | monitoring-plugins-3ba660889a8e7a8fc992cfafc910a8f91eafb354.tar.gz |
check_snmp: Declare most variables as static
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/check_snmp.c | 156 |
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 | ||
89 | int process_arguments (int, char **); | 89 | static int process_arguments (int, char **); |
90 | int validate_arguments (void); | 90 | static int validate_arguments (void); |
91 | char *thisarg (char *str); | 91 | static char *thisarg (char *str); |
92 | char *nextarg (char *str); | 92 | static char *nextarg (char *str); |
93 | void print_usage (void); | 93 | void print_usage (void); |
94 | void print_help (void); | 94 | static void print_help (void); |
95 | char *multiply (char *str); | 95 | static char *multiply (char *str); |
96 | 96 | ||
97 | #include "regex.h" | 97 | #include "regex.h" |
98 | char regex_expect[MAX_INPUT_BUFFER] = ""; | 98 | static char regex_expect[MAX_INPUT_BUFFER] = ""; |
99 | regex_t preg; | 99 | static regex_t preg; |
100 | regmatch_t pmatch[10]; | 100 | static regmatch_t pmatch[10]; |
101 | char errbuf[MAX_INPUT_BUFFER] = ""; | 101 | static char errbuf[MAX_INPUT_BUFFER] = ""; |
102 | char perfstr[MAX_INPUT_BUFFER] = "| "; | 102 | static char perfstr[MAX_INPUT_BUFFER] = "| "; |
103 | int cflags = REG_EXTENDED | REG_NOSUB | REG_NEWLINE; | 103 | static int cflags = REG_EXTENDED | REG_NOSUB | REG_NEWLINE; |
104 | int eflags = 0; | 104 | static int eflags = 0; |
105 | int errcode, excode; | 105 | static int errcode, excode; |
106 | 106 | ||
107 | char *server_address = NULL; | 107 | static char *server_address = NULL; |
108 | char *community = NULL; | 108 | static char *community = NULL; |
109 | char **contextargs = NULL; | 109 | static char **contextargs = NULL; |
110 | char *context = NULL; | 110 | static char *context = NULL; |
111 | char **authpriv = NULL; | 111 | static char **authpriv = NULL; |
112 | char *proto = NULL; | 112 | static char *proto = NULL; |
113 | char *seclevel = NULL; | 113 | static char *seclevel = NULL; |
114 | char *secname = NULL; | 114 | static char *secname = NULL; |
115 | char *authproto = NULL; | 115 | static char *authproto = NULL; |
116 | char *privproto = NULL; | 116 | static char *privproto = NULL; |
117 | char *authpasswd = NULL; | 117 | static char *authpasswd = NULL; |
118 | char *privpasswd = NULL; | 118 | static char *privpasswd = NULL; |
119 | int nulloid = STATE_UNKNOWN; | 119 | static int nulloid = STATE_UNKNOWN; |
120 | char **oids = NULL; | 120 | static char **oids = NULL; |
121 | size_t oids_size = 0; | 121 | static size_t oids_size = 0; |
122 | char *label; | 122 | static char *label; |
123 | char *units; | 123 | static char *units; |
124 | char *port; | 124 | static char *port; |
125 | char *snmpcmd; | 125 | static char *snmpcmd; |
126 | char string_value[MAX_INPUT_BUFFER] = ""; | 126 | static char string_value[MAX_INPUT_BUFFER] = ""; |
127 | int invert_search=0; | 127 | static int invert_search=0; |
128 | char **labels = NULL; | 128 | static char **labels = NULL; |
129 | char **unitv = NULL; | 129 | static char **unitv = NULL; |
130 | size_t nlabels = 0; | 130 | static size_t nlabels = 0; |
131 | size_t labels_size = OID_COUNT_STEP; | 131 | static size_t labels_size = OID_COUNT_STEP; |
132 | size_t nunits = 0; | 132 | static size_t nunits = 0; |
133 | size_t unitv_size = OID_COUNT_STEP; | 133 | static size_t unitv_size = OID_COUNT_STEP; |
134 | size_t numoids = 0; | 134 | static size_t numoids = 0; |
135 | int numauthpriv = 0; | 135 | static int numauthpriv = 0; |
136 | int numcontext = 0; | 136 | static int numcontext = 0; |
137 | int verbose = 0; | 137 | static int verbose = 0; |
138 | bool usesnmpgetnext = false; | 138 | static bool usesnmpgetnext = false; |
139 | char *warning_thresholds = NULL; | 139 | static char *warning_thresholds = NULL; |
140 | char *critical_thresholds = NULL; | 140 | static char *critical_thresholds = NULL; |
141 | thresholds **thlds; | 141 | static thresholds **thlds; |
142 | size_t thlds_size = OID_COUNT_STEP; | 142 | static size_t thlds_size = OID_COUNT_STEP; |
143 | double *response_value; | 143 | static double *response_value; |
144 | size_t response_size = OID_COUNT_STEP; | 144 | static size_t response_size = OID_COUNT_STEP; |
145 | int retries = 0; | 145 | static int retries = 0; |
146 | int *eval_method; | 146 | static int *eval_method; |
147 | size_t eval_size = OID_COUNT_STEP; | 147 | static size_t eval_size = OID_COUNT_STEP; |
148 | char *delimiter; | 148 | static char *delimiter; |
149 | char *output_delim; | 149 | static char *output_delim; |
150 | char *miblist = NULL; | 150 | static char *miblist = NULL; |
151 | bool needmibs = false; | 151 | static bool needmibs = false; |
152 | int calculate_rate = 0; | 152 | static int calculate_rate = 0; |
153 | double offset = 0.0; | 153 | static double offset = 0.0; |
154 | int rate_multiplier = 1; | 154 | static int rate_multiplier = 1; |
155 | state_data *previous_state; | 155 | static state_data *previous_state; |
156 | double *previous_value; | 156 | static double *previous_value; |
157 | size_t previous_size = OID_COUNT_STEP; | 157 | static size_t previous_size = OID_COUNT_STEP; |
158 | int perf_labels = 1; | 158 | static int perf_labels = 1; |
159 | char* ip_version = ""; | 159 | static char* ip_version = ""; |
160 | double multiplier = 1.0; | 160 | static double multiplier = 1.0; |
161 | char *fmtstr = ""; | 161 | static char *fmtstr = ""; |
162 | bool fmtstr_set = false; | 162 | static bool fmtstr_set = false; |
163 | char buffer[DEFAULT_BUFFER_SIZE]; | 163 | static char buffer[DEFAULT_BUFFER_SIZE]; |
164 | bool ignore_mib_parsing_errors = false; | 164 | static bool ignore_mib_parsing_errors = false; |
165 | 165 | ||
166 | static char *fix_snmp_range(char *th) | 166 | static char *fix_snmp_range(char *th) |
167 | { | 167 | { |
@@ -1030,7 +1030,7 @@ selected.</para> | |||
1030 | 1030 | ||
1031 | 1031 | ||
1032 | 1032 | ||
1033 | int | 1033 | static int |
1034 | validate_arguments () | 1034 | validate_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 | ||
1142 | char * | 1142 | static char * |
1143 | thisarg (char *str) | 1143 | thisarg (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 | ||
1159 | char * | 1159 | static char * |
1160 | nextarg (char *str) | 1160 | nextarg (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) */ |
1191 | char * | 1191 | static char * |
1192 | multiply (char *str) | 1192 | multiply (char *str) |
1193 | { | 1193 | { |
1194 | char *endptr; | 1194 | char *endptr; |
@@ -1225,7 +1225,7 @@ multiply (char *str) | |||
1225 | } | 1225 | } |
1226 | 1226 | ||
1227 | 1227 | ||
1228 | void | 1228 | static void |
1229 | print_help (void) | 1229 | print_help (void) |
1230 | { | 1230 | { |
1231 | print_revision (progname, NP_VERSION); | 1231 | print_revision (progname, NP_VERSION); |