diff options
Diffstat (limited to 'plugins/check_nwstat.c')
-rw-r--r-- | plugins/check_nwstat.c | 2114 |
1 files changed, 977 insertions, 1137 deletions
diff --git a/plugins/check_nwstat.c b/plugins/check_nwstat.c index 12a729e0..3af63603 100644 --- a/plugins/check_nwstat.c +++ b/plugins/check_nwstat.c | |||
@@ -1,36 +1,36 @@ | |||
1 | /***************************************************************************** | 1 | /***************************************************************************** |
2 | * | 2 | * |
3 | * Monitoring check_nwstat plugin | 3 | * Monitoring check_nwstat plugin |
4 | * | 4 | * |
5 | * License: GPL | 5 | * License: GPL |
6 | * Copyright (c) 2000-2007 Monitoring Plugins Development Team | 6 | * Copyright (c) 2000-2024 Monitoring Plugins Development Team |
7 | * | 7 | * |
8 | * Description: | 8 | * Description: |
9 | * | 9 | * |
10 | * This file contains the check_nwstat plugin | 10 | * This file contains the check_nwstat plugin |
11 | * | 11 | * |
12 | * This plugin attempts to contact the MRTGEXT NLM running on a | 12 | * This plugin attempts to contact the MRTGEXT NLM running on a |
13 | * Novell server to gather the requested system information. | 13 | * Novell server to gather the requested system information. |
14 | * | 14 | * |
15 | * | 15 | * |
16 | * This program is free software: you can redistribute it and/or modify | 16 | * This program is free software: you can redistribute it and/or modify |
17 | * it under the terms of the GNU General Public License as published by | 17 | * it under the terms of the GNU General Public License as published by |
18 | * the Free Software Foundation, either version 3 of the License, or | 18 | * the Free Software Foundation, either version 3 of the License, or |
19 | * (at your option) any later version. | 19 | * (at your option) any later version. |
20 | * | 20 | * |
21 | * This program is distributed in the hope that it will be useful, | 21 | * This program is distributed in the hope that it will be useful, |
22 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 22 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
23 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 23 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
24 | * GNU General Public License for more details. | 24 | * GNU General Public License for more details. |
25 | * | 25 | * |
26 | * You should have received a copy of the GNU General Public License | 26 | * You should have received a copy of the GNU General Public License |
27 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 27 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
28 | * | 28 | * |
29 | * | 29 | * |
30 | *****************************************************************************/ | 30 | *****************************************************************************/ |
31 | 31 | ||
32 | const char *progname = "check_nwstat"; | 32 | const char *progname = "check_nwstat"; |
33 | const char *copyright = "2000-2007"; | 33 | const char *copyright = "2000-2024"; |
34 | const char *email = "devel@monitoring-plugins.org"; | 34 | const char *email = "devel@monitoring-plugins.org"; |
35 | 35 | ||
36 | #include "common.h" | 36 | #include "common.h" |
@@ -44,9 +44,10 @@ enum checkvar { | |||
44 | LOAD15, /* check 15 minute CPU load */ | 44 | LOAD15, /* check 15 minute CPU load */ |
45 | CONNS, /* check number of connections */ | 45 | CONNS, /* check number of connections */ |
46 | VPF, /* check % free space on volume */ | 46 | VPF, /* check % free space on volume */ |
47 | VMF, /* check MB free space on volume */ | 47 | VMF, /* check MB free space on volume */ |
48 | VMU, /* check MB used space on volume */ | 48 | VMU, /* check MB used space on volume */ |
49 | VMP, /* check MB purgeable space on volume */ | 49 | VPU, /* check % used space on volume */ |
50 | VMP, /* check MB purgeable space on volume */ | ||
50 | VKF, /* check KB free space on volume */ | 51 | VKF, /* check KB free space on volume */ |
51 | LTCH, /* check long-term cache hit percentage */ | 52 | LTCH, /* check long-term cache hit percentage */ |
52 | CBUFF, /* check total cache buffers */ | 53 | CBUFF, /* check total cache buffers */ |
@@ -54,7 +55,7 @@ enum checkvar { | |||
54 | LRUM, /* check LRU sitting time in minutes */ | 55 | LRUM, /* check LRU sitting time in minutes */ |
55 | DSDB, /* check to see if DS Database is open */ | 56 | DSDB, /* check to see if DS Database is open */ |
56 | LOGINS, /* check to see if logins are enabled */ | 57 | LOGINS, /* check to see if logins are enabled */ |
57 | NRMH, /* check to see NRM Health Status */ | 58 | NRMH, /* check to see NRM Health Status */ |
58 | PUPRB, /* check % of used packet receive buffers */ | 59 | PUPRB, /* check % of used packet receive buffers */ |
59 | UPRB, /* check used packet receive buffers */ | 60 | UPRB, /* check used packet receive buffers */ |
60 | SAPENTRIES, /* check SAP entries */ | 61 | SAPENTRIES, /* check SAP entries */ |
@@ -72,8 +73,8 @@ enum checkvar { | |||
72 | DSVER, /* check NDS version */ | 73 | DSVER, /* check NDS version */ |
73 | UPTIME, /* check server uptime */ | 74 | UPTIME, /* check server uptime */ |
74 | NLM, /* check NLM loaded */ | 75 | NLM, /* check NLM loaded */ |
75 | NRMP, /* check NRM Process Values */ | 76 | NRMP, /* check NRM Process Values */ |
76 | NRMM, /* check NRM Memory Values */ | 77 | NRMM, /* check NRM Memory Values */ |
77 | NRMS, /* check NRM Values */ | 78 | NRMS, /* check NRM Values */ |
78 | NSS1, /* check Statistics from _Admin:Manage_NSS\GeneralStats.xml */ | 79 | NSS1, /* check Statistics from _Admin:Manage_NSS\GeneralStats.xml */ |
79 | NSS2, /* check Statistics from _Admin:Manage_NSS\BufferCache.xml */ | 80 | NSS2, /* check Statistics from _Admin:Manage_NSS\BufferCache.xml */ |
@@ -88,1600 +89,1439 @@ enum { | |||
88 | PORT = 9999 | 89 | PORT = 9999 |
89 | }; | 90 | }; |
90 | 91 | ||
91 | char *server_address=NULL; | 92 | char *server_address = NULL; |
92 | char *volume_name=NULL; | 93 | char *volume_name = NULL; |
93 | char *nlm_name=NULL; | 94 | char *nlm_name = NULL; |
94 | char *nrmp_name=NULL; | 95 | char *nrmp_name = NULL; |
95 | char *nrmm_name=NULL; | 96 | char *nrmm_name = NULL; |
96 | char *nrms_name=NULL; | 97 | char *nrms_name = NULL; |
97 | char *nss1_name=NULL; | 98 | char *nss1_name = NULL; |
98 | char *nss2_name=NULL; | 99 | char *nss2_name = NULL; |
99 | char *nss3_name=NULL; | 100 | char *nss3_name = NULL; |
100 | char *nss4_name=NULL; | 101 | char *nss4_name = NULL; |
101 | char *nss5_name=NULL; | 102 | char *nss5_name = NULL; |
102 | char *nss6_name=NULL; | 103 | char *nss6_name = NULL; |
103 | char *nss7_name=NULL; | 104 | char *nss7_name = NULL; |
104 | int server_port=PORT; | 105 | int server_port = PORT; |
105 | unsigned long warning_value=0L; | 106 | unsigned long warning_value = 0L; |
106 | unsigned long critical_value=0L; | 107 | unsigned long critical_value = 0L; |
107 | bool check_warning_value = false; | 108 | bool check_warning_value = false; |
108 | bool check_critical_value = false; | 109 | bool check_critical_value = false; |
109 | bool check_netware_version = false; | 110 | bool check_netware_version = false; |
110 | enum checkvar vars_to_check = NONE; | 111 | enum checkvar vars_to_check = NONE; |
111 | int sap_number=-1; | 112 | int sap_number = -1; |
112 | 113 | ||
113 | int process_arguments(int, char **); | 114 | int process_arguments(int, char **); |
114 | void print_help(void); | 115 | void print_help(void); |
115 | void print_usage(void); | 116 | void print_usage(void); |
116 | 117 | ||
117 | 118 | int main(int argc, char **argv) { | |
118 | |||
119 | int | ||
120 | main(int argc, char **argv) { | ||
121 | int result = STATE_UNKNOWN; | 119 | int result = STATE_UNKNOWN; |
122 | int sd; | 120 | int sd; |
123 | char *send_buffer=NULL; | 121 | char *send_buffer = NULL; |
124 | char recv_buffer[MAX_INPUT_BUFFER]; | 122 | char recv_buffer[MAX_INPUT_BUFFER]; |
125 | char *output_message=NULL; | 123 | char *output_message = NULL; |
126 | char *temp_buffer=NULL; | 124 | char *temp_buffer = NULL; |
127 | char *netware_version=NULL; | 125 | char *netware_version = NULL; |
128 | 126 | ||
129 | int time_sync_status=0; | 127 | int time_sync_status = 0; |
130 | int nrm_health_status=0; | 128 | int nrm_health_status = 0; |
131 | unsigned long total_cache_buffers=0; | 129 | unsigned long total_cache_buffers = 0; |
132 | unsigned long dirty_cache_buffers=0; | 130 | unsigned long dirty_cache_buffers = 0; |
133 | unsigned long open_files=0; | 131 | unsigned long open_files = 0; |
134 | unsigned long abended_threads=0; | 132 | unsigned long abended_threads = 0; |
135 | unsigned long max_service_processes=0; | 133 | unsigned long max_service_processes = 0; |
136 | unsigned long current_service_processes=0; | 134 | unsigned long current_service_processes = 0; |
137 | unsigned long free_disk_space=0L; | 135 | unsigned long free_disk_space = 0L; |
138 | unsigned long nrmp_value=0L; | 136 | unsigned long nrmp_value = 0L; |
139 | unsigned long nrmm_value=0L; | 137 | unsigned long nrmm_value = 0L; |
140 | unsigned long nrms_value=0L; | 138 | unsigned long nrms_value = 0L; |
141 | unsigned long nss1_value=0L; | 139 | unsigned long nss1_value = 0L; |
142 | unsigned long nss2_value=0L; | 140 | unsigned long nss2_value = 0L; |
143 | unsigned long nss3_value=0L; | 141 | unsigned long nss3_value = 0L; |
144 | unsigned long nss4_value=0L; | 142 | unsigned long nss4_value = 0L; |
145 | unsigned long nss5_value=0L; | 143 | unsigned long nss5_value = 0L; |
146 | unsigned long nss6_value=0L; | 144 | unsigned long nss6_value = 0L; |
147 | unsigned long nss7_value=0L; | 145 | unsigned long nss7_value = 0L; |
148 | unsigned long total_disk_space=0L; | 146 | unsigned long total_disk_space = 0L; |
149 | unsigned long purgeable_disk_space=0L; | 147 | unsigned long used_disk_space = 0L; |
150 | unsigned long non_purgeable_disk_space=0L; | 148 | unsigned long percent_used_disk_space = 0L; |
151 | unsigned long percent_free_space=0; | 149 | unsigned long purgeable_disk_space = 0L; |
152 | unsigned long percent_purgeable_space=0; | 150 | unsigned long non_purgeable_disk_space = 0L; |
153 | unsigned long percent_non_purgeable_space=0; | 151 | unsigned long percent_free_space = 0; |
154 | unsigned long current_connections=0L; | 152 | unsigned long percent_purgeable_space = 0; |
155 | unsigned long utilization=0L; | 153 | unsigned long percent_non_purgeable_space = 0; |
156 | unsigned long cache_hits=0; | 154 | unsigned long current_connections = 0L; |
157 | unsigned long cache_buffers=0L; | 155 | unsigned long utilization = 0L; |
158 | unsigned long lru_time=0L; | 156 | unsigned long cache_hits = 0; |
159 | unsigned long max_packet_receive_buffers=0; | 157 | unsigned long cache_buffers = 0L; |
160 | unsigned long used_packet_receive_buffers=0; | 158 | unsigned long lru_time = 0L; |
161 | unsigned long percent_used_packet_receive_buffers=0L; | 159 | unsigned long max_packet_receive_buffers = 0; |
162 | unsigned long sap_entries=0; | 160 | unsigned long used_packet_receive_buffers = 0; |
161 | unsigned long percent_used_packet_receive_buffers = 0L; | ||
162 | unsigned long sap_entries = 0; | ||
163 | char uptime[MAX_INPUT_BUFFER]; | 163 | char uptime[MAX_INPUT_BUFFER]; |
164 | 164 | ||
165 | setlocale (LC_ALL, ""); | 165 | setlocale(LC_ALL, ""); |
166 | bindtextdomain (PACKAGE, LOCALEDIR); | 166 | bindtextdomain(PACKAGE, LOCALEDIR); |
167 | textdomain (PACKAGE); | 167 | textdomain(PACKAGE); |
168 | 168 | ||
169 | /* Parse extra opts if any */ | 169 | /* Parse extra opts if any */ |
170 | argv=np_extra_opts(&argc, argv, progname); | 170 | argv = np_extra_opts(&argc, argv, progname); |
171 | 171 | ||
172 | if (process_arguments(argc,argv) == ERROR) | 172 | if (process_arguments(argc, argv) == ERROR) |
173 | usage4 (_("Could not parse arguments")); | 173 | usage4(_("Could not parse arguments")); |
174 | 174 | ||
175 | /* initialize alarm signal handling */ | 175 | /* initialize alarm signal handling */ |
176 | signal(SIGALRM,socket_timeout_alarm_handler); | 176 | signal(SIGALRM, socket_timeout_alarm_handler); |
177 | 177 | ||
178 | /* set socket timeout */ | 178 | /* set socket timeout */ |
179 | alarm(socket_timeout); | 179 | alarm(socket_timeout); |
180 | 180 | ||
181 | /* open connection */ | 181 | /* open connection */ |
182 | my_tcp_connect (server_address, server_port, &sd); | 182 | my_tcp_connect(server_address, server_port, &sd); |
183 | 183 | ||
184 | /* get OS version string */ | 184 | /* get OS version string */ |
185 | if (check_netware_version) { | 185 | if (check_netware_version) { |
186 | send_buffer = strdup ("S19\r\n"); | 186 | send_buffer = strdup("S19\r\n"); |
187 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | 187 | result = send_tcp_request(sd, send_buffer, recv_buffer, sizeof(recv_buffer)); |
188 | if (result!=STATE_OK) | 188 | if (result != STATE_OK) |
189 | return result; | 189 | return result; |
190 | if (!strcmp(recv_buffer,"-1\n")) | 190 | if (!strcmp(recv_buffer, "-1\n")) |
191 | netware_version = strdup(""); | 191 | netware_version = strdup(""); |
192 | else { | 192 | else { |
193 | recv_buffer[strlen(recv_buffer)-1]=0; | 193 | recv_buffer[strlen(recv_buffer) - 1] = 0; |
194 | xasprintf (&netware_version,_("NetWare %s: "),recv_buffer); | 194 | xasprintf(&netware_version, _("NetWare %s: "), recv_buffer); |
195 | } | 195 | } |
196 | } else | 196 | } else |
197 | netware_version = strdup(""); | 197 | netware_version = strdup(""); |
198 | 198 | ||
199 | |||
200 | /* check CPU load */ | 199 | /* check CPU load */ |
201 | if (vars_to_check==LOAD1 || vars_to_check==LOAD5 || vars_to_check==LOAD15) { | 200 | if (vars_to_check == LOAD1 || vars_to_check == LOAD5 || vars_to_check == LOAD15) { |
202 | 201 | ||
203 | switch(vars_to_check) { | 202 | switch (vars_to_check) { |
204 | case LOAD1: | 203 | case LOAD1: |
205 | temp_buffer = strdup ("1"); | 204 | temp_buffer = strdup("1"); |
206 | break; | 205 | break; |
207 | case LOAD5: | 206 | case LOAD5: |
208 | temp_buffer = strdup ("5"); | 207 | temp_buffer = strdup("5"); |
209 | break; | 208 | break; |
210 | default: | 209 | default: |
211 | temp_buffer = strdup ("15"); | 210 | temp_buffer = strdup("15"); |
212 | break; | 211 | break; |
213 | } | 212 | } |
214 | 213 | ||
215 | close(sd); | 214 | close(sd); |
216 | my_tcp_connect (server_address, server_port, &sd); | 215 | my_tcp_connect(server_address, server_port, &sd); |
217 | 216 | ||
218 | xasprintf (&send_buffer,"UTIL%s\r\n",temp_buffer); | 217 | xasprintf(&send_buffer, "UTIL%s\r\n", temp_buffer); |
219 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | 218 | result = send_tcp_request(sd, send_buffer, recv_buffer, sizeof(recv_buffer)); |
220 | if (result!=STATE_OK) | 219 | if (result != STATE_OK) |
221 | return result; | 220 | return result; |
222 | utilization=strtoul(recv_buffer,NULL,10); | 221 | utilization = strtoul(recv_buffer, NULL, 10); |
223 | 222 | ||
224 | close(sd); | 223 | close(sd); |
225 | my_tcp_connect (server_address, server_port, &sd); | 224 | my_tcp_connect(server_address, server_port, &sd); |
226 | 225 | ||
227 | send_buffer = strdup ("UPTIME\r\n"); | 226 | send_buffer = strdup("UPTIME\r\n"); |
228 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | 227 | result = send_tcp_request(sd, send_buffer, recv_buffer, sizeof(recv_buffer)); |
229 | if (result!=STATE_OK) | 228 | if (result != STATE_OK) |
230 | return result; | 229 | return result; |
231 | recv_buffer[strlen(recv_buffer)-1]=0; | 230 | recv_buffer[strlen(recv_buffer) - 1] = 0; |
232 | sprintf(uptime,_("Up %s,"),recv_buffer); | 231 | sprintf(uptime, _("Up %s,"), recv_buffer); |
233 | 232 | ||
234 | if (check_critical_value && utilization >= critical_value) | 233 | if (check_critical_value && utilization >= critical_value) |
235 | result=STATE_CRITICAL; | 234 | result = STATE_CRITICAL; |
236 | else if (check_warning_value && utilization >= warning_value) | 235 | else if (check_warning_value && utilization >= warning_value) |
237 | result=STATE_WARNING; | 236 | result = STATE_WARNING; |
238 | 237 | ||
239 | xasprintf (&output_message, | 238 | xasprintf(&output_message, _("Load %s - %s %s-min load average = %lu%%|load%s=%lu;%lu;%lu;0;100"), state_text(result), uptime, |
240 | _("Load %s - %s %s-min load average = %lu%%|load%s=%lu;%lu;%lu;0;100"), | 239 | temp_buffer, utilization, temp_buffer, utilization, warning_value, critical_value); |
241 | state_text(result), | ||
242 | uptime, | ||
243 | temp_buffer, | ||
244 | utilization, | ||
245 | temp_buffer, | ||
246 | utilization, | ||
247 | warning_value, | ||
248 | critical_value); | ||
249 | 240 | ||
250 | /* check number of user connections */ | 241 | /* check number of user connections */ |
251 | } else if (vars_to_check==CONNS) { | 242 | } else if (vars_to_check == CONNS) { |
252 | 243 | ||
253 | close(sd); | 244 | close(sd); |
254 | my_tcp_connect (server_address, server_port, &sd); | 245 | my_tcp_connect(server_address, server_port, &sd); |
255 | 246 | ||
256 | send_buffer = strdup ("CONNECT\r\n"); | 247 | send_buffer = strdup("CONNECT\r\n"); |
257 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | 248 | result = send_tcp_request(sd, send_buffer, recv_buffer, sizeof(recv_buffer)); |
258 | if (result!=STATE_OK) | 249 | if (result != STATE_OK) |
259 | return result; | 250 | return result; |
260 | current_connections=strtoul(recv_buffer,NULL,10); | 251 | current_connections = strtoul(recv_buffer, NULL, 10); |
261 | 252 | ||
262 | if (check_critical_value && current_connections >= critical_value) | 253 | if (check_critical_value && current_connections >= critical_value) |
263 | result=STATE_CRITICAL; | 254 | result = STATE_CRITICAL; |
264 | else if (check_warning_value && current_connections >= warning_value) | 255 | else if (check_warning_value && current_connections >= warning_value) |
265 | result=STATE_WARNING; | 256 | result = STATE_WARNING; |
266 | 257 | ||
267 | xasprintf (&output_message, | 258 | xasprintf(&output_message, _("Conns %s - %lu current connections|Conns=%lu;%lu;%lu;;"), state_text(result), current_connections, |
268 | _("Conns %s - %lu current connections|Conns=%lu;%lu;%lu;;"), | 259 | current_connections, warning_value, critical_value); |
269 | state_text(result), | ||
270 | current_connections, | ||
271 | current_connections, | ||
272 | warning_value, | ||
273 | critical_value); | ||
274 | 260 | ||
275 | /* check % long term cache hits */ | 261 | /* check % long term cache hits */ |
276 | } else if (vars_to_check==LTCH) { | 262 | } else if (vars_to_check == LTCH) { |
277 | 263 | ||
278 | close(sd); | 264 | close(sd); |
279 | my_tcp_connect (server_address, server_port, &sd); | 265 | my_tcp_connect(server_address, server_port, &sd); |
280 | 266 | ||
281 | send_buffer = strdup ("S1\r\n"); | 267 | send_buffer = strdup("S1\r\n"); |
282 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | 268 | result = send_tcp_request(sd, send_buffer, recv_buffer, sizeof(recv_buffer)); |
283 | if (result!=STATE_OK) | 269 | if (result != STATE_OK) |
284 | return result; | 270 | return result; |
285 | cache_hits=atoi(recv_buffer); | 271 | cache_hits = atoi(recv_buffer); |
286 | 272 | ||
287 | if (check_critical_value && cache_hits <= critical_value) | 273 | if (check_critical_value && cache_hits <= critical_value) |
288 | result=STATE_CRITICAL; | 274 | result = STATE_CRITICAL; |
289 | else if (check_warning_value && cache_hits <= warning_value) | 275 | else if (check_warning_value && cache_hits <= warning_value) |
290 | result=STATE_WARNING; | 276 | result = STATE_WARNING; |
291 | 277 | ||
292 | xasprintf (&output_message, | 278 | xasprintf(&output_message, _("%s: Long term cache hits = %lu%%"), state_text(result), cache_hits); |
293 | _("%s: Long term cache hits = %lu%%"), | ||
294 | state_text(result), | ||
295 | cache_hits); | ||
296 | 279 | ||
297 | /* check cache buffers */ | 280 | /* check cache buffers */ |
298 | } else if (vars_to_check==CBUFF) { | 281 | } else if (vars_to_check == CBUFF) { |
299 | 282 | ||
300 | close(sd); | 283 | close(sd); |
301 | my_tcp_connect (server_address, server_port, &sd); | 284 | my_tcp_connect(server_address, server_port, &sd); |
302 | 285 | ||
303 | send_buffer = strdup ("S2\r\n"); | 286 | send_buffer = strdup("S2\r\n"); |
304 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | 287 | result = send_tcp_request(sd, send_buffer, recv_buffer, sizeof(recv_buffer)); |
305 | if (result!=STATE_OK) | 288 | if (result != STATE_OK) |
306 | return result; | 289 | return result; |
307 | cache_buffers=strtoul(recv_buffer,NULL,10); | 290 | cache_buffers = strtoul(recv_buffer, NULL, 10); |
308 | 291 | ||
309 | if (check_critical_value && cache_buffers <= critical_value) | 292 | if (check_critical_value && cache_buffers <= critical_value) |
310 | result=STATE_CRITICAL; | 293 | result = STATE_CRITICAL; |
311 | else if (check_warning_value && cache_buffers <= warning_value) | 294 | else if (check_warning_value && cache_buffers <= warning_value) |
312 | result=STATE_WARNING; | 295 | result = STATE_WARNING; |
313 | 296 | ||
314 | xasprintf (&output_message, | 297 | xasprintf(&output_message, _("%s: Total cache buffers = %lu|Cachebuffers=%lu;%lu;%lu;;"), state_text(result), cache_buffers, |
315 | _("%s: Total cache buffers = %lu|Cachebuffers=%lu;%lu;%lu;;"), | 298 | cache_buffers, warning_value, critical_value); |
316 | state_text(result), | ||
317 | cache_buffers, | ||
318 | cache_buffers, | ||
319 | warning_value, | ||
320 | critical_value); | ||
321 | 299 | ||
322 | /* check dirty cache buffers */ | 300 | /* check dirty cache buffers */ |
323 | } else if (vars_to_check==CDBUFF) { | 301 | } else if (vars_to_check == CDBUFF) { |
324 | 302 | ||
325 | close(sd); | 303 | close(sd); |
326 | my_tcp_connect (server_address, server_port, &sd); | 304 | my_tcp_connect(server_address, server_port, &sd); |
327 | 305 | ||
328 | send_buffer = strdup ("S3\r\n"); | 306 | send_buffer = strdup("S3\r\n"); |
329 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | 307 | result = send_tcp_request(sd, send_buffer, recv_buffer, sizeof(recv_buffer)); |
330 | if (result!=STATE_OK) | 308 | if (result != STATE_OK) |
331 | return result; | 309 | return result; |
332 | cache_buffers=strtoul(recv_buffer,NULL,10); | 310 | cache_buffers = strtoul(recv_buffer, NULL, 10); |
333 | 311 | ||
334 | if (check_critical_value && cache_buffers >= critical_value) | 312 | if (check_critical_value && cache_buffers >= critical_value) |
335 | result=STATE_CRITICAL; | 313 | result = STATE_CRITICAL; |
336 | else if (check_warning_value && cache_buffers >= warning_value) | 314 | else if (check_warning_value && cache_buffers >= warning_value) |
337 | result=STATE_WARNING; | 315 | result = STATE_WARNING; |
338 | 316 | ||
339 | xasprintf (&output_message, | 317 | xasprintf(&output_message, _("%s: Dirty cache buffers = %lu|Dirty-Cache-Buffers=%lu;%lu;%lu;;"), state_text(result), cache_buffers, |
340 | _("%s: Dirty cache buffers = %lu|Dirty-Cache-Buffers=%lu;%lu;%lu;;"), | 318 | cache_buffers, warning_value, critical_value); |
341 | state_text(result), | ||
342 | cache_buffers, | ||
343 | cache_buffers, | ||
344 | warning_value, | ||
345 | critical_value); | ||
346 | 319 | ||
347 | /* check LRU sitting time in minutes */ | 320 | /* check LRU sitting time in minutes */ |
348 | } else if (vars_to_check==LRUM) { | 321 | } else if (vars_to_check == LRUM) { |
349 | 322 | ||
350 | close(sd); | 323 | close(sd); |
351 | my_tcp_connect (server_address, server_port, &sd); | 324 | my_tcp_connect(server_address, server_port, &sd); |
352 | 325 | ||
353 | send_buffer = strdup ("S5\r\n"); | 326 | send_buffer = strdup("S5\r\n"); |
354 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | 327 | result = send_tcp_request(sd, send_buffer, recv_buffer, sizeof(recv_buffer)); |
355 | if (result!=STATE_OK) | 328 | if (result != STATE_OK) |
356 | return result; | 329 | return result; |
357 | lru_time=strtoul(recv_buffer,NULL,10); | 330 | lru_time = strtoul(recv_buffer, NULL, 10); |
358 | 331 | ||
359 | if (check_critical_value && lru_time <= critical_value) | 332 | if (check_critical_value && lru_time <= critical_value) |
360 | result=STATE_CRITICAL; | 333 | result = STATE_CRITICAL; |
361 | else if (check_warning_value && lru_time <= warning_value) | 334 | else if (check_warning_value && lru_time <= warning_value) |
362 | result=STATE_WARNING; | 335 | result = STATE_WARNING; |
363 | |||
364 | xasprintf (&output_message, | ||
365 | _("%s: LRU sitting time = %lu minutes"), | ||
366 | state_text(result), | ||
367 | lru_time); | ||
368 | 336 | ||
337 | xasprintf(&output_message, _("%s: LRU sitting time = %lu minutes"), state_text(result), lru_time); | ||
369 | 338 | ||
370 | /* check KB free space on volume */ | 339 | /* check KB free space on volume */ |
371 | } else if (vars_to_check==VKF) { | 340 | } else if (vars_to_check == VKF) { |
372 | 341 | ||
373 | close(sd); | 342 | close(sd); |
374 | my_tcp_connect (server_address, server_port, &sd); | 343 | my_tcp_connect(server_address, server_port, &sd); |
375 | 344 | ||
376 | xasprintf (&send_buffer,"VKF%s\r\n",volume_name); | 345 | xasprintf(&send_buffer, "VKF%s\r\n", volume_name); |
377 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | 346 | result = send_tcp_request(sd, send_buffer, recv_buffer, sizeof(recv_buffer)); |
378 | if (result!=STATE_OK) | 347 | if (result != STATE_OK) |
379 | return result; | 348 | return result; |
380 | 349 | ||
381 | if (!strcmp(recv_buffer,"-1\n")) { | 350 | if (!strcmp(recv_buffer, "-1\n")) { |
382 | xasprintf (&output_message,_("CRITICAL - Volume '%s' does not exist!"),volume_name); | 351 | xasprintf(&output_message, _("CRITICAL - Volume '%s' does not exist!"), volume_name); |
383 | result=STATE_CRITICAL; | 352 | result = STATE_CRITICAL; |
384 | } else { | 353 | } else { |
385 | free_disk_space=strtoul(recv_buffer,NULL,10); | 354 | free_disk_space = strtoul(recv_buffer, NULL, 10); |
386 | if (check_critical_value && free_disk_space <= critical_value) | 355 | if (check_critical_value && free_disk_space <= critical_value) |
387 | result=STATE_CRITICAL; | 356 | result = STATE_CRITICAL; |
388 | else if (check_warning_value && free_disk_space <= warning_value) | 357 | else if (check_warning_value && free_disk_space <= warning_value) |
389 | result=STATE_WARNING; | 358 | result = STATE_WARNING; |
390 | xasprintf (&output_message, | 359 | xasprintf(&output_message, _("%s%lu KB free on volume %s|KBFree%s=%lu;%lu;%lu;;"), (result == STATE_OK) ? "" : _("Only "), |
391 | _("%s%lu KB free on volume %s|KBFree%s=%lu;%lu;%lu;;"), | 360 | free_disk_space, volume_name, volume_name, free_disk_space, warning_value, critical_value); |
392 | (result==STATE_OK)?"":_("Only "), | ||
393 | free_disk_space, | ||
394 | volume_name, | ||
395 | volume_name, | ||
396 | free_disk_space, | ||
397 | warning_value, | ||
398 | critical_value); | ||
399 | } | 361 | } |
400 | 362 | ||
401 | /* check MB free space on volume */ | 363 | /* check MB free space on volume */ |
402 | } else if (vars_to_check==VMF) { | 364 | } else if (vars_to_check == VMF) { |
403 | 365 | ||
404 | xasprintf (&send_buffer,"VMF%s\r\n",volume_name); | 366 | xasprintf(&send_buffer, "VMF%s\r\n", volume_name); |
405 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | 367 | result = send_tcp_request(sd, send_buffer, recv_buffer, sizeof(recv_buffer)); |
406 | if (result!=STATE_OK) | 368 | if (result != STATE_OK) |
407 | return result; | 369 | return result; |
408 | 370 | ||
409 | if (!strcmp(recv_buffer,"-1\n")) { | 371 | if (!strcmp(recv_buffer, "-1\n")) { |
410 | xasprintf (&output_message,_("CRITICAL - Volume '%s' does not exist!"),volume_name); | 372 | xasprintf(&output_message, _("CRITICAL - Volume '%s' does not exist!"), volume_name); |
411 | result=STATE_CRITICAL; | 373 | result = STATE_CRITICAL; |
412 | } else { | 374 | } else { |
413 | free_disk_space=strtoul(recv_buffer,NULL,10); | 375 | free_disk_space = strtoul(recv_buffer, NULL, 10); |
414 | if (check_critical_value && free_disk_space <= critical_value) | 376 | if (check_critical_value && free_disk_space <= critical_value) |
415 | result=STATE_CRITICAL; | 377 | result = STATE_CRITICAL; |
416 | else if (check_warning_value && free_disk_space <= warning_value) | 378 | else if (check_warning_value && free_disk_space <= warning_value) |
417 | result=STATE_WARNING; | 379 | result = STATE_WARNING; |
418 | xasprintf (&output_message, | 380 | xasprintf(&output_message, _("%s%lu MB free on volume %s|MBFree%s=%lu;%lu;%lu;;"), (result == STATE_OK) ? "" : _("Only "), |
419 | _("%s%lu MB free on volume %s|MBFree%s=%lu;%lu;%lu;;"), | 381 | free_disk_space, volume_name, volume_name, free_disk_space, warning_value, critical_value); |
420 | (result==STATE_OK)?"":_("Only "), | ||
421 | free_disk_space, | ||
422 | volume_name, | ||
423 | volume_name, | ||
424 | free_disk_space, | ||
425 | warning_value, | ||
426 | critical_value); | ||
427 | } | 382 | } |
428 | /* check MB used space on volume */ | 383 | /* check MB used space on volume */ |
429 | } else if (vars_to_check==VMU) { | 384 | } else if (vars_to_check == VMU) { |
430 | 385 | ||
431 | xasprintf (&send_buffer,"VMU%s\r\n",volume_name); | 386 | xasprintf(&send_buffer, "VMU%s\r\n", volume_name); |
432 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | 387 | result = send_tcp_request(sd, send_buffer, recv_buffer, sizeof(recv_buffer)); |
433 | if (result!=STATE_OK) | 388 | if (result != STATE_OK) |
434 | return result; | 389 | return result; |
435 | 390 | ||
436 | if (!strcmp(recv_buffer,"-1\n")) { | 391 | if (!strcmp(recv_buffer, "-1\n")) { |
437 | xasprintf (&output_message,_("CRITICAL - Volume '%s' does not exist!"),volume_name); | 392 | xasprintf(&output_message, _("CRITICAL - Volume '%s' does not exist!"), volume_name); |
438 | result=STATE_CRITICAL; | 393 | result = STATE_CRITICAL; |
439 | } else { | 394 | } else { |
440 | free_disk_space=strtoul(recv_buffer,NULL,10); | 395 | free_disk_space = strtoul(recv_buffer, NULL, 10); |
441 | if (check_critical_value && free_disk_space <= critical_value) | 396 | if (check_critical_value && free_disk_space <= critical_value) |
442 | result=STATE_CRITICAL; | 397 | result = STATE_CRITICAL; |
443 | else if (check_warning_value && free_disk_space <= warning_value) | 398 | else if (check_warning_value && free_disk_space <= warning_value) |
444 | result=STATE_WARNING; | 399 | result = STATE_WARNING; |
445 | xasprintf (&output_message, | 400 | xasprintf(&output_message, _("%s%lu MB used on volume %s|MBUsed%s=%lu;%lu;%lu;;"), (result == STATE_OK) ? "" : _("Only "), |
446 | _("%s%lu MB used on volume %s|MBUsed%s=%lu;%lu;%lu;;"), | 401 | free_disk_space, volume_name, volume_name, free_disk_space, warning_value, critical_value); |
447 | (result==STATE_OK)?"":_("Only "), | ||
448 | free_disk_space, | ||
449 | volume_name, | ||
450 | volume_name, | ||
451 | free_disk_space, | ||
452 | warning_value, | ||
453 | critical_value); | ||
454 | } | 402 | } |
403 | /* check % used space on volume */ | ||
404 | } else if (vars_to_check == VPU) { | ||
405 | close(sd); | ||
406 | my_tcp_connect(server_address, server_port, &sd); | ||
407 | |||
408 | asprintf(&send_buffer, "VMU%s\r\n", volume_name); | ||
409 | result = send_tcp_request(sd, send_buffer, recv_buffer, sizeof(recv_buffer)); | ||
410 | |||
411 | if (result != STATE_OK) | ||
412 | return result; | ||
413 | |||
414 | if (!strcmp(recv_buffer, "-1\n")) { | ||
415 | asprintf(&output_message, _("CRITICAL - Volume '%s' does not exist!"), volume_name); | ||
416 | result = STATE_CRITICAL; | ||
455 | 417 | ||
418 | } else { | ||
419 | used_disk_space = strtoul(recv_buffer, NULL, 10); | ||
420 | close(sd); | ||
421 | my_tcp_connect(server_address, server_port, &sd); | ||
422 | /* get total volume in MB */ | ||
423 | asprintf(&send_buffer, "VMS%s\r\n", volume_name); | ||
424 | result = send_tcp_request(sd, send_buffer, recv_buffer, sizeof(recv_buffer)); | ||
425 | if (result != STATE_OK) | ||
426 | return result; | ||
427 | total_disk_space = strtoul(recv_buffer, NULL, 10); | ||
428 | /* calculate percent used on volume */ | ||
429 | percent_used_disk_space = (unsigned long)(((double)used_disk_space / (double)total_disk_space) * 100.0); | ||
430 | |||
431 | if (check_critical_value && percent_used_disk_space >= critical_value) | ||
432 | result = STATE_CRITICAL; | ||
433 | else if (check_warning_value && percent_used_disk_space >= warning_value) | ||
434 | result = STATE_WARNING; | ||
435 | |||
436 | asprintf(&output_message, _("%lu MB (%lu%%) used on volume %s - total %lu MB|Used space in percent on %s=%lu;%lu;%lu;0;100"), | ||
437 | used_disk_space, percent_used_disk_space, volume_name, total_disk_space, volume_name, percent_used_disk_space, | ||
438 | warning_value, critical_value); | ||
439 | } | ||
456 | 440 | ||
457 | /* check % free space on volume */ | 441 | /* check % free space on volume */ |
458 | } else if (vars_to_check==VPF) { | 442 | } else if (vars_to_check == VPF) { |
459 | 443 | ||
460 | close(sd); | 444 | close(sd); |
461 | my_tcp_connect (server_address, server_port, &sd); | 445 | my_tcp_connect(server_address, server_port, &sd); |
462 | 446 | ||
463 | xasprintf (&send_buffer,"VKF%s\r\n",volume_name); | 447 | xasprintf(&send_buffer, "VKF%s\r\n", volume_name); |
464 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | 448 | result = send_tcp_request(sd, send_buffer, recv_buffer, sizeof(recv_buffer)); |
465 | if (result!=STATE_OK) | 449 | if (result != STATE_OK) |
466 | return result; | 450 | return result; |
467 | 451 | ||
468 | if (!strcmp(recv_buffer,"-1\n")) { | 452 | if (!strcmp(recv_buffer, "-1\n")) { |
469 | 453 | ||
470 | xasprintf (&output_message,_("CRITICAL - Volume '%s' does not exist!"),volume_name); | 454 | xasprintf(&output_message, _("CRITICAL - Volume '%s' does not exist!"), volume_name); |
471 | result=STATE_CRITICAL; | 455 | result = STATE_CRITICAL; |
472 | 456 | ||
473 | } else { | 457 | } else { |
474 | 458 | ||
475 | free_disk_space=strtoul(recv_buffer,NULL,10); | 459 | free_disk_space = strtoul(recv_buffer, NULL, 10); |
476 | 460 | ||
477 | close(sd); | 461 | close(sd); |
478 | my_tcp_connect (server_address, server_port, &sd); | 462 | my_tcp_connect(server_address, server_port, &sd); |
479 | 463 | ||
480 | xasprintf (&send_buffer,"VKS%s\r\n",volume_name); | 464 | xasprintf(&send_buffer, "VKS%s\r\n", volume_name); |
481 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | 465 | result = send_tcp_request(sd, send_buffer, recv_buffer, sizeof(recv_buffer)); |
482 | if (result!=STATE_OK) | 466 | if (result != STATE_OK) |
483 | return result; | 467 | return result; |
484 | total_disk_space=strtoul(recv_buffer,NULL,10); | 468 | total_disk_space = strtoul(recv_buffer, NULL, 10); |
485 | 469 | ||
486 | percent_free_space=(unsigned long)(((double)free_disk_space/(double)total_disk_space)*100.0); | 470 | percent_free_space = (unsigned long)(((double)free_disk_space / (double)total_disk_space) * 100.0); |
487 | 471 | ||
488 | if (check_critical_value && percent_free_space <= critical_value) | 472 | if (check_critical_value && percent_free_space <= critical_value) |
489 | result=STATE_CRITICAL; | 473 | result = STATE_CRITICAL; |
490 | else if (check_warning_value && percent_free_space <= warning_value) | 474 | else if (check_warning_value && percent_free_space <= warning_value) |
491 | result=STATE_WARNING; | 475 | result = STATE_WARNING; |
492 | free_disk_space/=1024; | 476 | free_disk_space /= 1024; |
493 | total_disk_space/=1024; | 477 | total_disk_space /= 1024; |
494 | xasprintf (&output_message,_("%lu MB (%lu%%) free on volume %s - total %lu MB|FreeMB%s=%lu;%lu;%lu;0;100"), | 478 | xasprintf(&output_message, _("%lu MB (%lu%%) free on volume %s - total %lu MB|FreeMB%s=%lu;%lu;%lu;0;100"), free_disk_space, |
495 | free_disk_space, | 479 | percent_free_space, volume_name, total_disk_space, volume_name, percent_free_space, warning_value, critical_value); |
496 | percent_free_space, | ||
497 | volume_name, | ||
498 | total_disk_space, | ||
499 | volume_name, | ||
500 | percent_free_space, | ||
501 | warning_value, | ||
502 | critical_value | ||
503 | ); | ||
504 | } | 480 | } |
505 | 481 | ||
506 | /* check to see if DS Database is open or closed */ | 482 | /* check to see if DS Database is open or closed */ |
507 | } else if (vars_to_check==DSDB) { | 483 | } else if (vars_to_check == DSDB) { |
508 | 484 | ||
509 | close(sd); | 485 | close(sd); |
510 | my_tcp_connect (server_address, server_port, &sd); | 486 | my_tcp_connect(server_address, server_port, &sd); |
511 | 487 | ||
512 | send_buffer = strdup ("S11\r\n"); | 488 | send_buffer = strdup("S11\r\n"); |
513 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | 489 | result = send_tcp_request(sd, send_buffer, recv_buffer, sizeof(recv_buffer)); |
514 | if (result!=STATE_OK) | 490 | if (result != STATE_OK) |
515 | return result; | 491 | return result; |
516 | if (atoi(recv_buffer)==1) | 492 | if (atoi(recv_buffer) == 1) |
517 | result=STATE_OK; | 493 | result = STATE_OK; |
518 | else | 494 | else |
519 | result=STATE_WARNING; | 495 | result = STATE_WARNING; |
520 | 496 | ||
521 | close(sd); | 497 | close(sd); |
522 | my_tcp_connect (server_address, server_port, &sd); | 498 | my_tcp_connect(server_address, server_port, &sd); |
523 | 499 | ||
524 | send_buffer = strdup ("S13\r\n"); | 500 | send_buffer = strdup("S13\r\n"); |
525 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | 501 | result = send_tcp_request(sd, send_buffer, recv_buffer, sizeof(recv_buffer)); |
526 | temp_buffer=strtok(recv_buffer,"\r\n"); | 502 | temp_buffer = strtok(recv_buffer, "\r\n"); |
527 | 503 | ||
528 | xasprintf (&output_message,_("Directory Services Database is %s (DS version %s)"),(result==STATE_OK)?"open":"closed",temp_buffer); | 504 | xasprintf(&output_message, _("Directory Services Database is %s (DS version %s)"), (result == STATE_OK) ? "open" : "closed", |
505 | temp_buffer); | ||
529 | 506 | ||
530 | /* check to see if logins are enabled */ | 507 | /* check to see if logins are enabled */ |
531 | } else if (vars_to_check==LOGINS) { | 508 | } else if (vars_to_check == LOGINS) { |
532 | 509 | ||
533 | close(sd); | 510 | close(sd); |
534 | my_tcp_connect (server_address, server_port, &sd); | 511 | my_tcp_connect(server_address, server_port, &sd); |
535 | 512 | ||
536 | send_buffer = strdup ("S12\r\n"); | 513 | send_buffer = strdup("S12\r\n"); |
537 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | 514 | result = send_tcp_request(sd, send_buffer, recv_buffer, sizeof(recv_buffer)); |
538 | if (result!=STATE_OK) | 515 | if (result != STATE_OK) |
539 | return result; | 516 | return result; |
540 | if (atoi(recv_buffer)==1) | 517 | if (atoi(recv_buffer) == 1) |
541 | result=STATE_OK; | 518 | result = STATE_OK; |
542 | else | 519 | else |
543 | result=STATE_WARNING; | 520 | result = STATE_WARNING; |
544 | |||
545 | xasprintf (&output_message,_("Logins are %s"),(result==STATE_OK)?_("enabled"):_("disabled")); | ||
546 | 521 | ||
522 | xasprintf(&output_message, _("Logins are %s"), (result == STATE_OK) ? _("enabled") : _("disabled")); | ||
547 | 523 | ||
548 | /* check NRM Health Status Summary*/ | 524 | /* check NRM Health Status Summary*/ |
549 | } else if (vars_to_check==NRMH) { | 525 | } else if (vars_to_check == NRMH) { |
550 | 526 | ||
551 | xasprintf (&send_buffer,"NRMH\r\n"); | 527 | xasprintf(&send_buffer, "NRMH\r\n"); |
552 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | 528 | result = send_tcp_request(sd, send_buffer, recv_buffer, sizeof(recv_buffer)); |
553 | if (result!=STATE_OK) | 529 | if (result != STATE_OK) |
554 | return result; | 530 | return result; |
555 | 531 | ||
556 | nrm_health_status=atoi(recv_buffer); | 532 | nrm_health_status = atoi(recv_buffer); |
557 | 533 | ||
558 | if (nrm_health_status==2) { | 534 | if (nrm_health_status == 2) { |
559 | result=STATE_OK; | 535 | result = STATE_OK; |
560 | xasprintf (&output_message,_("CRITICAL - NRM Status is bad!")); | 536 | xasprintf(&output_message, _("CRITICAL - NRM Status is bad!")); |
561 | } | 537 | } else { |
562 | else { | 538 | if (nrm_health_status == 1) { |
563 | if (nrm_health_status==1) { | 539 | result = STATE_WARNING; |
564 | result=STATE_WARNING; | 540 | xasprintf(&output_message, _("Warning - NRM Status is suspect!")); |
565 | xasprintf (&output_message,_("Warning - NRM Status is suspect!")); | ||
566 | } | 541 | } |
567 | 542 | ||
568 | xasprintf (&output_message,_("OK - NRM Status is good!")); | 543 | xasprintf(&output_message, _("OK - NRM Status is good!")); |
569 | } | 544 | } |
570 | 545 | ||
571 | |||
572 | |||
573 | /* check packet receive buffers */ | 546 | /* check packet receive buffers */ |
574 | } else if (vars_to_check==UPRB || vars_to_check==PUPRB) { | 547 | } else if (vars_to_check == UPRB || vars_to_check == PUPRB) { |
575 | 548 | ||
576 | close(sd); | 549 | close(sd); |
577 | my_tcp_connect (server_address, server_port, &sd); | 550 | my_tcp_connect(server_address, server_port, &sd); |
578 | 551 | ||
579 | xasprintf (&send_buffer,"S15\r\n"); | 552 | xasprintf(&send_buffer, "S15\r\n"); |
580 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | 553 | result = send_tcp_request(sd, send_buffer, recv_buffer, sizeof(recv_buffer)); |
581 | if (result!=STATE_OK) | 554 | if (result != STATE_OK) |
582 | return result; | 555 | return result; |
583 | 556 | ||
584 | used_packet_receive_buffers=atoi(recv_buffer); | 557 | used_packet_receive_buffers = atoi(recv_buffer); |
585 | 558 | ||
586 | close(sd); | 559 | close(sd); |
587 | my_tcp_connect (server_address, server_port, &sd); | 560 | my_tcp_connect(server_address, server_port, &sd); |
588 | 561 | ||
589 | xasprintf (&send_buffer,"S16\r\n"); | 562 | xasprintf(&send_buffer, "S16\r\n"); |
590 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | 563 | result = send_tcp_request(sd, send_buffer, recv_buffer, sizeof(recv_buffer)); |
591 | if (result!=STATE_OK) | 564 | if (result != STATE_OK) |
592 | return result; | 565 | return result; |
593 | 566 | ||
594 | max_packet_receive_buffers=atoi(recv_buffer); | 567 | max_packet_receive_buffers = atoi(recv_buffer); |
595 | 568 | ||
596 | percent_used_packet_receive_buffers=(unsigned long)(((double)used_packet_receive_buffers/(double)max_packet_receive_buffers)*100.0); | 569 | percent_used_packet_receive_buffers = |
570 | (unsigned long)(((double)used_packet_receive_buffers / (double)max_packet_receive_buffers) * 100.0); | ||
597 | 571 | ||
598 | if (vars_to_check==UPRB) { | 572 | if (vars_to_check == UPRB) { |
599 | if (check_critical_value && used_packet_receive_buffers >= critical_value) | 573 | if (check_critical_value && used_packet_receive_buffers >= critical_value) |
600 | result=STATE_CRITICAL; | 574 | result = STATE_CRITICAL; |
601 | else if (check_warning_value && used_packet_receive_buffers >= warning_value) | 575 | else if (check_warning_value && used_packet_receive_buffers >= warning_value) |
602 | result=STATE_WARNING; | 576 | result = STATE_WARNING; |
603 | } else { | 577 | } else { |
604 | if (check_critical_value && percent_used_packet_receive_buffers >= critical_value) | 578 | if (check_critical_value && percent_used_packet_receive_buffers >= critical_value) |
605 | result=STATE_CRITICAL; | 579 | result = STATE_CRITICAL; |
606 | else if (check_warning_value && percent_used_packet_receive_buffers >= warning_value) | 580 | else if (check_warning_value && percent_used_packet_receive_buffers >= warning_value) |
607 | result=STATE_WARNING; | 581 | result = STATE_WARNING; |
608 | } | 582 | } |
609 | 583 | ||
610 | xasprintf (&output_message,_("%lu of %lu (%lu%%) packet receive buffers used"),used_packet_receive_buffers,max_packet_receive_buffers,percent_used_packet_receive_buffers); | 584 | xasprintf(&output_message, _("%lu of %lu (%lu%%) packet receive buffers used"), used_packet_receive_buffers, |
585 | max_packet_receive_buffers, percent_used_packet_receive_buffers); | ||
611 | 586 | ||
612 | /* check SAP table entries */ | 587 | /* check SAP table entries */ |
613 | } else if (vars_to_check==SAPENTRIES) { | 588 | } else if (vars_to_check == SAPENTRIES) { |
614 | 589 | ||
615 | close(sd); | 590 | close(sd); |
616 | my_tcp_connect (server_address, server_port, &sd); | 591 | my_tcp_connect(server_address, server_port, &sd); |
617 | 592 | ||
618 | if (sap_number==-1) | 593 | if (sap_number == -1) |
619 | xasprintf (&send_buffer,"S9\r\n"); | 594 | xasprintf(&send_buffer, "S9\r\n"); |
620 | else | 595 | else |
621 | xasprintf (&send_buffer,"S9.%d\r\n",sap_number); | 596 | xasprintf(&send_buffer, "S9.%d\r\n", sap_number); |
622 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | 597 | result = send_tcp_request(sd, send_buffer, recv_buffer, sizeof(recv_buffer)); |
623 | if (result!=STATE_OK) | 598 | if (result != STATE_OK) |
624 | return result; | 599 | return result; |
625 | 600 | ||
626 | sap_entries=atoi(recv_buffer); | 601 | sap_entries = atoi(recv_buffer); |
627 | 602 | ||
628 | if (check_critical_value && sap_entries >= critical_value) | 603 | if (check_critical_value && sap_entries >= critical_value) |
629 | result=STATE_CRITICAL; | 604 | result = STATE_CRITICAL; |
630 | else if (check_warning_value && sap_entries >= warning_value) | 605 | else if (check_warning_value && sap_entries >= warning_value) |
631 | result=STATE_WARNING; | 606 | result = STATE_WARNING; |
632 | 607 | ||
633 | if (sap_number==-1) | 608 | if (sap_number == -1) |
634 | xasprintf (&output_message,_("%lu entries in SAP table"),sap_entries); | 609 | xasprintf(&output_message, _("%lu entries in SAP table"), sap_entries); |
635 | else | 610 | else |
636 | xasprintf (&output_message,_("%lu entries in SAP table for SAP type %d"),sap_entries,sap_number); | 611 | xasprintf(&output_message, _("%lu entries in SAP table for SAP type %d"), sap_entries, sap_number); |
637 | 612 | ||
638 | /* check KB purgeable space on volume */ | 613 | /* check KB purgeable space on volume */ |
639 | } else if (vars_to_check==VKP) { | 614 | } else if (vars_to_check == VKP) { |
640 | 615 | ||
641 | close(sd); | 616 | close(sd); |
642 | my_tcp_connect (server_address, server_port, &sd); | 617 | my_tcp_connect(server_address, server_port, &sd); |
643 | 618 | ||
644 | xasprintf (&send_buffer,"VKP%s\r\n",volume_name); | 619 | xasprintf(&send_buffer, "VKP%s\r\n", volume_name); |
645 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | 620 | result = send_tcp_request(sd, send_buffer, recv_buffer, sizeof(recv_buffer)); |
646 | if (result!=STATE_OK) | 621 | if (result != STATE_OK) |
647 | return result; | 622 | return result; |
648 | 623 | ||
649 | if (!strcmp(recv_buffer,"-1\n")) { | 624 | if (!strcmp(recv_buffer, "-1\n")) { |
650 | xasprintf (&output_message,_("CRITICAL - Volume '%s' does not exist!"),volume_name); | 625 | xasprintf(&output_message, _("CRITICAL - Volume '%s' does not exist!"), volume_name); |
651 | result=STATE_CRITICAL; | 626 | result = STATE_CRITICAL; |
652 | } else { | 627 | } else { |
653 | purgeable_disk_space=strtoul(recv_buffer,NULL,10); | 628 | purgeable_disk_space = strtoul(recv_buffer, NULL, 10); |
654 | if (check_critical_value && purgeable_disk_space >= critical_value) | 629 | if (check_critical_value && purgeable_disk_space >= critical_value) |
655 | result=STATE_CRITICAL; | 630 | result = STATE_CRITICAL; |
656 | else if (check_warning_value && purgeable_disk_space >= warning_value) | 631 | else if (check_warning_value && purgeable_disk_space >= warning_value) |
657 | result=STATE_WARNING; | 632 | result = STATE_WARNING; |
658 | xasprintf (&output_message,_("%s%lu KB purgeable on volume %s|Purge%s=%lu;%lu;%lu;;"), | 633 | xasprintf(&output_message, _("%s%lu KB purgeable on volume %s|Purge%s=%lu;%lu;%lu;;"), (result == STATE_OK) ? "" : _("Only "), |
659 | (result==STATE_OK)?"":_("Only "), | 634 | purgeable_disk_space, volume_name, volume_name, purgeable_disk_space, warning_value, critical_value); |
660 | purgeable_disk_space, | ||
661 | volume_name, | ||
662 | volume_name, | ||
663 | purgeable_disk_space, | ||
664 | warning_value, | ||
665 | critical_value); | ||
666 | } | 635 | } |
667 | /* check MB purgeable space on volume */ | 636 | /* check MB purgeable space on volume */ |
668 | } else if (vars_to_check==VMP) { | 637 | } else if (vars_to_check == VMP) { |
669 | 638 | ||
670 | xasprintf (&send_buffer,"VMP%s\r\n",volume_name); | 639 | xasprintf(&send_buffer, "VMP%s\r\n", volume_name); |
671 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | 640 | result = send_tcp_request(sd, send_buffer, recv_buffer, sizeof(recv_buffer)); |
672 | if (result!=STATE_OK) | 641 | if (result != STATE_OK) |
673 | return result; | 642 | return result; |
674 | 643 | ||
675 | if (!strcmp(recv_buffer,"-1\n")) { | 644 | if (!strcmp(recv_buffer, "-1\n")) { |
676 | xasprintf (&output_message,_("CRITICAL - Volume '%s' does not exist!"),volume_name); | 645 | xasprintf(&output_message, _("CRITICAL - Volume '%s' does not exist!"), volume_name); |
677 | result=STATE_CRITICAL; | 646 | result = STATE_CRITICAL; |
678 | } else { | 647 | } else { |
679 | purgeable_disk_space=strtoul(recv_buffer,NULL,10); | 648 | purgeable_disk_space = strtoul(recv_buffer, NULL, 10); |
680 | if (check_critical_value && purgeable_disk_space >= critical_value) | 649 | if (check_critical_value && purgeable_disk_space >= critical_value) |
681 | result=STATE_CRITICAL; | 650 | result = STATE_CRITICAL; |
682 | else if (check_warning_value && purgeable_disk_space >= warning_value) | 651 | else if (check_warning_value && purgeable_disk_space >= warning_value) |
683 | result=STATE_WARNING; | 652 | result = STATE_WARNING; |
684 | xasprintf (&output_message,_("%s%lu MB purgeable on volume %s|Purge%s=%lu;%lu;%lu;;"), | 653 | xasprintf(&output_message, _("%s%lu MB purgeable on volume %s|Purge%s=%lu;%lu;%lu;;"), (result == STATE_OK) ? "" : _("Only "), |
685 | (result==STATE_OK)?"":_("Only "), | 654 | purgeable_disk_space, volume_name, volume_name, purgeable_disk_space, warning_value, critical_value); |
686 | purgeable_disk_space, | ||
687 | volume_name, | ||
688 | volume_name, | ||
689 | purgeable_disk_space, | ||
690 | warning_value, | ||
691 | critical_value); | ||
692 | } | 655 | } |
693 | 656 | ||
694 | /* check % purgeable space on volume */ | 657 | /* check % purgeable space on volume */ |
695 | } else if (vars_to_check==VPP) { | 658 | } else if (vars_to_check == VPP) { |
696 | 659 | ||
697 | close(sd); | 660 | close(sd); |
698 | my_tcp_connect (server_address, server_port, &sd); | 661 | my_tcp_connect(server_address, server_port, &sd); |
699 | 662 | ||
700 | xasprintf (&send_buffer,"VKP%s\r\n",volume_name); | 663 | xasprintf(&send_buffer, "VKP%s\r\n", volume_name); |
701 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | 664 | result = send_tcp_request(sd, send_buffer, recv_buffer, sizeof(recv_buffer)); |
702 | if (result!=STATE_OK) | 665 | if (result != STATE_OK) |
703 | return result; | 666 | return result; |
704 | 667 | ||
705 | if (!strcmp(recv_buffer,"-1\n")) { | 668 | if (!strcmp(recv_buffer, "-1\n")) { |
706 | 669 | ||
707 | xasprintf (&output_message,_("CRITICAL - Volume '%s' does not exist!"),volume_name); | 670 | xasprintf(&output_message, _("CRITICAL - Volume '%s' does not exist!"), volume_name); |
708 | result=STATE_CRITICAL; | 671 | result = STATE_CRITICAL; |
709 | 672 | ||
710 | } else { | 673 | } else { |
711 | 674 | ||
712 | purgeable_disk_space=strtoul(recv_buffer,NULL,10); | 675 | purgeable_disk_space = strtoul(recv_buffer, NULL, 10); |
713 | 676 | ||
714 | close(sd); | 677 | close(sd); |
715 | my_tcp_connect (server_address, server_port, &sd); | 678 | my_tcp_connect(server_address, server_port, &sd); |
716 | 679 | ||
717 | xasprintf (&send_buffer,"VKS%s\r\n",volume_name); | 680 | xasprintf(&send_buffer, "VKS%s\r\n", volume_name); |
718 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | 681 | result = send_tcp_request(sd, send_buffer, recv_buffer, sizeof(recv_buffer)); |
719 | if (result!=STATE_OK) | 682 | if (result != STATE_OK) |
720 | return result; | 683 | return result; |
721 | total_disk_space=strtoul(recv_buffer,NULL,10); | 684 | total_disk_space = strtoul(recv_buffer, NULL, 10); |
722 | 685 | ||
723 | percent_purgeable_space=(unsigned long)(((double)purgeable_disk_space/(double)total_disk_space)*100.0); | 686 | percent_purgeable_space = (unsigned long)(((double)purgeable_disk_space / (double)total_disk_space) * 100.0); |
724 | 687 | ||
725 | if (check_critical_value && percent_purgeable_space >= critical_value) | 688 | if (check_critical_value && percent_purgeable_space >= critical_value) |
726 | result=STATE_CRITICAL; | 689 | result = STATE_CRITICAL; |
727 | else if (check_warning_value && percent_purgeable_space >= warning_value) | 690 | else if (check_warning_value && percent_purgeable_space >= warning_value) |
728 | result=STATE_WARNING; | 691 | result = STATE_WARNING; |
729 | purgeable_disk_space/=1024; | 692 | purgeable_disk_space /= 1024; |
730 | xasprintf (&output_message,_("%lu MB (%lu%%) purgeable on volume %s|Purgeable%s=%lu;%lu;%lu;0;100"), | 693 | xasprintf(&output_message, _("%lu MB (%lu%%) purgeable on volume %s|Purgeable%s=%lu;%lu;%lu;0;100"), purgeable_disk_space, |
731 | purgeable_disk_space, | 694 | percent_purgeable_space, volume_name, volume_name, percent_purgeable_space, warning_value, critical_value); |
732 | percent_purgeable_space, | ||
733 | volume_name, | ||
734 | volume_name, | ||
735 | percent_purgeable_space, | ||
736 | warning_value, | ||
737 | critical_value | ||
738 | ); | ||
739 | } | 695 | } |
740 | 696 | ||
741 | /* check KB not yet purgeable space on volume */ | 697 | /* check KB not yet purgeable space on volume */ |
742 | } else if (vars_to_check==VKNP) { | 698 | } else if (vars_to_check == VKNP) { |
743 | 699 | ||
744 | close(sd); | 700 | close(sd); |
745 | my_tcp_connect (server_address, server_port, &sd); | 701 | my_tcp_connect(server_address, server_port, &sd); |
746 | 702 | ||
747 | xasprintf (&send_buffer,"VKNP%s\r\n",volume_name); | 703 | xasprintf(&send_buffer, "VKNP%s\r\n", volume_name); |
748 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | 704 | result = send_tcp_request(sd, send_buffer, recv_buffer, sizeof(recv_buffer)); |
749 | if (result!=STATE_OK) | 705 | if (result != STATE_OK) |
750 | return result; | 706 | return result; |
751 | 707 | ||
752 | if (!strcmp(recv_buffer,"-1\n")) { | 708 | if (!strcmp(recv_buffer, "-1\n")) { |
753 | xasprintf (&output_message,_("CRITICAL - Volume '%s' does not exist!"),volume_name); | 709 | xasprintf(&output_message, _("CRITICAL - Volume '%s' does not exist!"), volume_name); |
754 | result=STATE_CRITICAL; | 710 | result = STATE_CRITICAL; |
755 | } else { | 711 | } else { |
756 | non_purgeable_disk_space=strtoul(recv_buffer,NULL,10); | 712 | non_purgeable_disk_space = strtoul(recv_buffer, NULL, 10); |
757 | if (check_critical_value && non_purgeable_disk_space >= critical_value) | 713 | if (check_critical_value && non_purgeable_disk_space >= critical_value) |
758 | result=STATE_CRITICAL; | 714 | result = STATE_CRITICAL; |
759 | else if (check_warning_value && non_purgeable_disk_space >= warning_value) | 715 | else if (check_warning_value && non_purgeable_disk_space >= warning_value) |
760 | result=STATE_WARNING; | 716 | result = STATE_WARNING; |
761 | xasprintf (&output_message,_("%s%lu KB not yet purgeable on volume %s"),(result==STATE_OK)?"":_("Only "),non_purgeable_disk_space,volume_name); | 717 | xasprintf(&output_message, _("%s%lu KB not yet purgeable on volume %s"), (result == STATE_OK) ? "" : _("Only "), |
718 | non_purgeable_disk_space, volume_name); | ||
762 | } | 719 | } |
763 | 720 | ||
764 | /* check % not yet purgeable space on volume */ | 721 | /* check % not yet purgeable space on volume */ |
765 | } else if (vars_to_check==VPNP) { | 722 | } else if (vars_to_check == VPNP) { |
766 | 723 | ||
767 | close(sd); | 724 | close(sd); |
768 | my_tcp_connect (server_address, server_port, &sd); | 725 | my_tcp_connect(server_address, server_port, &sd); |
769 | 726 | ||
770 | xasprintf (&send_buffer,"VKNP%s\r\n",volume_name); | 727 | xasprintf(&send_buffer, "VKNP%s\r\n", volume_name); |
771 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | 728 | result = send_tcp_request(sd, send_buffer, recv_buffer, sizeof(recv_buffer)); |
772 | if (result!=STATE_OK) | 729 | if (result != STATE_OK) |
773 | return result; | 730 | return result; |
774 | 731 | ||
775 | if (!strcmp(recv_buffer,"-1\n")) { | 732 | if (!strcmp(recv_buffer, "-1\n")) { |
776 | 733 | ||
777 | xasprintf (&output_message,_("CRITICAL - Volume '%s' does not exist!"),volume_name); | 734 | xasprintf(&output_message, _("CRITICAL - Volume '%s' does not exist!"), volume_name); |
778 | result=STATE_CRITICAL; | 735 | result = STATE_CRITICAL; |
779 | 736 | ||
780 | } else { | 737 | } else { |
781 | 738 | ||
782 | non_purgeable_disk_space=strtoul(recv_buffer,NULL,10); | 739 | non_purgeable_disk_space = strtoul(recv_buffer, NULL, 10); |
783 | 740 | ||
784 | close(sd); | 741 | close(sd); |
785 | my_tcp_connect (server_address, server_port, &sd); | 742 | my_tcp_connect(server_address, server_port, &sd); |
786 | 743 | ||
787 | xasprintf (&send_buffer,"VKS%s\r\n",volume_name); | 744 | xasprintf(&send_buffer, "VKS%s\r\n", volume_name); |
788 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | 745 | result = send_tcp_request(sd, send_buffer, recv_buffer, sizeof(recv_buffer)); |
789 | if (result!=STATE_OK) | 746 | if (result != STATE_OK) |
790 | return result; | 747 | return result; |
791 | total_disk_space=strtoul(recv_buffer,NULL,10); | 748 | total_disk_space = strtoul(recv_buffer, NULL, 10); |
792 | 749 | ||
793 | percent_non_purgeable_space=(unsigned long)(((double)non_purgeable_disk_space/(double)total_disk_space)*100.0); | 750 | percent_non_purgeable_space = (unsigned long)(((double)non_purgeable_disk_space / (double)total_disk_space) * 100.0); |
794 | 751 | ||
795 | if (check_critical_value && percent_non_purgeable_space >= critical_value) | 752 | if (check_critical_value && percent_non_purgeable_space >= critical_value) |
796 | result=STATE_CRITICAL; | 753 | result = STATE_CRITICAL; |
797 | else if (check_warning_value && percent_non_purgeable_space >= warning_value) | 754 | else if (check_warning_value && percent_non_purgeable_space >= warning_value) |
798 | result=STATE_WARNING; | 755 | result = STATE_WARNING; |
799 | purgeable_disk_space/=1024; | 756 | purgeable_disk_space /= 1024; |
800 | xasprintf (&output_message,_("%lu MB (%lu%%) not yet purgeable on volume %s"),non_purgeable_disk_space,percent_non_purgeable_space,volume_name); | 757 | xasprintf(&output_message, _("%lu MB (%lu%%) not yet purgeable on volume %s"), non_purgeable_disk_space, |
758 | percent_non_purgeable_space, volume_name); | ||
801 | } | 759 | } |
802 | 760 | ||
803 | /* check # of open files */ | 761 | /* check # of open files */ |
804 | } else if (vars_to_check==OFILES) { | 762 | } else if (vars_to_check == OFILES) { |
805 | 763 | ||
806 | close(sd); | 764 | close(sd); |
807 | my_tcp_connect (server_address, server_port, &sd); | 765 | my_tcp_connect(server_address, server_port, &sd); |
808 | 766 | ||
809 | xasprintf (&send_buffer,"S18\r\n"); | 767 | xasprintf(&send_buffer, "S18\r\n"); |
810 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | 768 | result = send_tcp_request(sd, send_buffer, recv_buffer, sizeof(recv_buffer)); |
811 | if (result!=STATE_OK) | 769 | if (result != STATE_OK) |
812 | return result; | 770 | return result; |
813 | 771 | ||
814 | open_files=atoi(recv_buffer); | 772 | open_files = atoi(recv_buffer); |
815 | 773 | ||
816 | if (check_critical_value && open_files >= critical_value) | 774 | if (check_critical_value && open_files >= critical_value) |
817 | result=STATE_CRITICAL; | 775 | result = STATE_CRITICAL; |
818 | else if (check_warning_value && open_files >= warning_value) | 776 | else if (check_warning_value && open_files >= warning_value) |
819 | result=STATE_WARNING; | 777 | result = STATE_WARNING; |
820 | |||
821 | xasprintf (&output_message,_("%lu open files|Openfiles=%lu;%lu;%lu;0,0"), | ||
822 | open_files, | ||
823 | open_files, | ||
824 | warning_value, | ||
825 | critical_value); | ||
826 | 778 | ||
779 | xasprintf(&output_message, _("%lu open files|Openfiles=%lu;%lu;%lu;0,0"), open_files, open_files, warning_value, critical_value); | ||
827 | 780 | ||
828 | /* check # of abended threads (Netware > 5.x only) */ | 781 | /* check # of abended threads (Netware > 5.x only) */ |
829 | } else if (vars_to_check==ABENDS) { | 782 | } else if (vars_to_check == ABENDS) { |
830 | 783 | ||
831 | close(sd); | 784 | close(sd); |
832 | my_tcp_connect (server_address, server_port, &sd); | 785 | my_tcp_connect(server_address, server_port, &sd); |
833 | 786 | ||
834 | xasprintf (&send_buffer,"S17\r\n"); | 787 | xasprintf(&send_buffer, "S17\r\n"); |
835 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | 788 | result = send_tcp_request(sd, send_buffer, recv_buffer, sizeof(recv_buffer)); |
836 | if (result!=STATE_OK) | 789 | if (result != STATE_OK) |
837 | return result; | 790 | return result; |
838 | 791 | ||
839 | abended_threads=atoi(recv_buffer); | 792 | abended_threads = atoi(recv_buffer); |
840 | 793 | ||
841 | if (check_critical_value && abended_threads >= critical_value) | 794 | if (check_critical_value && abended_threads >= critical_value) |
842 | result=STATE_CRITICAL; | 795 | result = STATE_CRITICAL; |
843 | else if (check_warning_value && abended_threads >= warning_value) | 796 | else if (check_warning_value && abended_threads >= warning_value) |
844 | result=STATE_WARNING; | 797 | result = STATE_WARNING; |
845 | 798 | ||
846 | xasprintf (&output_message,_("%lu abended threads|Abends=%lu;%lu;%lu;;"), | 799 | xasprintf(&output_message, _("%lu abended threads|Abends=%lu;%lu;%lu;;"), abended_threads, abended_threads, warning_value, |
847 | abended_threads, | 800 | critical_value); |
848 | abended_threads, | ||
849 | warning_value, | ||
850 | critical_value); | ||
851 | 801 | ||
852 | /* check # of current service processes (Netware 5.x only) */ | 802 | /* check # of current service processes (Netware 5.x only) */ |
853 | } else if (vars_to_check==CSPROCS) { | 803 | } else if (vars_to_check == CSPROCS) { |
854 | 804 | ||
855 | close(sd); | 805 | close(sd); |
856 | my_tcp_connect (server_address, server_port, &sd); | 806 | my_tcp_connect(server_address, server_port, &sd); |
857 | 807 | ||
858 | xasprintf (&send_buffer,"S20\r\n"); | 808 | xasprintf(&send_buffer, "S20\r\n"); |
859 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | 809 | result = send_tcp_request(sd, send_buffer, recv_buffer, sizeof(recv_buffer)); |
860 | if (result!=STATE_OK) | 810 | if (result != STATE_OK) |
861 | return result; | 811 | return result; |
862 | 812 | ||
863 | max_service_processes=atoi(recv_buffer); | 813 | max_service_processes = atoi(recv_buffer); |
864 | 814 | ||
865 | close(sd); | 815 | close(sd); |
866 | my_tcp_connect (server_address, server_port, &sd); | 816 | my_tcp_connect(server_address, server_port, &sd); |
867 | 817 | ||
868 | xasprintf (&send_buffer,"S21\r\n"); | 818 | xasprintf(&send_buffer, "S21\r\n"); |
869 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | 819 | result = send_tcp_request(sd, send_buffer, recv_buffer, sizeof(recv_buffer)); |
870 | if (result!=STATE_OK) | 820 | if (result != STATE_OK) |
871 | return result; | 821 | return result; |
872 | 822 | ||
873 | current_service_processes=atoi(recv_buffer); | 823 | current_service_processes = atoi(recv_buffer); |
874 | 824 | ||
875 | if (check_critical_value && current_service_processes >= critical_value) | 825 | if (check_critical_value && current_service_processes >= critical_value) |
876 | result=STATE_CRITICAL; | 826 | result = STATE_CRITICAL; |
877 | else if (check_warning_value && current_service_processes >= warning_value) | 827 | else if (check_warning_value && current_service_processes >= warning_value) |
878 | result=STATE_WARNING; | 828 | result = STATE_WARNING; |
879 | 829 | ||
880 | xasprintf (&output_message, | 830 | xasprintf(&output_message, _("%lu current service processes (%lu max)|Processes=%lu;%lu;%lu;0;%lu"), current_service_processes, |
881 | _("%lu current service processes (%lu max)|Processes=%lu;%lu;%lu;0;%lu"), | 831 | max_service_processes, current_service_processes, warning_value, critical_value, max_service_processes); |
882 | current_service_processes, | ||
883 | max_service_processes, | ||
884 | current_service_processes, | ||
885 | warning_value, | ||
886 | critical_value, | ||
887 | max_service_processes); | ||
888 | 832 | ||
889 | /* check # Timesync Status */ | 833 | /* check # Timesync Status */ |
890 | } else if (vars_to_check==TSYNC) { | 834 | } else if (vars_to_check == TSYNC) { |
891 | 835 | ||
892 | close(sd); | 836 | close(sd); |
893 | my_tcp_connect (server_address, server_port, &sd); | 837 | my_tcp_connect(server_address, server_port, &sd); |
894 | 838 | ||
895 | xasprintf (&send_buffer,"S22\r\n"); | 839 | xasprintf(&send_buffer, "S22\r\n"); |
896 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | 840 | result = send_tcp_request(sd, send_buffer, recv_buffer, sizeof(recv_buffer)); |
897 | if (result!=STATE_OK) | 841 | if (result != STATE_OK) |
898 | return result; | 842 | return result; |
899 | 843 | ||
900 | time_sync_status=atoi(recv_buffer); | 844 | time_sync_status = atoi(recv_buffer); |
901 | 845 | ||
902 | if (time_sync_status==0) { | 846 | if (time_sync_status == 0) { |
903 | result=STATE_CRITICAL; | 847 | result = STATE_CRITICAL; |
904 | xasprintf (&output_message,_("CRITICAL - Time not in sync with network!")); | 848 | xasprintf(&output_message, _("CRITICAL - Time not in sync with network!")); |
905 | } | 849 | } else { |
906 | else { | 850 | xasprintf(&output_message, _("OK - Time in sync with network!")); |
907 | xasprintf (&output_message,_("OK - Time in sync with network!")); | ||
908 | } | 851 | } |
909 | 852 | ||
910 | |||
911 | |||
912 | |||
913 | |||
914 | /* check LRU sitting time in secondss */ | 853 | /* check LRU sitting time in secondss */ |
915 | } else if (vars_to_check==LRUS) { | 854 | } else if (vars_to_check == LRUS) { |
916 | 855 | ||
917 | close(sd); | 856 | close(sd); |
918 | my_tcp_connect (server_address, server_port, &sd); | 857 | my_tcp_connect(server_address, server_port, &sd); |
919 | 858 | ||
920 | send_buffer = strdup ("S4\r\n"); | 859 | send_buffer = strdup("S4\r\n"); |
921 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | 860 | result = send_tcp_request(sd, send_buffer, recv_buffer, sizeof(recv_buffer)); |
922 | if (result!=STATE_OK) | 861 | if (result != STATE_OK) |
923 | return result; | 862 | return result; |
924 | lru_time=strtoul(recv_buffer,NULL,10); | 863 | lru_time = strtoul(recv_buffer, NULL, 10); |
925 | 864 | ||
926 | if (check_critical_value && lru_time <= critical_value) | 865 | if (check_critical_value && lru_time <= critical_value) |
927 | result=STATE_CRITICAL; | 866 | result = STATE_CRITICAL; |
928 | else if (check_warning_value && lru_time <= warning_value) | 867 | else if (check_warning_value && lru_time <= warning_value) |
929 | result=STATE_WARNING; | 868 | result = STATE_WARNING; |
930 | xasprintf (&output_message,_("LRU sitting time = %lu seconds"),lru_time); | 869 | xasprintf(&output_message, _("LRU sitting time = %lu seconds"), lru_time); |
931 | |||
932 | 870 | ||
933 | /* check % dirty cacheobuffers as a percentage of the total*/ | 871 | /* check % dirty cacheobuffers as a percentage of the total*/ |
934 | } else if (vars_to_check==DCB) { | 872 | } else if (vars_to_check == DCB) { |
935 | 873 | ||
936 | close(sd); | 874 | close(sd); |
937 | my_tcp_connect (server_address, server_port, &sd); | 875 | my_tcp_connect(server_address, server_port, &sd); |
938 | 876 | ||
939 | send_buffer = strdup ("S6\r\n"); | 877 | send_buffer = strdup("S6\r\n"); |
940 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | 878 | result = send_tcp_request(sd, send_buffer, recv_buffer, sizeof(recv_buffer)); |
941 | if (result!=STATE_OK) | 879 | if (result != STATE_OK) |
942 | return result; | 880 | return result; |
943 | dirty_cache_buffers=atoi(recv_buffer); | 881 | dirty_cache_buffers = atoi(recv_buffer); |
944 | 882 | ||
945 | if (check_critical_value && dirty_cache_buffers <= critical_value) | 883 | if (check_critical_value && dirty_cache_buffers <= critical_value) |
946 | result=STATE_CRITICAL; | 884 | result = STATE_CRITICAL; |
947 | else if (check_warning_value && dirty_cache_buffers <= warning_value) | 885 | else if (check_warning_value && dirty_cache_buffers <= warning_value) |
948 | result=STATE_WARNING; | 886 | result = STATE_WARNING; |
949 | xasprintf (&output_message,_("Dirty cache buffers = %lu%% of the total|DCB=%lu;%lu;%lu;0;100"), | 887 | xasprintf(&output_message, _("Dirty cache buffers = %lu%% of the total|DCB=%lu;%lu;%lu;0;100"), dirty_cache_buffers, |
950 | dirty_cache_buffers, | 888 | dirty_cache_buffers, warning_value, critical_value); |
951 | dirty_cache_buffers, | ||
952 | warning_value, | ||
953 | critical_value); | ||
954 | 889 | ||
955 | /* check % total cache buffers as a percentage of the original*/ | 890 | /* check % total cache buffers as a percentage of the original*/ |
956 | } else if (vars_to_check==TCB) { | 891 | } else if (vars_to_check == TCB) { |
957 | 892 | ||
958 | close(sd); | 893 | close(sd); |
959 | my_tcp_connect (server_address, server_port, &sd); | 894 | my_tcp_connect(server_address, server_port, &sd); |
960 | 895 | ||
961 | send_buffer = strdup ("S7\r\n"); | 896 | send_buffer = strdup("S7\r\n"); |
962 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | 897 | result = send_tcp_request(sd, send_buffer, recv_buffer, sizeof(recv_buffer)); |
963 | if (result!=STATE_OK) | 898 | if (result != STATE_OK) |
964 | return result; | 899 | return result; |
965 | total_cache_buffers=atoi(recv_buffer); | 900 | total_cache_buffers = atoi(recv_buffer); |
966 | 901 | ||
967 | if (check_critical_value && total_cache_buffers <= critical_value) | 902 | if (check_critical_value && total_cache_buffers <= critical_value) |
968 | result=STATE_CRITICAL; | 903 | result = STATE_CRITICAL; |
969 | else if (check_warning_value && total_cache_buffers <= warning_value) | 904 | else if (check_warning_value && total_cache_buffers <= warning_value) |
970 | result=STATE_WARNING; | 905 | result = STATE_WARNING; |
971 | xasprintf (&output_message,_("Total cache buffers = %lu%% of the original|TCB=%lu;%lu;%lu;0;100"), | 906 | xasprintf(&output_message, _("Total cache buffers = %lu%% of the original|TCB=%lu;%lu;%lu;0;100"), total_cache_buffers, |
972 | total_cache_buffers, | 907 | total_cache_buffers, warning_value, critical_value); |
973 | total_cache_buffers, | ||
974 | warning_value, | ||
975 | critical_value); | ||
976 | 908 | ||
977 | } else if (vars_to_check==DSVER) { | 909 | } else if (vars_to_check == DSVER) { |
978 | 910 | ||
979 | close(sd); | 911 | close(sd); |
980 | my_tcp_connect (server_address, server_port, &sd); | 912 | my_tcp_connect(server_address, server_port, &sd); |
981 | 913 | ||
982 | xasprintf (&send_buffer,"S13\r\n"); | 914 | xasprintf(&send_buffer, "S13\r\n"); |
983 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | 915 | result = send_tcp_request(sd, send_buffer, recv_buffer, sizeof(recv_buffer)); |
984 | if (result!=STATE_OK) | 916 | if (result != STATE_OK) |
985 | return result; | 917 | return result; |
986 | 918 | ||
987 | recv_buffer[strlen(recv_buffer)-1]=0; | 919 | recv_buffer[strlen(recv_buffer) - 1] = 0; |
988 | 920 | ||
989 | xasprintf (&output_message,_("NDS Version %s"),recv_buffer); | 921 | xasprintf(&output_message, _("NDS Version %s"), recv_buffer); |
990 | 922 | ||
991 | } else if (vars_to_check==UPTIME) { | 923 | } else if (vars_to_check == UPTIME) { |
992 | 924 | ||
993 | close(sd); | 925 | close(sd); |
994 | my_tcp_connect (server_address, server_port, &sd); | 926 | my_tcp_connect(server_address, server_port, &sd); |
995 | |||
996 | xasprintf (&send_buffer,"UPTIME\r\n"); | ||
997 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
998 | if (result!=STATE_OK) | ||
999 | return result; | ||
1000 | 927 | ||
928 | xasprintf(&send_buffer, "UPTIME\r\n"); | ||
929 | result = send_tcp_request(sd, send_buffer, recv_buffer, sizeof(recv_buffer)); | ||
930 | if (result != STATE_OK) | ||
931 | return result; | ||
1001 | 932 | ||
1002 | recv_buffer[sizeof(recv_buffer)-1]=0; | 933 | recv_buffer[sizeof(recv_buffer) - 1] = 0; |
1003 | recv_buffer[strlen(recv_buffer)-1]=0; | 934 | recv_buffer[strlen(recv_buffer) - 1] = 0; |
1004 | 935 | ||
1005 | xasprintf (&output_message,_("Up %s"),recv_buffer); | 936 | xasprintf(&output_message, _("Up %s"), recv_buffer); |
1006 | 937 | ||
1007 | } else if (vars_to_check==NLM) { | 938 | } else if (vars_to_check == NLM) { |
1008 | 939 | ||
1009 | close(sd); | 940 | close(sd); |
1010 | my_tcp_connect (server_address, server_port, &sd); | 941 | my_tcp_connect(server_address, server_port, &sd); |
1011 | 942 | ||
1012 | xasprintf (&send_buffer,"S24:%s\r\n",nlm_name); | 943 | xasprintf(&send_buffer, "S24:%s\r\n", nlm_name); |
1013 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | 944 | result = send_tcp_request(sd, send_buffer, recv_buffer, sizeof(recv_buffer)); |
1014 | if (result!=STATE_OK) | 945 | if (result != STATE_OK) |
1015 | return result; | 946 | return result; |
1016 | 947 | ||
1017 | recv_buffer[strlen(recv_buffer)-1]=0; | 948 | recv_buffer[strlen(recv_buffer) - 1] = 0; |
1018 | if (strcmp(recv_buffer,"-1")) { | 949 | if (strcmp(recv_buffer, "-1")) { |
1019 | xasprintf (&output_message,_("Module %s version %s is loaded"),nlm_name,recv_buffer); | 950 | xasprintf(&output_message, _("Module %s version %s is loaded"), nlm_name, recv_buffer); |
1020 | } else { | 951 | } else { |
1021 | result=STATE_CRITICAL; | 952 | result = STATE_CRITICAL; |
1022 | xasprintf (&output_message,_("Module %s is not loaded"),nlm_name); | 953 | xasprintf(&output_message, _("Module %s is not loaded"), nlm_name); |
1023 | 954 | } | |
1024 | } | 955 | } else if (vars_to_check == NRMP) { |
1025 | } else if (vars_to_check==NRMP) { | ||
1026 | 956 | ||
1027 | xasprintf (&send_buffer,"NRMP:%s\r\n",nrmp_name); | 957 | xasprintf(&send_buffer, "NRMP:%s\r\n", nrmp_name); |
1028 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | 958 | result = send_tcp_request(sd, send_buffer, recv_buffer, sizeof(recv_buffer)); |
1029 | if (result!=STATE_OK) | 959 | if (result != STATE_OK) |
1030 | return result; | 960 | return result; |
1031 | 961 | ||
1032 | if (!strcmp(recv_buffer,"-1\n")) { | 962 | if (!strcmp(recv_buffer, "-1\n")) { |
1033 | xasprintf (&output_message,_("CRITICAL - Value '%s' does not exist!"),nrmp_name); | 963 | xasprintf(&output_message, _("CRITICAL - Value '%s' does not exist!"), nrmp_name); |
1034 | result=STATE_CRITICAL; | 964 | result = STATE_CRITICAL; |
1035 | } else { | 965 | } else { |
1036 | nrmp_value=strtoul(recv_buffer,NULL,10); | 966 | nrmp_value = strtoul(recv_buffer, NULL, 10); |
1037 | if (check_critical_value && nrmp_value <= critical_value) | 967 | if (check_critical_value && nrmp_value <= critical_value) |
1038 | result=STATE_CRITICAL; | 968 | result = STATE_CRITICAL; |
1039 | else if (check_warning_value && nrmp_value <= warning_value) | 969 | else if (check_warning_value && nrmp_value <= warning_value) |
1040 | result=STATE_WARNING; | 970 | result = STATE_WARNING; |
1041 | xasprintf (&output_message, | 971 | xasprintf(&output_message, _("%s is %lu|%s=%lu;%lu;%lu;;"), nrmp_name, nrmp_value, nrmp_name, nrmp_value, warning_value, |
1042 | _("%s is %lu|%s=%lu;%lu;%lu;;"), | 972 | critical_value); |
1043 | nrmp_name, | ||
1044 | nrmp_value, | ||
1045 | nrmp_name, | ||
1046 | nrmp_value, | ||
1047 | warning_value, | ||
1048 | critical_value); | ||
1049 | } | 973 | } |
1050 | 974 | ||
1051 | } else if (vars_to_check==NRMM) { | 975 | } else if (vars_to_check == NRMM) { |
1052 | 976 | ||
1053 | xasprintf (&send_buffer,"NRMM:%s\r\n",nrmm_name); | 977 | xasprintf(&send_buffer, "NRMM:%s\r\n", nrmm_name); |
1054 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | 978 | result = send_tcp_request(sd, send_buffer, recv_buffer, sizeof(recv_buffer)); |
1055 | if (result!=STATE_OK) | 979 | if (result != STATE_OK) |
1056 | return result; | 980 | return result; |
1057 | 981 | ||
1058 | if (!strcmp(recv_buffer,"-1\n")) { | 982 | if (!strcmp(recv_buffer, "-1\n")) { |
1059 | xasprintf (&output_message,_("CRITICAL - Value '%s' does not exist!"),nrmm_name); | 983 | xasprintf(&output_message, _("CRITICAL - Value '%s' does not exist!"), nrmm_name); |
1060 | result=STATE_CRITICAL; | 984 | result = STATE_CRITICAL; |
1061 | } else { | 985 | } else { |
1062 | nrmm_value=strtoul(recv_buffer,NULL,10); | 986 | nrmm_value = strtoul(recv_buffer, NULL, 10); |
1063 | if (check_critical_value && nrmm_value <= critical_value) | 987 | if (check_critical_value && nrmm_value <= critical_value) |
1064 | result=STATE_CRITICAL; | 988 | result = STATE_CRITICAL; |
1065 | else if (check_warning_value && nrmm_value <= warning_value) | 989 | else if (check_warning_value && nrmm_value <= warning_value) |
1066 | result=STATE_WARNING; | 990 | result = STATE_WARNING; |
1067 | xasprintf (&output_message, | 991 | xasprintf(&output_message, _("%s is %lu|%s=%lu;%lu;%lu;;"), nrmm_name, nrmm_value, nrmm_name, nrmm_value, warning_value, |
1068 | _("%s is %lu|%s=%lu;%lu;%lu;;"), | 992 | critical_value); |
1069 | nrmm_name, | ||
1070 | nrmm_value, | ||
1071 | nrmm_name, | ||
1072 | nrmm_value, | ||
1073 | warning_value, | ||
1074 | critical_value); | ||
1075 | } | 993 | } |
1076 | 994 | ||
1077 | } else if (vars_to_check==NRMS) { | 995 | } else if (vars_to_check == NRMS) { |
1078 | 996 | ||
1079 | xasprintf (&send_buffer,"NRMS:%s\r\n",nrms_name); | 997 | xasprintf(&send_buffer, "NRMS:%s\r\n", nrms_name); |
1080 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | 998 | result = send_tcp_request(sd, send_buffer, recv_buffer, sizeof(recv_buffer)); |
1081 | if (result!=STATE_OK) | 999 | if (result != STATE_OK) |
1082 | return result; | 1000 | return result; |
1083 | 1001 | ||
1084 | if (!strcmp(recv_buffer,"-1\n")) { | 1002 | if (!strcmp(recv_buffer, "-1\n")) { |
1085 | xasprintf (&output_message,_("CRITICAL - Value '%s' does not exist!"),nrms_name); | 1003 | xasprintf(&output_message, _("CRITICAL - Value '%s' does not exist!"), nrms_name); |
1086 | result=STATE_CRITICAL; | 1004 | result = STATE_CRITICAL; |
1087 | } else { | 1005 | } else { |
1088 | nrms_value=strtoul(recv_buffer,NULL,10); | 1006 | nrms_value = strtoul(recv_buffer, NULL, 10); |
1089 | if (check_critical_value && nrms_value >= critical_value) | 1007 | if (check_critical_value && nrms_value >= critical_value) |
1090 | result=STATE_CRITICAL; | 1008 | result = STATE_CRITICAL; |
1091 | else if (check_warning_value && nrms_value >= warning_value) | 1009 | else if (check_warning_value && nrms_value >= warning_value) |
1092 | result=STATE_WARNING; | 1010 | result = STATE_WARNING; |
1093 | xasprintf (&output_message, | 1011 | xasprintf(&output_message, _("%s is %lu|%s=%lu;%lu;%lu;;"), nrms_name, nrms_value, nrms_name, nrms_value, warning_value, |
1094 | _("%s is %lu|%s=%lu;%lu;%lu;;"), | 1012 | critical_value); |
1095 | nrms_name, | ||
1096 | nrms_value, | ||
1097 | nrms_name, | ||
1098 | nrms_value, | ||
1099 | warning_value, | ||
1100 | critical_value); | ||
1101 | } | 1013 | } |
1102 | 1014 | ||
1103 | } else if (vars_to_check==NSS1) { | 1015 | } else if (vars_to_check == NSS1) { |
1104 | 1016 | ||
1105 | xasprintf (&send_buffer,"NSS1:%s\r\n",nss1_name); | 1017 | xasprintf(&send_buffer, "NSS1:%s\r\n", nss1_name); |
1106 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | 1018 | result = send_tcp_request(sd, send_buffer, recv_buffer, sizeof(recv_buffer)); |
1107 | if (result!=STATE_OK) | 1019 | if (result != STATE_OK) |
1108 | return result; | 1020 | return result; |
1109 | 1021 | ||
1110 | if (!strcmp(recv_buffer,"-1\n")) { | 1022 | if (!strcmp(recv_buffer, "-1\n")) { |
1111 | xasprintf (&output_message,_("CRITICAL - Value '%s' does not exist!"),nss1_name); | 1023 | xasprintf(&output_message, _("CRITICAL - Value '%s' does not exist!"), nss1_name); |
1112 | result=STATE_CRITICAL; | 1024 | result = STATE_CRITICAL; |
1113 | } else { | 1025 | } else { |
1114 | nss1_value=strtoul(recv_buffer,NULL,10); | 1026 | nss1_value = strtoul(recv_buffer, NULL, 10); |
1115 | if (check_critical_value && nss1_value >= critical_value) | 1027 | if (check_critical_value && nss1_value >= critical_value) |
1116 | result=STATE_CRITICAL; | 1028 | result = STATE_CRITICAL; |
1117 | else if (check_warning_value && nss1_value >= warning_value) | 1029 | else if (check_warning_value && nss1_value >= warning_value) |
1118 | result=STATE_WARNING; | 1030 | result = STATE_WARNING; |
1119 | xasprintf (&output_message, | 1031 | xasprintf(&output_message, _("%s is %lu|%s=%lu;%lu;%lu;;"), nss1_name, nss1_value, nss1_name, nss1_value, warning_value, |
1120 | _("%s is %lu|%s=%lu;%lu;%lu;;"), | 1032 | critical_value); |
1121 | nss1_name, | ||
1122 | nss1_value, | ||
1123 | nss1_name, | ||
1124 | nss1_value, | ||
1125 | warning_value, | ||
1126 | critical_value); | ||
1127 | } | 1033 | } |
1128 | 1034 | ||
1129 | } else if (vars_to_check==NSS2) { | 1035 | } else if (vars_to_check == NSS2) { |
1130 | 1036 | ||
1131 | xasprintf (&send_buffer,"NSS2:%s\r\n",nss2_name); | 1037 | xasprintf(&send_buffer, "NSS2:%s\r\n", nss2_name); |
1132 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | 1038 | result = send_tcp_request(sd, send_buffer, recv_buffer, sizeof(recv_buffer)); |
1133 | if (result!=STATE_OK) | 1039 | if (result != STATE_OK) |
1134 | return result; | 1040 | return result; |
1135 | 1041 | ||
1136 | if (!strcmp(recv_buffer,"-1\n")) { | 1042 | if (!strcmp(recv_buffer, "-1\n")) { |
1137 | xasprintf (&output_message,_("CRITICAL - Value '%s' does not exist!"),nss2_name); | 1043 | xasprintf(&output_message, _("CRITICAL - Value '%s' does not exist!"), nss2_name); |
1138 | result=STATE_CRITICAL; | 1044 | result = STATE_CRITICAL; |
1139 | } else { | 1045 | } else { |
1140 | nss2_value=strtoul(recv_buffer,NULL,10); | 1046 | nss2_value = strtoul(recv_buffer, NULL, 10); |
1141 | if (check_critical_value && nss2_value >= critical_value) | 1047 | if (check_critical_value && nss2_value >= critical_value) |
1142 | result=STATE_CRITICAL; | 1048 | result = STATE_CRITICAL; |
1143 | else if (check_warning_value && nss2_value >= warning_value) | 1049 | else if (check_warning_value && nss2_value >= warning_value) |
1144 | result=STATE_WARNING; | 1050 | result = STATE_WARNING; |
1145 | xasprintf (&output_message, | 1051 | xasprintf(&output_message, _("%s is %lu|%s=%lu;%lu;%lu;;"), nss2_name, nss2_value, nss2_name, nss2_value, warning_value, |
1146 | _("%s is %lu|%s=%lu;%lu;%lu;;"), | 1052 | critical_value); |
1147 | nss2_name, | ||
1148 | nss2_value, | ||
1149 | nss2_name, | ||
1150 | nss2_value, | ||
1151 | warning_value, | ||
1152 | critical_value); | ||
1153 | } | 1053 | } |
1154 | 1054 | ||
1155 | } else if (vars_to_check==NSS3) { | 1055 | } else if (vars_to_check == NSS3) { |
1156 | 1056 | ||
1157 | xasprintf (&send_buffer,"NSS3:%s\r\n",nss3_name); | 1057 | xasprintf(&send_buffer, "NSS3:%s\r\n", nss3_name); |
1158 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | 1058 | result = send_tcp_request(sd, send_buffer, recv_buffer, sizeof(recv_buffer)); |
1159 | if (result!=STATE_OK) | 1059 | if (result != STATE_OK) |
1160 | return result; | 1060 | return result; |
1161 | 1061 | ||
1162 | if (!strcmp(recv_buffer,"-1\n")) { | 1062 | if (!strcmp(recv_buffer, "-1\n")) { |
1163 | xasprintf (&output_message,_("CRITICAL - Value '%s' does not exist!"),nss3_name); | 1063 | xasprintf(&output_message, _("CRITICAL - Value '%s' does not exist!"), nss3_name); |
1164 | result=STATE_CRITICAL; | 1064 | result = STATE_CRITICAL; |
1165 | } else { | 1065 | } else { |
1166 | nss3_value=strtoul(recv_buffer,NULL,10); | 1066 | nss3_value = strtoul(recv_buffer, NULL, 10); |
1167 | if (check_critical_value && nss3_value >= critical_value) | 1067 | if (check_critical_value && nss3_value >= critical_value) |
1168 | result=STATE_CRITICAL; | 1068 | result = STATE_CRITICAL; |
1169 | else if (check_warning_value && nss3_value >= warning_value) | 1069 | else if (check_warning_value && nss3_value >= warning_value) |
1170 | result=STATE_WARNING; | 1070 | result = STATE_WARNING; |
1171 | xasprintf (&output_message, | 1071 | xasprintf(&output_message, _("%s is %lu|%s=%lu;%lu;%lu;;"), nss3_name, nss3_value, nss3_name, nss3_value, warning_value, |
1172 | _("%s is %lu|%s=%lu;%lu;%lu;;"), | 1072 | critical_value); |
1173 | nss3_name, | ||
1174 | nss3_value, | ||
1175 | nss3_name, | ||
1176 | nss3_value, | ||
1177 | warning_value, | ||
1178 | critical_value); | ||
1179 | } | 1073 | } |
1180 | 1074 | ||
1181 | } else if (vars_to_check==NSS4) { | 1075 | } else if (vars_to_check == NSS4) { |
1182 | 1076 | ||
1183 | xasprintf (&send_buffer,"NSS4:%s\r\n",nss4_name); | 1077 | xasprintf(&send_buffer, "NSS4:%s\r\n", nss4_name); |
1184 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | 1078 | result = send_tcp_request(sd, send_buffer, recv_buffer, sizeof(recv_buffer)); |
1185 | if (result!=STATE_OK) | 1079 | if (result != STATE_OK) |
1186 | return result; | 1080 | return result; |
1187 | 1081 | ||
1188 | if (!strcmp(recv_buffer,"-1\n")) { | 1082 | if (!strcmp(recv_buffer, "-1\n")) { |
1189 | xasprintf (&output_message,_("CRITICAL - Value '%s' does not exist!"),nss4_name); | 1083 | xasprintf(&output_message, _("CRITICAL - Value '%s' does not exist!"), nss4_name); |
1190 | result=STATE_CRITICAL; | 1084 | result = STATE_CRITICAL; |
1191 | } else { | 1085 | } else { |
1192 | nss4_value=strtoul(recv_buffer,NULL,10); | 1086 | nss4_value = strtoul(recv_buffer, NULL, 10); |
1193 | if (check_critical_value && nss4_value >= critical_value) | 1087 | if (check_critical_value && nss4_value >= critical_value) |
1194 | result=STATE_CRITICAL; | 1088 | result = STATE_CRITICAL; |
1195 | else if (check_warning_value && nss4_value >= warning_value) | 1089 | else if (check_warning_value && nss4_value >= warning_value) |
1196 | result=STATE_WARNING; | 1090 | result = STATE_WARNING; |
1197 | xasprintf (&output_message, | 1091 | xasprintf(&output_message, _("%s is %lu|%s=%lu;%lu;%lu;;"), nss4_name, nss4_value, nss4_name, nss4_value, warning_value, |
1198 | _("%s is %lu|%s=%lu;%lu;%lu;;"), | 1092 | critical_value); |
1199 | nss4_name, | ||
1200 | nss4_value, | ||
1201 | nss4_name, | ||
1202 | nss4_value, | ||
1203 | warning_value, | ||
1204 | critical_value); | ||
1205 | } | 1093 | } |
1206 | 1094 | ||
1207 | } else if (vars_to_check==NSS5) { | 1095 | } else if (vars_to_check == NSS5) { |
1208 | 1096 | ||
1209 | xasprintf (&send_buffer,"NSS5:%s\r\n",nss5_name); | 1097 | xasprintf(&send_buffer, "NSS5:%s\r\n", nss5_name); |
1210 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | 1098 | result = send_tcp_request(sd, send_buffer, recv_buffer, sizeof(recv_buffer)); |
1211 | if (result!=STATE_OK) | 1099 | if (result != STATE_OK) |
1212 | return result; | 1100 | return result; |
1213 | 1101 | ||
1214 | if (!strcmp(recv_buffer,"-1\n")) { | 1102 | if (!strcmp(recv_buffer, "-1\n")) { |
1215 | xasprintf (&output_message,_("CRITICAL - Value '%s' does not exist!"),nss5_name); | 1103 | xasprintf(&output_message, _("CRITICAL - Value '%s' does not exist!"), nss5_name); |
1216 | result=STATE_CRITICAL; | 1104 | result = STATE_CRITICAL; |
1217 | } else { | 1105 | } else { |
1218 | nss5_value=strtoul(recv_buffer,NULL,10); | 1106 | nss5_value = strtoul(recv_buffer, NULL, 10); |
1219 | if (check_critical_value && nss5_value >= critical_value) | 1107 | if (check_critical_value && nss5_value >= critical_value) |
1220 | result=STATE_CRITICAL; | 1108 | result = STATE_CRITICAL; |
1221 | else if (check_warning_value && nss5_value >= warning_value) | 1109 | else if (check_warning_value && nss5_value >= warning_value) |
1222 | result=STATE_WARNING; | 1110 | result = STATE_WARNING; |
1223 | xasprintf (&output_message, | 1111 | xasprintf(&output_message, _("%s is %lu|%s=%lu;%lu;%lu;;"), nss5_name, nss5_value, nss5_name, nss5_value, warning_value, |
1224 | _("%s is %lu|%s=%lu;%lu;%lu;;"), | 1112 | critical_value); |
1225 | nss5_name, | ||
1226 | nss5_value, | ||
1227 | nss5_name, | ||
1228 | nss5_value, | ||
1229 | warning_value, | ||
1230 | critical_value); | ||
1231 | } | 1113 | } |
1232 | 1114 | ||
1233 | } else if (vars_to_check==NSS6) { | 1115 | } else if (vars_to_check == NSS6) { |
1234 | 1116 | ||
1235 | xasprintf (&send_buffer,"NSS6:%s\r\n",nss6_name); | 1117 | xasprintf(&send_buffer, "NSS6:%s\r\n", nss6_name); |
1236 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | 1118 | result = send_tcp_request(sd, send_buffer, recv_buffer, sizeof(recv_buffer)); |
1237 | if (result!=STATE_OK) | 1119 | if (result != STATE_OK) |
1238 | return result; | 1120 | return result; |
1239 | 1121 | ||
1240 | if (!strcmp(recv_buffer,"-1\n")) { | 1122 | if (!strcmp(recv_buffer, "-1\n")) { |
1241 | xasprintf (&output_message,_("CRITICAL - Value '%s' does not exist!"),nss6_name); | 1123 | xasprintf(&output_message, _("CRITICAL - Value '%s' does not exist!"), nss6_name); |
1242 | result=STATE_CRITICAL; | 1124 | result = STATE_CRITICAL; |
1243 | } else { | 1125 | } else { |
1244 | nss6_value=strtoul(recv_buffer,NULL,10); | 1126 | nss6_value = strtoul(recv_buffer, NULL, 10); |
1245 | if (check_critical_value && nss6_value >= critical_value) | 1127 | if (check_critical_value && nss6_value >= critical_value) |
1246 | result=STATE_CRITICAL; | 1128 | result = STATE_CRITICAL; |
1247 | else if (check_warning_value && nss6_value >= warning_value) | 1129 | else if (check_warning_value && nss6_value >= warning_value) |
1248 | result=STATE_WARNING; | 1130 | result = STATE_WARNING; |
1249 | xasprintf (&output_message, | 1131 | xasprintf(&output_message, _("%s is %lu|%s=%lu;%lu;%lu;;"), nss6_name, nss6_value, nss6_name, nss6_value, warning_value, |
1250 | _("%s is %lu|%s=%lu;%lu;%lu;;"), | 1132 | critical_value); |
1251 | nss6_name, | ||
1252 | nss6_value, | ||
1253 | nss6_name, | ||
1254 | nss6_value, | ||
1255 | warning_value, | ||
1256 | critical_value); | ||
1257 | } | 1133 | } |
1258 | 1134 | ||
1259 | } else if (vars_to_check==NSS7) { | 1135 | } else if (vars_to_check == NSS7) { |
1260 | 1136 | ||
1261 | xasprintf (&send_buffer,"NSS7:%s\r\n",nss7_name); | 1137 | xasprintf(&send_buffer, "NSS7:%s\r\n", nss7_name); |
1262 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | 1138 | result = send_tcp_request(sd, send_buffer, recv_buffer, sizeof(recv_buffer)); |
1263 | if (result!=STATE_OK) | 1139 | if (result != STATE_OK) |
1264 | return result; | 1140 | return result; |
1265 | 1141 | ||
1266 | if (!strcmp(recv_buffer,"-1\n")) { | 1142 | if (!strcmp(recv_buffer, "-1\n")) { |
1267 | xasprintf (&output_message,_("CRITICAL - Value '%s' does not exist!"),nss7_name); | 1143 | xasprintf(&output_message, _("CRITICAL - Value '%s' does not exist!"), nss7_name); |
1268 | result=STATE_CRITICAL; | 1144 | result = STATE_CRITICAL; |
1269 | } else { | 1145 | } else { |
1270 | nss7_value=strtoul(recv_buffer,NULL,10); | 1146 | nss7_value = strtoul(recv_buffer, NULL, 10); |
1271 | if (check_critical_value && nss7_value >= critical_value) | 1147 | if (check_critical_value && nss7_value >= critical_value) |
1272 | result=STATE_CRITICAL; | 1148 | result = STATE_CRITICAL; |
1273 | else if (check_warning_value && nss7_value >= warning_value) | 1149 | else if (check_warning_value && nss7_value >= warning_value) |
1274 | result=STATE_WARNING; | 1150 | result = STATE_WARNING; |
1275 | xasprintf (&output_message, | 1151 | xasprintf(&output_message, _("%s is %lu|%s=%lu;%lu;%lu;;"), nss7_name, nss7_value, nss7_name, nss7_value, warning_value, |
1276 | _("%s is %lu|%s=%lu;%lu;%lu;;"), | 1152 | critical_value); |
1277 | nss7_name, | ||
1278 | nss7_value, | ||
1279 | nss7_name, | ||
1280 | nss7_value, | ||
1281 | warning_value, | ||
1282 | critical_value); | ||
1283 | } | 1153 | } |
1284 | 1154 | ||
1155 | } else { | ||
1285 | 1156 | ||
1286 | } | 1157 | output_message = strdup(_("Nothing to check!\n")); |
1287 | else { | 1158 | result = STATE_UNKNOWN; |
1288 | |||
1289 | output_message = strdup (_("Nothing to check!\n")); | ||
1290 | result=STATE_UNKNOWN; | ||
1291 | |||
1292 | } | 1159 | } |
1293 | 1160 | ||
1294 | close (sd); | 1161 | close(sd); |
1295 | 1162 | ||
1296 | /* reset timeout */ | 1163 | /* reset timeout */ |
1297 | alarm(0); | 1164 | alarm(0); |
1298 | 1165 | ||
1299 | printf("%s%s\n",netware_version,output_message); | 1166 | printf("%s%s\n", netware_version, output_message); |
1300 | 1167 | ||
1301 | return result; | 1168 | return result; |
1302 | } | 1169 | } |
1303 | 1170 | ||
1304 | |||
1305 | |||
1306 | /* process command-line arguments */ | 1171 | /* process command-line arguments */ |
1307 | int process_arguments(int argc, char **argv) { | 1172 | int process_arguments(int argc, char **argv) { |
1308 | int c; | 1173 | int c; |
1309 | 1174 | ||
1310 | int option = 0; | 1175 | int option = 0; |
1311 | static struct option longopts[] = | 1176 | static struct option longopts[] = {{"port", required_argument, 0, 'p'}, {"timeout", required_argument, 0, 't'}, |
1312 | { | 1177 | {"critical", required_argument, 0, 'c'}, {"warning", required_argument, 0, 'w'}, |
1313 | {"port", required_argument,0,'p'}, | 1178 | {"variable", required_argument, 0, 'v'}, {"hostname", required_argument, 0, 'H'}, |
1314 | {"timeout", required_argument,0,'t'}, | 1179 | {"osversion", no_argument, 0, 'o'}, {"version", no_argument, 0, 'V'}, |
1315 | {"critical", required_argument,0,'c'}, | 1180 | {"help", no_argument, 0, 'h'}, {0, 0, 0, 0}}; |
1316 | {"warning", required_argument,0,'w'}, | ||
1317 | {"variable", required_argument,0,'v'}, | ||
1318 | {"hostname", required_argument,0,'H'}, | ||
1319 | {"osversion",no_argument, 0,'o'}, | ||
1320 | {"version", no_argument, 0,'V'}, | ||
1321 | {"help", no_argument, 0,'h'}, | ||
1322 | {0,0,0,0} | ||
1323 | }; | ||
1324 | 1181 | ||
1325 | /* no options were supplied */ | 1182 | /* no options were supplied */ |
1326 | if (argc<2) return ERROR; | 1183 | if (argc < 2) |
1184 | return ERROR; | ||
1327 | 1185 | ||
1328 | /* backwards compatibility */ | 1186 | /* backwards compatibility */ |
1329 | if (! is_option(argv[1])) { | 1187 | if (!is_option(argv[1])) { |
1330 | server_address=argv[1]; | 1188 | server_address = argv[1]; |
1331 | argv[1]=argv[0]; | 1189 | argv[1] = argv[0]; |
1332 | argv=&argv[1]; | 1190 | argv = &argv[1]; |
1333 | argc--; | 1191 | argc--; |
1334 | } | 1192 | } |
1335 | 1193 | ||
1336 | for (c=1;c<argc;c++) { | 1194 | for (c = 1; c < argc; c++) { |
1337 | if (strcmp("-to",argv[c])==0) | 1195 | if (strcmp("-to", argv[c]) == 0) |
1338 | strcpy(argv[c],"-t"); | 1196 | strcpy(argv[c], "-t"); |
1339 | else if (strcmp("-wv",argv[c])==0) | 1197 | else if (strcmp("-wv", argv[c]) == 0) |
1340 | strcpy(argv[c],"-w"); | 1198 | strcpy(argv[c], "-w"); |
1341 | else if (strcmp("-cv",argv[c])==0) | 1199 | else if (strcmp("-cv", argv[c]) == 0) |
1342 | strcpy(argv[c],"-c"); | 1200 | strcpy(argv[c], "-c"); |
1343 | } | 1201 | } |
1344 | 1202 | ||
1345 | while (1) { | 1203 | while (1) { |
1346 | c = getopt_long(argc,argv,"+hoVH:t:c:w:p:v:",longopts,&option); | 1204 | c = getopt_long(argc, argv, "+hoVH:t:c:w:p:v:", longopts, &option); |
1347 | 1205 | ||
1348 | if (c==-1||c==EOF||c==1) | 1206 | if (c == -1 || c == EOF || c == 1) |
1349 | break; | 1207 | break; |
1350 | 1208 | ||
1351 | switch (c) | 1209 | switch (c) { |
1352 | { | 1210 | case '?': /* print short usage statement if args not parsable */ |
1353 | case '?': /* print short usage statement if args not parsable */ | 1211 | usage5(); |
1354 | usage5 (); | 1212 | case 'h': /* help */ |
1355 | case 'h': /* help */ | 1213 | print_help(); |
1356 | print_help(); | 1214 | exit(STATE_UNKNOWN); |
1357 | exit(STATE_UNKNOWN); | 1215 | case 'V': /* version */ |
1358 | case 'V': /* version */ | 1216 | print_revision(progname, NP_VERSION); |
1359 | print_revision(progname, NP_VERSION); | 1217 | exit(STATE_UNKNOWN); |
1360 | exit(STATE_UNKNOWN); | 1218 | case 'H': /* hostname */ |
1361 | case 'H': /* hostname */ | 1219 | server_address = optarg; |
1362 | server_address=optarg; | 1220 | break; |
1363 | break; | 1221 | case 'o': /* display nos version */ |
1364 | case 'o': /* display nos version */ | 1222 | check_netware_version = true; |
1365 | check_netware_version = true; | 1223 | break; |
1366 | break; | 1224 | case 'p': /* port */ |
1367 | case 'p': /* port */ | 1225 | if (is_intnonneg(optarg)) |
1368 | if (is_intnonneg(optarg)) | 1226 | server_port = atoi(optarg); |
1369 | server_port=atoi(optarg); | 1227 | else |
1228 | die(STATE_UNKNOWN, _("Server port an integer\n")); | ||
1229 | break; | ||
1230 | case 'v': | ||
1231 | if (strlen(optarg) < 3) | ||
1232 | return ERROR; | ||
1233 | if (!strcmp(optarg, "LOAD1")) | ||
1234 | vars_to_check = LOAD1; | ||
1235 | else if (!strcmp(optarg, "LOAD5")) | ||
1236 | vars_to_check = LOAD5; | ||
1237 | else if (!strcmp(optarg, "LOAD15")) | ||
1238 | vars_to_check = LOAD15; | ||
1239 | else if (!strcmp(optarg, "CONNS")) | ||
1240 | vars_to_check = CONNS; | ||
1241 | else if (!strcmp(optarg, "LTCH")) | ||
1242 | vars_to_check = LTCH; | ||
1243 | else if (!strcmp(optarg, "DCB")) | ||
1244 | vars_to_check = DCB; | ||
1245 | else if (!strcmp(optarg, "TCB")) | ||
1246 | vars_to_check = TCB; | ||
1247 | else if (!strcmp(optarg, "CBUFF")) | ||
1248 | vars_to_check = CBUFF; | ||
1249 | else if (!strcmp(optarg, "CDBUFF")) | ||
1250 | vars_to_check = CDBUFF; | ||
1251 | else if (!strcmp(optarg, "LRUM")) | ||
1252 | vars_to_check = LRUM; | ||
1253 | else if (!strcmp(optarg, "LRUS")) | ||
1254 | vars_to_check = LRUS; | ||
1255 | else if (strncmp(optarg, "VPF", 3) == 0) { | ||
1256 | vars_to_check = VPF; | ||
1257 | volume_name = strdup(optarg + 3); | ||
1258 | if (!strcmp(volume_name, "")) | ||
1259 | volume_name = strdup("SYS"); | ||
1260 | } else if (strncmp(optarg, "VKF", 3) == 0) { | ||
1261 | vars_to_check = VKF; | ||
1262 | volume_name = strdup(optarg + 3); | ||
1263 | if (!strcmp(volume_name, "")) | ||
1264 | volume_name = strdup("SYS"); | ||
1265 | } else if (strncmp(optarg, "VMF", 3) == 0) { | ||
1266 | vars_to_check = VMF; | ||
1267 | volume_name = strdup(optarg + 3); | ||
1268 | if (!strcmp(volume_name, "")) | ||
1269 | volume_name = strdup("SYS"); | ||
1270 | } else if (!strcmp(optarg, "DSDB")) | ||
1271 | vars_to_check = DSDB; | ||
1272 | else if (!strcmp(optarg, "LOGINS")) | ||
1273 | vars_to_check = LOGINS; | ||
1274 | else if (!strcmp(optarg, "NRMH")) | ||
1275 | vars_to_check = NRMH; | ||
1276 | else if (!strcmp(optarg, "UPRB")) | ||
1277 | vars_to_check = UPRB; | ||
1278 | else if (!strcmp(optarg, "PUPRB")) | ||
1279 | vars_to_check = PUPRB; | ||
1280 | else if (!strncmp(optarg, "SAPENTRIES", 10)) { | ||
1281 | vars_to_check = SAPENTRIES; | ||
1282 | if (strlen(optarg) > 10) | ||
1283 | sap_number = atoi(optarg + 10); | ||
1370 | else | 1284 | else |
1371 | die(STATE_UNKNOWN,_("Server port an integer\n")); | 1285 | sap_number = -1; |
1372 | break; | 1286 | } else if (!strcmp(optarg, "OFILES")) |
1373 | case 'v': | 1287 | vars_to_check = OFILES; |
1374 | if (strlen(optarg)<3) | 1288 | else if (strncmp(optarg, "VKP", 3) == 0) { |
1375 | return ERROR; | 1289 | vars_to_check = VKP; |
1376 | if (!strcmp(optarg,"LOAD1")) | 1290 | volume_name = strdup(optarg + 3); |
1377 | vars_to_check=LOAD1; | 1291 | if (!strcmp(volume_name, "")) |
1378 | else if (!strcmp(optarg,"LOAD5")) | 1292 | volume_name = strdup("SYS"); |
1379 | vars_to_check=LOAD5; | 1293 | } else if (strncmp(optarg, "VMP", 3) == 0) { |
1380 | else if (!strcmp(optarg,"LOAD15")) | 1294 | vars_to_check = VMP; |
1381 | vars_to_check=LOAD15; | 1295 | volume_name = strdup(optarg + 3); |
1382 | else if (!strcmp(optarg,"CONNS")) | 1296 | if (!strcmp(volume_name, "")) |
1383 | vars_to_check=CONNS; | 1297 | volume_name = strdup("SYS"); |
1384 | else if (!strcmp(optarg,"LTCH")) | 1298 | } else if (strncmp(optarg, "VMU", 3) == 0) { |
1385 | vars_to_check=LTCH; | 1299 | vars_to_check = VMU; |
1386 | else if (!strcmp(optarg,"DCB")) | 1300 | volume_name = strdup(optarg + 3); |
1387 | vars_to_check=DCB; | 1301 | if (!strcmp(volume_name, "")) |
1388 | else if (!strcmp(optarg,"TCB")) | 1302 | volume_name = strdup("SYS"); |
1389 | vars_to_check=TCB; | 1303 | } else if (strncmp(optarg, "VPU", 3) == 0) { |
1390 | else if (!strcmp(optarg,"CBUFF")) | 1304 | vars_to_check = VPU; |
1391 | vars_to_check=CBUFF; | 1305 | volume_name = strdup(optarg + 3); |
1392 | else if (!strcmp(optarg,"CDBUFF")) | 1306 | if (!strcmp(volume_name, "")) |
1393 | vars_to_check=CDBUFF; | 1307 | volume_name = strdup("SYS"); |
1394 | else if (!strcmp(optarg,"LRUM")) | 1308 | } else if (strncmp(optarg, "VPP", 3) == 0) { |
1395 | vars_to_check=LRUM; | 1309 | vars_to_check = VPP; |
1396 | else if (!strcmp(optarg,"LRUS")) | 1310 | volume_name = strdup(optarg + 3); |
1397 | vars_to_check=LRUS; | 1311 | if (!strcmp(volume_name, "")) |
1398 | else if (strncmp(optarg,"VPF",3)==0) { | 1312 | volume_name = strdup("SYS"); |
1399 | vars_to_check=VPF; | 1313 | } else if (strncmp(optarg, "VKNP", 4) == 0) { |
1400 | volume_name = strdup (optarg+3); | 1314 | vars_to_check = VKNP; |
1401 | if (!strcmp(volume_name,"")) | 1315 | volume_name = strdup(optarg + 4); |
1402 | volume_name = strdup ("SYS"); | 1316 | if (!strcmp(volume_name, "")) |
1403 | } | 1317 | volume_name = strdup("SYS"); |
1404 | else if (strncmp(optarg,"VKF",3)==0) { | 1318 | } else if (strncmp(optarg, "VPNP", 4) == 0) { |
1405 | vars_to_check=VKF; | 1319 | vars_to_check = VPNP; |
1406 | volume_name = strdup (optarg+3); | 1320 | volume_name = strdup(optarg + 4); |
1407 | if (!strcmp(volume_name,"")) | 1321 | if (!strcmp(volume_name, "")) |
1408 | volume_name = strdup ("SYS"); | 1322 | volume_name = strdup("SYS"); |
1409 | } | 1323 | } else if (!strcmp(optarg, "ABENDS")) |
1410 | else if (strncmp(optarg,"VMF",3)==0) { | 1324 | vars_to_check = ABENDS; |
1411 | vars_to_check=VMF; | 1325 | else if (!strcmp(optarg, "CSPROCS")) |
1412 | volume_name = strdup (optarg+3); | 1326 | vars_to_check = CSPROCS; |
1413 | if (!strcmp(volume_name,"")) | 1327 | else if (!strcmp(optarg, "TSYNC")) |
1414 | volume_name = strdup ("SYS"); | 1328 | vars_to_check = TSYNC; |
1415 | } | 1329 | else if (!strcmp(optarg, "DSVER")) |
1416 | else if (!strcmp(optarg,"DSDB")) | 1330 | vars_to_check = DSVER; |
1417 | vars_to_check=DSDB; | 1331 | else if (!strcmp(optarg, "UPTIME")) { |
1418 | else if (!strcmp(optarg,"LOGINS")) | 1332 | vars_to_check = UPTIME; |
1419 | vars_to_check=LOGINS; | 1333 | } else if (strncmp(optarg, "NLM:", 4) == 0) { |
1420 | else if (!strcmp(optarg,"NRMH")) | 1334 | vars_to_check = NLM; |
1421 | vars_to_check=NRMH; | 1335 | nlm_name = strdup(optarg + 4); |
1422 | else if (!strcmp(optarg,"UPRB")) | 1336 | } else if (strncmp(optarg, "NRMP", 4) == 0) { |
1423 | vars_to_check=UPRB; | 1337 | vars_to_check = NRMP; |
1424 | else if (!strcmp(optarg,"PUPRB")) | 1338 | nrmp_name = strdup(optarg + 4); |
1425 | vars_to_check=PUPRB; | 1339 | if (!strcmp(nrmp_name, "")) |
1426 | else if (!strncmp(optarg,"SAPENTRIES",10)) { | 1340 | nrmp_name = strdup("AVAILABLE_MEMORY"); |
1427 | vars_to_check=SAPENTRIES; | 1341 | } else if (strncmp(optarg, "NRMM", 4) == 0) { |
1428 | if (strlen(optarg)>10) | 1342 | vars_to_check = NRMM; |
1429 | sap_number=atoi(optarg+10); | 1343 | nrmm_name = strdup(optarg + 4); |
1430 | else | 1344 | if (!strcmp(nrmm_name, "")) |
1431 | sap_number=-1; | 1345 | nrmm_name = strdup("AVAILABLE_CACHE_MEMORY"); |
1432 | } | ||
1433 | else if (!strcmp(optarg,"OFILES")) | ||
1434 | vars_to_check=OFILES; | ||
1435 | else if (strncmp(optarg,"VKP",3)==0) { | ||
1436 | vars_to_check=VKP; | ||
1437 | volume_name = strdup (optarg+3); | ||
1438 | if (!strcmp(volume_name,"")) | ||
1439 | volume_name = strdup ("SYS"); | ||
1440 | } | ||
1441 | else if (strncmp(optarg,"VMP",3)==0) { | ||
1442 | vars_to_check=VMP; | ||
1443 | volume_name = strdup (optarg+3); | ||
1444 | if (!strcmp(volume_name,"")) | ||
1445 | volume_name = strdup ("SYS"); | ||
1446 | } | ||
1447 | else if (strncmp(optarg,"VMU",3)==0) { | ||
1448 | vars_to_check=VMU; | ||
1449 | volume_name = strdup (optarg+3); | ||
1450 | if (!strcmp(volume_name,"")) | ||
1451 | volume_name = strdup ("SYS"); | ||
1452 | } | ||
1453 | else if (strncmp(optarg,"VPP",3)==0) { | ||
1454 | vars_to_check=VPP; | ||
1455 | volume_name = strdup (optarg+3); | ||
1456 | if (!strcmp(volume_name,"")) | ||
1457 | volume_name = strdup ("SYS"); | ||
1458 | } | ||
1459 | else if (strncmp(optarg,"VKNP",4)==0) { | ||
1460 | vars_to_check=VKNP; | ||
1461 | volume_name = strdup (optarg+4); | ||
1462 | if (!strcmp(volume_name,"")) | ||
1463 | volume_name = strdup ("SYS"); | ||
1464 | } | ||
1465 | else if (strncmp(optarg,"VPNP",4)==0) { | ||
1466 | vars_to_check=VPNP; | ||
1467 | volume_name = strdup (optarg+4); | ||
1468 | if (!strcmp(volume_name,"")) | ||
1469 | volume_name = strdup("SYS"); | ||
1470 | } | ||
1471 | else if (!strcmp(optarg,"ABENDS")) | ||
1472 | vars_to_check=ABENDS; | ||
1473 | else if (!strcmp(optarg,"CSPROCS")) | ||
1474 | vars_to_check=CSPROCS; | ||
1475 | else if (!strcmp(optarg,"TSYNC")) | ||
1476 | vars_to_check=TSYNC; | ||
1477 | else if (!strcmp(optarg,"DSVER")) | ||
1478 | vars_to_check=DSVER; | ||
1479 | else if (!strcmp(optarg,"UPTIME")) { | ||
1480 | vars_to_check=UPTIME; | ||
1481 | } | ||
1482 | else if (strncmp(optarg,"NLM:",4)==0) { | ||
1483 | vars_to_check=NLM; | ||
1484 | nlm_name=strdup (optarg+4); | ||
1485 | } | ||
1486 | else if (strncmp(optarg,"NRMP",4)==0) { | ||
1487 | vars_to_check=NRMP; | ||
1488 | nrmp_name = strdup (optarg+4); | ||
1489 | if (!strcmp(nrmp_name,"")) | ||
1490 | nrmp_name = strdup ("AVAILABLE_MEMORY"); | ||
1491 | } | ||
1492 | else if (strncmp(optarg,"NRMM",4)==0) { | ||
1493 | vars_to_check=NRMM; | ||
1494 | nrmm_name = strdup (optarg+4); | ||
1495 | if (!strcmp(nrmm_name,"")) | ||
1496 | nrmm_name = strdup ("AVAILABLE_CACHE_MEMORY"); | ||
1497 | |||
1498 | } | ||
1499 | |||
1500 | else if (strncmp(optarg,"NRMS",4)==0) { | ||
1501 | vars_to_check=NRMS; | ||
1502 | nrms_name = strdup (optarg+4); | ||
1503 | if (!strcmp(nrms_name,"")) | ||
1504 | nrms_name = strdup ("USED_SWAP_SPACE"); | ||
1505 | |||
1506 | } | ||
1507 | |||
1508 | else if (strncmp(optarg,"NSS1",4)==0) { | ||
1509 | vars_to_check=NSS1; | ||
1510 | nss1_name = strdup (optarg+4); | ||
1511 | if (!strcmp(nss1_name,"")) | ||
1512 | nss1_name = strdup ("CURRENTBUFFERCACHESIZE"); | ||
1513 | |||
1514 | } | ||
1515 | |||
1516 | else if (strncmp(optarg,"NSS2",4)==0) { | ||
1517 | vars_to_check=NSS2; | ||
1518 | nss2_name = strdup (optarg+4); | ||
1519 | if (!strcmp(nss2_name,"")) | ||
1520 | nss2_name = strdup ("CACHEHITS"); | ||
1521 | |||
1522 | } | ||
1523 | |||
1524 | else if (strncmp(optarg,"NSS3",4)==0) { | ||
1525 | vars_to_check=NSS3; | ||
1526 | nss3_name = strdup (optarg+4); | ||
1527 | if (!strcmp(nss3_name,"")) | ||
1528 | nss3_name = strdup ("CACHEGITPERCENT"); | ||
1529 | |||
1530 | } | ||
1531 | |||
1532 | else if (strncmp(optarg,"NSS4",4)==0) { | ||
1533 | vars_to_check=NSS4; | ||
1534 | nss4_name = strdup (optarg+4); | ||
1535 | if (!strcmp(nss4_name,"")) | ||
1536 | nss4_name = strdup ("CURRENTOPENCOUNT"); | ||
1537 | |||
1538 | } | ||
1539 | |||
1540 | else if (strncmp(optarg,"NSS5",4)==0) { | ||
1541 | vars_to_check=NSS5; | ||
1542 | nss5_name = strdup (optarg+4); | ||
1543 | if (!strcmp(nss5_name,"")) | ||
1544 | nss5_name = strdup ("CACHEMISSES"); | ||
1545 | |||
1546 | } | ||
1547 | |||
1548 | |||
1549 | else if (strncmp(optarg,"NSS6",4)==0) { | ||
1550 | vars_to_check=NSS6; | ||
1551 | nss6_name = strdup (optarg+4); | ||
1552 | if (!strcmp(nss6_name,"")) | ||
1553 | nss6_name = strdup ("PENDINGWORKSCOUNT"); | ||
1554 | |||
1555 | } | ||
1556 | |||
1557 | |||
1558 | else if (strncmp(optarg,"NSS7",4)==0) { | ||
1559 | vars_to_check=NSS7; | ||
1560 | nss7_name = strdup (optarg+4); | ||
1561 | if (!strcmp(nss7_name,"")) | ||
1562 | nss7_name = strdup ("CACHESIZE"); | ||
1563 | |||
1564 | } | ||
1565 | 1346 | ||
1347 | } | ||
1348 | |||
1349 | else if (strncmp(optarg, "NRMS", 4) == 0) { | ||
1350 | vars_to_check = NRMS; | ||
1351 | nrms_name = strdup(optarg + 4); | ||
1352 | if (!strcmp(nrms_name, "")) | ||
1353 | nrms_name = strdup("USED_SWAP_SPACE"); | ||
1354 | |||
1355 | } | ||
1356 | |||
1357 | else if (strncmp(optarg, "NSS1", 4) == 0) { | ||
1358 | vars_to_check = NSS1; | ||
1359 | nss1_name = strdup(optarg + 4); | ||
1360 | if (!strcmp(nss1_name, "")) | ||
1361 | nss1_name = strdup("CURRENTBUFFERCACHESIZE"); | ||
1566 | 1362 | ||
1567 | else | ||
1568 | return ERROR; | ||
1569 | break; | ||
1570 | case 'w': /* warning threshold */ | ||
1571 | warning_value=strtoul(optarg,NULL,10); | ||
1572 | check_warning_value = true; | ||
1573 | break; | ||
1574 | case 'c': /* critical threshold */ | ||
1575 | critical_value=strtoul(optarg,NULL,10); | ||
1576 | check_critical_value = true; | ||
1577 | break; | ||
1578 | case 't': /* timeout */ | ||
1579 | socket_timeout=atoi(optarg); | ||
1580 | if (socket_timeout<=0) | ||
1581 | return ERROR; | ||
1582 | } | 1363 | } |
1583 | 1364 | ||
1365 | else if (strncmp(optarg, "NSS2", 4) == 0) { | ||
1366 | vars_to_check = NSS2; | ||
1367 | nss2_name = strdup(optarg + 4); | ||
1368 | if (!strcmp(nss2_name, "")) | ||
1369 | nss2_name = strdup("CACHEHITS"); | ||
1370 | |||
1371 | } | ||
1372 | |||
1373 | else if (strncmp(optarg, "NSS3", 4) == 0) { | ||
1374 | vars_to_check = NSS3; | ||
1375 | nss3_name = strdup(optarg + 4); | ||
1376 | if (!strcmp(nss3_name, "")) | ||
1377 | nss3_name = strdup("CACHEGITPERCENT"); | ||
1378 | |||
1379 | } | ||
1380 | |||
1381 | else if (strncmp(optarg, "NSS4", 4) == 0) { | ||
1382 | vars_to_check = NSS4; | ||
1383 | nss4_name = strdup(optarg + 4); | ||
1384 | if (!strcmp(nss4_name, "")) | ||
1385 | nss4_name = strdup("CURRENTOPENCOUNT"); | ||
1386 | |||
1387 | } | ||
1388 | |||
1389 | else if (strncmp(optarg, "NSS5", 4) == 0) { | ||
1390 | vars_to_check = NSS5; | ||
1391 | nss5_name = strdup(optarg + 4); | ||
1392 | if (!strcmp(nss5_name, "")) | ||
1393 | nss5_name = strdup("CACHEMISSES"); | ||
1394 | |||
1395 | } | ||
1396 | |||
1397 | else if (strncmp(optarg, "NSS6", 4) == 0) { | ||
1398 | vars_to_check = NSS6; | ||
1399 | nss6_name = strdup(optarg + 4); | ||
1400 | if (!strcmp(nss6_name, "")) | ||
1401 | nss6_name = strdup("PENDINGWORKSCOUNT"); | ||
1402 | |||
1403 | } | ||
1404 | |||
1405 | else if (strncmp(optarg, "NSS7", 4) == 0) { | ||
1406 | vars_to_check = NSS7; | ||
1407 | nss7_name = strdup(optarg + 4); | ||
1408 | if (!strcmp(nss7_name, "")) | ||
1409 | nss7_name = strdup("CACHESIZE"); | ||
1410 | |||
1411 | } | ||
1412 | |||
1413 | else | ||
1414 | return ERROR; | ||
1415 | break; | ||
1416 | case 'w': /* warning threshold */ | ||
1417 | warning_value = strtoul(optarg, NULL, 10); | ||
1418 | check_warning_value = true; | ||
1419 | break; | ||
1420 | case 'c': /* critical threshold */ | ||
1421 | critical_value = strtoul(optarg, NULL, 10); | ||
1422 | check_critical_value = true; | ||
1423 | break; | ||
1424 | case 't': /* timeout */ | ||
1425 | socket_timeout = atoi(optarg); | ||
1426 | if (socket_timeout <= 0) | ||
1427 | return ERROR; | ||
1428 | } | ||
1584 | } | 1429 | } |
1585 | 1430 | ||
1586 | return OK; | 1431 | return OK; |
1587 | } | 1432 | } |
1588 | 1433 | ||
1589 | 1434 | void print_help(void) { | |
1590 | |||
1591 | void print_help(void) | ||
1592 | { | ||
1593 | char *myport; | 1435 | char *myport; |
1594 | xasprintf (&myport, "%d", PORT); | 1436 | xasprintf(&myport, "%d", PORT); |
1595 | 1437 | ||
1596 | print_revision (progname, NP_VERSION); | 1438 | print_revision(progname, NP_VERSION); |
1597 | 1439 | ||
1598 | printf ("Copyright (c) 1999 Ethan Galstad <nagios@nagios.org>\n"); | 1440 | printf("Copyright (c) 1999 Ethan Galstad <nagios@nagios.org>\n"); |
1599 | printf (COPYRIGHT, copyright, email); | 1441 | printf(COPYRIGHT, copyright, email); |
1600 | 1442 | ||
1601 | printf ("%s\n", _("This plugin attempts to contact the MRTGEXT NLM running on a")); | 1443 | printf("%s\n", _("This plugin attempts to contact the MRTGEXT NLM running on a")); |
1602 | printf ("%s\n", _("Novell server to gather the requested system information.")); | 1444 | printf("%s\n", _("Novell server to gather the requested system information.")); |
1603 | 1445 | ||
1604 | printf ("\n\n"); | 1446 | printf("\n\n"); |
1605 | 1447 | ||
1606 | print_usage(); | 1448 | print_usage(); |
1607 | 1449 | ||
1608 | printf (UT_HELP_VRSN); | 1450 | printf(UT_HELP_VRSN); |
1609 | printf (UT_EXTRA_OPTS); | 1451 | printf(UT_EXTRA_OPTS); |
1610 | 1452 | ||
1611 | printf (UT_HOST_PORT, 'p', myport); | 1453 | printf(UT_HOST_PORT, 'p', myport); |
1612 | 1454 | ||
1613 | printf (" %s\n", "-v, --variable=STRING"); | 1455 | printf(" %s\n", "-v, --variable=STRING"); |
1614 | printf (" %s\n", _("Variable to check. Valid variables include:")); | 1456 | printf(" %s\n", _("Variable to check. Valid variables include:")); |
1615 | printf (" %s\n", _("LOAD1 = 1 minute average CPU load")); | 1457 | printf(" %s\n", _("LOAD1 = 1 minute average CPU load")); |
1616 | printf (" %s\n", _("LOAD5 = 5 minute average CPU load")); | 1458 | printf(" %s\n", _("LOAD5 = 5 minute average CPU load")); |
1617 | printf (" %s\n", _("LOAD15 = 15 minute average CPU load")); | 1459 | printf(" %s\n", _("LOAD15 = 15 minute average CPU load")); |
1618 | printf (" %s\n", _("CSPROCS = number of current service processes (NW 5.x only)")); | 1460 | printf(" %s\n", _("CSPROCS = number of current service processes (NW 5.x only)")); |
1619 | printf (" %s\n", _("ABENDS = number of abended threads (NW 5.x only)")); | 1461 | printf(" %s\n", _("ABENDS = number of abended threads (NW 5.x only)")); |
1620 | printf (" %s\n", _("UPTIME = server uptime")); | 1462 | printf(" %s\n", _("UPTIME = server uptime")); |
1621 | printf (" %s\n", _("LTCH = percent long term cache hits")); | 1463 | printf(" %s\n", _("LTCH = percent long term cache hits")); |
1622 | printf (" %s\n", _("CBUFF = current number of cache buffers")); | 1464 | printf(" %s\n", _("CBUFF = current number of cache buffers")); |
1623 | printf (" %s\n", _("CDBUFF = current number of dirty cache buffers")); | 1465 | printf(" %s\n", _("CDBUFF = current number of dirty cache buffers")); |
1624 | printf (" %s\n", _("DCB = dirty cache buffers as a percentage of the total")); | 1466 | printf(" %s\n", _("DCB = dirty cache buffers as a percentage of the total")); |
1625 | printf (" %s\n", _("TCB = dirty cache buffers as a percentage of the original")); | 1467 | printf(" %s\n", _("TCB = dirty cache buffers as a percentage of the original")); |
1626 | printf (" %s\n", _("OFILES = number of open files")); | 1468 | printf(" %s\n", _("OFILES = number of open files")); |
1627 | printf (" %s\n", _(" VMF<vol> = MB of free space on Volume <vol>")); | 1469 | printf(" %s\n", _(" VMF<vol> = MB of free space on Volume <vol>")); |
1628 | printf (" %s\n", _(" VMU<vol> = MB used space on Volume <vol>")); | 1470 | printf(" %s\n", _(" VMU<vol> = MB used space on Volume <vol>")); |
1629 | printf (" %s\n", _(" VMP<vol> = MB of purgeable space on Volume <vol>")); | 1471 | printf(" %s\n", _(" VPU<vol> = percent used space on Volume <vol>")); |
1630 | printf (" %s\n", _(" VPF<vol> = percent free space on volume <vol>")); | 1472 | printf(" %s\n", _(" VMP<vol> = MB of purgeable space on Volume <vol>")); |
1631 | printf (" %s\n", _(" VKF<vol> = KB of free space on volume <vol>")); | 1473 | printf(" %s\n", _(" VPF<vol> = percent free space on volume <vol>")); |
1632 | printf (" %s\n", _(" VPP<vol> = percent purgeable space on volume <vol>")); | 1474 | printf(" %s\n", _(" VKF<vol> = KB of free space on volume <vol>")); |
1633 | printf (" %s\n", _(" VKP<vol> = KB of purgeable space on volume <vol>")); | 1475 | printf(" %s\n", _(" VPP<vol> = percent purgeable space on volume <vol>")); |
1634 | printf (" %s\n", _(" VPNP<vol> = percent not yet purgeable space on volume <vol>")); | 1476 | printf(" %s\n", _(" VKP<vol> = KB of purgeable space on volume <vol>")); |
1635 | printf (" %s\n", _(" VKNP<vol> = KB of not yet purgeable space on volume <vol>")); | 1477 | printf(" %s\n", _(" VPNP<vol> = percent not yet purgeable space on volume <vol>")); |
1636 | printf (" %s\n", _(" LRUM = LRU sitting time in minutes")); | 1478 | printf(" %s\n", _(" VKNP<vol> = KB of not yet purgeable space on volume <vol>")); |
1637 | printf (" %s\n", _(" LRUS = LRU sitting time in seconds")); | 1479 | printf(" %s\n", _(" LRUM = LRU sitting time in minutes")); |
1638 | printf (" %s\n", _(" DSDB = check to see if DS Database is open")); | 1480 | printf(" %s\n", _(" LRUS = LRU sitting time in seconds")); |
1639 | printf (" %s\n", _(" DSVER = NDS version")); | 1481 | printf(" %s\n", _(" DSDB = check to see if DS Database is open")); |
1640 | printf (" %s\n", _(" UPRB = used packet receive buffers")); | 1482 | printf(" %s\n", _(" DSVER = NDS version")); |
1641 | printf (" %s\n", _(" PUPRB = percent (of max) used packet receive buffers")); | 1483 | printf(" %s\n", _(" UPRB = used packet receive buffers")); |
1642 | printf (" %s\n", _(" SAPENTRIES = number of entries in the SAP table")); | 1484 | printf(" %s\n", _(" PUPRB = percent (of max) used packet receive buffers")); |
1643 | printf (" %s\n", _(" SAPENTRIES<n> = number of entries in the SAP table for SAP type <n>")); | 1485 | printf(" %s\n", _(" SAPENTRIES = number of entries in the SAP table")); |
1644 | printf (" %s\n", _(" TSYNC = timesync status")); | 1486 | printf(" %s\n", _(" SAPENTRIES<n> = number of entries in the SAP table for SAP type <n>")); |
1645 | printf (" %s\n", _(" LOGINS = check to see if logins are enabled")); | 1487 | printf(" %s\n", _(" TSYNC = timesync status")); |
1646 | printf (" %s\n", _(" CONNS = number of currently licensed connections")); | 1488 | printf(" %s\n", _(" LOGINS = check to see if logins are enabled")); |
1647 | printf (" %s\n", _(" NRMH = NRM Summary Status")); | 1489 | printf(" %s\n", _(" CONNS = number of currently licensed connections")); |
1648 | printf (" %s\n", _(" NRMP<stat> = Returns the current value for a NRM health item")); | 1490 | printf(" %s\n", _(" NRMH = NRM Summary Status")); |
1649 | printf (" %s\n", _(" NRMM<stat> = Returns the current memory stats from NRM")); | 1491 | printf(" %s\n", _(" NRMP<stat> = Returns the current value for a NRM health item")); |
1650 | printf (" %s\n", _(" NRMS<stat> = Returns the current Swapfile stats from NRM")); | 1492 | printf(" %s\n", _(" NRMM<stat> = Returns the current memory stats from NRM")); |
1651 | printf (" %s\n", _(" NSS1<stat> = Statistics from _Admin:Manage_NSS\\GeneralStats.xml")); | 1493 | printf(" %s\n", _(" NRMS<stat> = Returns the current Swapfile stats from NRM")); |
1652 | printf (" %s\n", _(" NSS3<stat> = Statistics from _Admin:Manage_NSS\\NameCache.xml")); | 1494 | printf(" %s\n", _(" NSS1<stat> = Statistics from _Admin:Manage_NSS\\GeneralStats.xml")); |
1653 | printf (" %s\n", _(" NSS4<stat> = Statistics from _Admin:Manage_NSS\\FileStats.xml")); | 1495 | printf(" %s\n", _(" NSS3<stat> = Statistics from _Admin:Manage_NSS\\NameCache.xml")); |
1654 | printf (" %s\n", _(" NSS5<stat> = Statistics from _Admin:Manage_NSS\\ObjectCache.xml")); | 1496 | printf(" %s\n", _(" NSS4<stat> = Statistics from _Admin:Manage_NSS\\FileStats.xml")); |
1655 | printf (" %s\n", _(" NSS6<stat> = Statistics from _Admin:Manage_NSS\\Thread.xml")); | 1497 | printf(" %s\n", _(" NSS5<stat> = Statistics from _Admin:Manage_NSS\\ObjectCache.xml")); |
1656 | printf (" %s\n", _(" NSS7<stat> = Statistics from _Admin:Manage_NSS\\AuthorizationCache.xml")); | 1498 | printf(" %s\n", _(" NSS6<stat> = Statistics from _Admin:Manage_NSS\\Thread.xml")); |
1657 | printf (" %s\n", _(" NLM:<nlm> = check if NLM is loaded and report version")); | 1499 | printf(" %s\n", _(" NSS7<stat> = Statistics from _Admin:Manage_NSS\\AuthorizationCache.xml")); |
1658 | printf (" %s\n", _(" (e.g. NLM:TSANDS.NLM)")); | 1500 | printf(" %s\n", _(" NLM:<nlm> = check if NLM is loaded and report version")); |
1659 | printf ("\n"); | 1501 | printf(" %s\n", _(" (e.g. NLM:TSANDS.NLM)")); |
1660 | printf (" %s\n", "-w, --warning=INTEGER"); | 1502 | printf("\n"); |
1661 | printf (" %s\n", _("Threshold which will result in a warning status")); | 1503 | printf(" %s\n", "-w, --warning=INTEGER"); |
1662 | printf (" %s\n", "-c, --critical=INTEGER"); | 1504 | printf(" %s\n", _("Threshold which will result in a warning status")); |
1663 | printf (" %s\n", _("Threshold which will result in a critical status")); | 1505 | printf(" %s\n", "-c, --critical=INTEGER"); |
1664 | printf (" %s\n", "-o, --osversion"); | 1506 | printf(" %s\n", _("Threshold which will result in a critical status")); |
1665 | printf (" %s\n", _("Include server version string in results")); | 1507 | printf(" %s\n", "-o, --osversion"); |
1666 | 1508 | printf(" %s\n", _("Include server version string in results")); | |
1667 | printf (UT_CONN_TIMEOUT, DEFAULT_SOCKET_TIMEOUT); | 1509 | |
1668 | 1510 | printf(UT_CONN_TIMEOUT, DEFAULT_SOCKET_TIMEOUT); | |
1669 | printf ("\n"); | 1511 | |
1670 | printf ("%s\n", _("Notes:")); | 1512 | printf("\n"); |
1671 | printf (" %s\n", _("- This plugin requires that the MRTGEXT.NLM file from James Drews' MRTG")); | 1513 | printf("%s\n", _("Notes:")); |
1672 | printf (" %s\n", _(" extension for NetWare be loaded on the Novell servers you wish to check.")); | 1514 | printf(" %s\n", _("- This plugin requires that the MRTGEXT.NLM file from James Drews' MRTG")); |
1673 | printf (" %s\n", _(" (available from http://www.engr.wisc.edu/~drews/mrtg/)")); | 1515 | printf(" %s\n", _(" extension for NetWare be loaded on the Novell servers you wish to check.")); |
1674 | printf (" %s\n", _("- Values for critical thresholds should be lower than warning thresholds")); | 1516 | printf(" %s\n", _(" (available from http://www.engr.wisc.edu/~drews/mrtg/)")); |
1675 | printf (" %s\n", _(" when the following variables are checked: VPF, VKF, LTCH, CBUFF, DCB, ")); | 1517 | printf(" %s\n", _("- Values for critical thresholds should be lower than warning thresholds")); |
1676 | printf (" %s\n", _(" TCB, LRUS and LRUM.")); | 1518 | printf(" %s\n", _(" when the following variables are checked: VPF, VKF, LTCH, CBUFF, DCB, ")); |
1677 | 1519 | printf(" %s\n", _(" TCB, LRUS and LRUM.")); | |
1678 | printf (UT_SUPPORT); | 1520 | |
1521 | printf(UT_SUPPORT); | ||
1679 | } | 1522 | } |
1680 | 1523 | ||
1681 | 1524 | void print_usage(void) { | |
1682 | 1525 | printf("%s\n", _("Usage:")); | |
1683 | void print_usage(void) | 1526 | printf("%s -H host [-p port] [-v variable] [-w warning] [-c critical] [-t timeout]\n", progname); |
1684 | { | ||
1685 | printf ("%s\n", _("Usage:")); | ||
1686 | printf ("%s -H host [-p port] [-v variable] [-w warning] [-c critical] [-t timeout]\n",progname); | ||
1687 | } | 1527 | } |