summaryrefslogtreecommitdiffstats
path: root/plugins/check_nwstat.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/check_nwstat.c')
-rw-r--r--plugins/check_nwstat.c94
1 files changed, 47 insertions, 47 deletions
diff --git a/plugins/check_nwstat.c b/plugins/check_nwstat.c
index e142670..f8fca73 100644
--- a/plugins/check_nwstat.c
+++ b/plugins/check_nwstat.c
@@ -180,13 +180,13 @@ int main(int argc, char **argv){
180 if(result!=STATE_OK) 180 if(result!=STATE_OK)
181 return result; 181 return result;
182 if(!strcmp(recv_buffer,"-1\n")) 182 if(!strcmp(recv_buffer,"-1\n"))
183 netware_version = ssprintf(netware_version,""); 183 asprintf(&netware_version,"");
184 else { 184 else {
185 recv_buffer[strlen(recv_buffer)-1]=0; 185 recv_buffer[strlen(recv_buffer)-1]=0;
186 netware_version = ssprintf(netware_version,"NetWare %s: ",recv_buffer); 186 asprintf(&netware_version,"NetWare %s: ",recv_buffer);
187 } 187 }
188 } else 188 } else
189 netware_version = ssprintf(netware_version,""); 189 asprintf(&netware_version,"");
190 190
191 191
192 /* check CPU load */ 192 /* check CPU load */
@@ -204,7 +204,7 @@ int main(int argc, char **argv){
204 break; 204 break;
205 } 205 }
206 206
207 send_buffer = ssprintf(send_buffer,"UTIL%s\r\n",temp_buffer); 207 asprintf(&send_buffer,"UTIL%s\r\n",temp_buffer);
208 result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); 208 result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer));
209 if(result!=STATE_OK) 209 if(result!=STATE_OK)
210 return result; 210 return result;
@@ -221,7 +221,7 @@ int main(int argc, char **argv){
221 else if(check_warning_value==TRUE && utilization >= warning_value) 221 else if(check_warning_value==TRUE && utilization >= warning_value)
222 result=STATE_WARNING; 222 result=STATE_WARNING;
223 223
224 output_message = ssprintf(output_message,"Load %s - %s %s-min load average = %lu%%",(result==STATE_OK)?"ok":"problem",uptime,temp_buffer,utilization); 224 asprintf(&output_message,"Load %s - %s %s-min load average = %lu%%",(result==STATE_OK)?"ok":"problem",uptime,temp_buffer,utilization);
225 225
226 /* check number of user connections */ 226 /* check number of user connections */
227 } else if (vars_to_check==CHECK_CONNS) { 227 } else if (vars_to_check==CHECK_CONNS) {
@@ -236,7 +236,7 @@ int main(int argc, char **argv){
236 result=STATE_CRITICAL; 236 result=STATE_CRITICAL;
237 else if(check_warning_value==TRUE && current_connections >= warning_value) 237 else if(check_warning_value==TRUE && current_connections >= warning_value)
238 result=STATE_WARNING; 238 result=STATE_WARNING;
239 output_message = ssprintf(output_message,"Conns %s - %lu current connections",(result==STATE_OK)?"ok":"problem",current_connections); 239 asprintf(&output_message,"Conns %s - %lu current connections",(result==STATE_OK)?"ok":"problem",current_connections);
240 240
241 /* check % long term cache hits */ 241 /* check % long term cache hits */
242 } else if (vars_to_check==CHECK_LTCH) { 242 } else if (vars_to_check==CHECK_LTCH) {
@@ -251,7 +251,7 @@ int main(int argc, char **argv){
251 result=STATE_CRITICAL; 251 result=STATE_CRITICAL;
252 else if(check_warning_value==TRUE && cache_hits <= warning_value) 252 else if(check_warning_value==TRUE && cache_hits <= warning_value)
253 result=STATE_WARNING; 253 result=STATE_WARNING;
254 output_message = ssprintf(output_message,"Long term cache hits = %d%%",cache_hits); 254 asprintf(&output_message,"Long term cache hits = %d%%",cache_hits);
255 255
256 /* check cache buffers */ 256 /* check cache buffers */
257 } else if (vars_to_check==CHECK_CBUFF) { 257 } else if (vars_to_check==CHECK_CBUFF) {
@@ -266,7 +266,7 @@ int main(int argc, char **argv){
266 result=STATE_CRITICAL; 266 result=STATE_CRITICAL;
267 else if(check_warning_value==TRUE && cache_buffers <= warning_value) 267 else if(check_warning_value==TRUE && cache_buffers <= warning_value)
268 result=STATE_WARNING; 268 result=STATE_WARNING;
269 output_message = ssprintf(output_message,"Total cache buffers = %lu",cache_buffers); 269 asprintf(&output_message,"Total cache buffers = %lu",cache_buffers);
270 270
271 /* check dirty cache buffers */ 271 /* check dirty cache buffers */
272 } else if (vars_to_check==CHECK_CDBUFF) { 272 } else if (vars_to_check==CHECK_CDBUFF) {
@@ -281,7 +281,7 @@ int main(int argc, char **argv){
281 result=STATE_CRITICAL; 281 result=STATE_CRITICAL;
282 else if(check_warning_value==TRUE && cache_buffers >= warning_value) 282 else if(check_warning_value==TRUE && cache_buffers >= warning_value)
283 result=STATE_WARNING; 283 result=STATE_WARNING;
284 output_message = ssprintf(output_message,"Dirty cache buffers = %lu",cache_buffers); 284 asprintf(&output_message,"Dirty cache buffers = %lu",cache_buffers);
285 285
286 /* check LRU sitting time in minutes */ 286 /* check LRU sitting time in minutes */
287 } else if (vars_to_check==CHECK_LRUM) { 287 } else if (vars_to_check==CHECK_LRUM) {
@@ -296,19 +296,19 @@ int main(int argc, char **argv){
296 result=STATE_CRITICAL; 296 result=STATE_CRITICAL;
297 else if(check_warning_value==TRUE && lru_time <= warning_value) 297 else if(check_warning_value==TRUE && lru_time <= warning_value)
298 result=STATE_WARNING; 298 result=STATE_WARNING;
299 output_message = ssprintf(output_message,"LRU sitting time = %lu minutes",lru_time); 299 sprintf(&output_message,"LRU sitting time = %lu minutes",lru_time);
300 300
301 301
302 /* check KB free space on volume */ 302 /* check KB free space on volume */
303 } else if (vars_to_check==CHECK_VKF) { 303 } else if (vars_to_check==CHECK_VKF) {
304 304
305 send_buffer = ssprintf(send_buffer,"VKF%s\r\n",volume_name); 305 asprintf(&send_buffer,"VKF%s\r\n",volume_name);
306 result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); 306 result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer));
307 if(result!=STATE_OK) 307 if(result!=STATE_OK)
308 return result; 308 return result;
309 309
310 if (!strcmp(recv_buffer,"-1\n")) { 310 if (!strcmp(recv_buffer,"-1\n")) {
311 output_message = ssprintf(output_message,"Error: Volume '%s' does not exist!",volume_name); 311 asprintf(&output_message,"Error: Volume '%s' does not exist!",volume_name);
312 result=STATE_CRITICAL; 312 result=STATE_CRITICAL;
313 } else { 313 } else {
314 free_disk_space=strtoul(recv_buffer,NULL,10); 314 free_disk_space=strtoul(recv_buffer,NULL,10);
@@ -316,27 +316,27 @@ int main(int argc, char **argv){
316 result=STATE_CRITICAL; 316 result=STATE_CRITICAL;
317 else if(check_warning_value==TRUE && free_disk_space <= warning_value) 317 else if(check_warning_value==TRUE && free_disk_space <= warning_value)
318 result=STATE_WARNING; 318 result=STATE_WARNING;
319 output_message = ssprintf(output_message,"%s%lu KB free on volume %s",(result==STATE_OK)?"":"Only ",free_disk_space,volume_name); 319 asprintf(&output_message,"%s%lu KB free on volume %s",(result==STATE_OK)?"":"Only ",free_disk_space,volume_name);
320 } 320 }
321 321
322 /* check % free space on volume */ 322 /* check % free space on volume */
323 } else if (vars_to_check==CHECK_VPF) { 323 } else if (vars_to_check==CHECK_VPF) {
324 324
325 send_buffer = ssprintf(send_buffer,"VKF%s\r\n",volume_name); 325 asprintf(&send_buffer,"VKF%s\r\n",volume_name);
326 result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); 326 result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer));
327 if(result!=STATE_OK) 327 if(result!=STATE_OK)
328 return result; 328 return result;
329 329
330 if(!strcmp(recv_buffer,"-1\n")){ 330 if(!strcmp(recv_buffer,"-1\n")){
331 331
332 output_message = ssprintf(output_message,"Error: Volume '%s' does not exist!",volume_name); 332 asprintf(&output_message,"Error: Volume '%s' does not exist!",volume_name);
333 result=STATE_CRITICAL; 333 result=STATE_CRITICAL;
334 334
335 } else { 335 } else {
336 336
337 free_disk_space=strtoul(recv_buffer,NULL,10); 337 free_disk_space=strtoul(recv_buffer,NULL,10);
338 338
339 send_buffer = ssprintf(send_buffer,"VKS%s\r\n",volume_name); 339 asprintf(&send_buffer,"VKS%s\r\n",volume_name);
340 result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); 340 result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer));
341 if(result!=STATE_OK) 341 if(result!=STATE_OK)
342 return result; 342 return result;
@@ -349,7 +349,7 @@ int main(int argc, char **argv){
349 else if(check_warning_value==TRUE && percent_free_space <= warning_value) 349 else if(check_warning_value==TRUE && percent_free_space <= warning_value)
350 result=STATE_WARNING; 350 result=STATE_WARNING;
351 free_disk_space/=1024; 351 free_disk_space/=1024;
352 output_message = ssprintf(output_message,"%lu MB (%d%%) free on volume %s",free_disk_space,percent_free_space,volume_name); 352 asprintf(&output_message,"%lu MB (%d%%) free on volume %s",free_disk_space,percent_free_space,volume_name);
353 } 353 }
354 354
355 /* check to see if DS Database is open or closed */ 355 /* check to see if DS Database is open or closed */
@@ -368,7 +368,7 @@ int main(int argc, char **argv){
368 result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); 368 result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer));
369 temp_buffer=strtok(recv_buffer,"\r\n"); 369 temp_buffer=strtok(recv_buffer,"\r\n");
370 370
371 output_message = ssprintf(output_message,"Directory Services Database is %s (DS version %s)",(result==STATE_OK)?"open":"closed",temp_buffer); 371 asprintf(&output_message,"Directory Services Database is %s (DS version %s)",(result==STATE_OK)?"open":"closed",temp_buffer);
372 372
373 /* check to see if logins are enabled */ 373 /* check to see if logins are enabled */
374 } else if (vars_to_check==CHECK_LOGINS) { 374 } else if (vars_to_check==CHECK_LOGINS) {
@@ -382,19 +382,19 @@ int main(int argc, char **argv){
382 else 382 else
383 result=STATE_WARNING; 383 result=STATE_WARNING;
384 384
385 output_message = ssprintf(output_message,"Logins are %s",(result==STATE_OK)?"enabled":"disabled"); 385 asprintf(&output_message,"Logins are %s",(result==STATE_OK)?"enabled":"disabled");
386 386
387 /* check packet receive buffers */ 387 /* check packet receive buffers */
388 } else if (vars_to_check==CHECK_UPRB || vars_to_check==CHECK_PUPRB) { 388 } else if (vars_to_check==CHECK_UPRB || vars_to_check==CHECK_PUPRB) {
389 389
390 send_buffer = ssprintf(send_buffer,"S15\r\n",volume_name); 390 asprintf(&send_buffer,"S15\r\n",volume_name);
391 result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); 391 result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer));
392 if(result!=STATE_OK) 392 if(result!=STATE_OK)
393 return result; 393 return result;
394 394
395 used_packet_receive_buffers=atoi(recv_buffer); 395 used_packet_receive_buffers=atoi(recv_buffer);
396 396
397 send_buffer = ssprintf(send_buffer,"S16\r\n",volume_name); 397 asprintf(&send_buffer,"S16\r\n",volume_name);
398 result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); 398 result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer));
399 if(result!=STATE_OK) 399 if(result!=STATE_OK)
400 return result; 400 return result;
@@ -415,15 +415,15 @@ int main(int argc, char **argv){
415 result=STATE_WARNING; 415 result=STATE_WARNING;
416 } 416 }
417 417
418 output_message = ssprintf(output_message,"%d of %d (%lu%%) packet receive buffers used",used_packet_receive_buffers,max_packet_receive_buffers,percent_used_packet_receive_buffers); 418 asprintf(&output_message,"%d of %d (%lu%%) packet receive buffers used",used_packet_receive_buffers,max_packet_receive_buffers,percent_used_packet_receive_buffers);
419 419
420 /* check SAP table entries */ 420 /* check SAP table entries */
421 } else if (vars_to_check==CHECK_SAPENTRIES) { 421 } else if (vars_to_check==CHECK_SAPENTRIES) {
422 422
423 if(sap_number==-1) 423 if(sap_number==-1)
424 send_buffer = ssprintf(send_buffer,"S9\r\n"); 424 asprintf(&send_buffer,"S9\r\n");
425 else 425 else
426 send_buffer = ssprintf(send_buffer,"S9.%d\r\n",sap_number); 426 asprintf(&send_buffer,"S9.%d\r\n",sap_number);
427 result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); 427 result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer));
428 if(result!=STATE_OK) 428 if(result!=STATE_OK)
429 return result; 429 return result;
@@ -436,20 +436,20 @@ int main(int argc, char **argv){
436 result=STATE_WARNING; 436 result=STATE_WARNING;
437 437
438 if(sap_number==-1) 438 if(sap_number==-1)
439 output_message = ssprintf(output_message,"%d entries in SAP table",sap_entries); 439 asprintf(&output_message,"%d entries in SAP table",sap_entries);
440 else 440 else
441 output_message = ssprintf(output_message,"%d entries in SAP table for SAP type %d",sap_entries,sap_number); 441 asprintf(&output_message,"%d entries in SAP table for SAP type %d",sap_entries,sap_number);
442 442
443 /* check KB purgeable space on volume */ 443 /* check KB purgeable space on volume */
444 } else if (vars_to_check==CHECK_VKP) { 444 } else if (vars_to_check==CHECK_VKP) {
445 445
446 send_buffer = ssprintf(send_buffer,"VKP%s\r\n",volume_name); 446 asprintf(&send_buffer,"VKP%s\r\n",volume_name);
447 result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); 447 result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer));
448 if(result!=STATE_OK) 448 if(result!=STATE_OK)
449 return result; 449 return result;
450 450
451 if (!strcmp(recv_buffer,"-1\n")) { 451 if (!strcmp(recv_buffer,"-1\n")) {
452 output_message = ssprintf(output_message,"Error: Volume '%s' does not exist!",volume_name); 452 asprintf(&output_message,"Error: Volume '%s' does not exist!",volume_name);
453 result=STATE_CRITICAL; 453 result=STATE_CRITICAL;
454 } else { 454 } else {
455 purgeable_disk_space=strtoul(recv_buffer,NULL,10); 455 purgeable_disk_space=strtoul(recv_buffer,NULL,10);
@@ -457,27 +457,27 @@ int main(int argc, char **argv){
457 result=STATE_CRITICAL; 457 result=STATE_CRITICAL;
458 else if(check_warning_value==TRUE && purgeable_disk_space >= warning_value) 458 else if(check_warning_value==TRUE && purgeable_disk_space >= warning_value)
459 result=STATE_WARNING; 459 result=STATE_WARNING;
460 output_message = ssprintf(output_message,"%s%lu KB purgeable on volume %s",(result==STATE_OK)?"":"Only ",purgeable_disk_space,volume_name); 460 asprintf(&output_message,"%s%lu KB purgeable on volume %s",(result==STATE_OK)?"":"Only ",purgeable_disk_space,volume_name);
461 } 461 }
462 462
463 /* check % purgeable space on volume */ 463 /* check % purgeable space on volume */
464 } else if (vars_to_check==CHECK_VPP) { 464 } else if (vars_to_check==CHECK_VPP) {
465 465
466 send_buffer = ssprintf(send_buffer,"VKP%s\r\n",volume_name); 466 asprintf(&send_buffer,"VKP%s\r\n",volume_name);
467 result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); 467 result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer));
468 if(result!=STATE_OK) 468 if(result!=STATE_OK)
469 return result; 469 return result;
470 470
471 if(!strcmp(recv_buffer,"-1\n")){ 471 if(!strcmp(recv_buffer,"-1\n")){
472 472
473 output_message = ssprintf(output_message,"Error: Volume '%s' does not exist!",volume_name); 473 asprintf(&output_message,"Error: Volume '%s' does not exist!",volume_name);
474 result=STATE_CRITICAL; 474 result=STATE_CRITICAL;
475 475
476 } else { 476 } else {
477 477
478 purgeable_disk_space=strtoul(recv_buffer,NULL,10); 478 purgeable_disk_space=strtoul(recv_buffer,NULL,10);
479 479
480 send_buffer = ssprintf(send_buffer,"VKS%s\r\n",volume_name); 480 asprintf(&send_buffer,"VKS%s\r\n",volume_name);
481 result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); 481 result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer));
482 if(result!=STATE_OK) 482 if(result!=STATE_OK)
483 return result; 483 return result;
@@ -490,19 +490,19 @@ int main(int argc, char **argv){
490 else if(check_warning_value==TRUE && percent_purgeable_space >= warning_value) 490 else if(check_warning_value==TRUE && percent_purgeable_space >= warning_value)
491 result=STATE_WARNING; 491 result=STATE_WARNING;
492 purgeable_disk_space/=1024; 492 purgeable_disk_space/=1024;
493 output_message = ssprintf(output_message,"%lu MB (%d%%) purgeable on volume %s",purgeable_disk_space,percent_purgeable_space,volume_name); 493 asprintf(&output_message,"%lu MB (%d%%) purgeable on volume %s",purgeable_disk_space,percent_purgeable_space,volume_name);
494 } 494 }
495 495
496 /* check KB not yet purgeable space on volume */ 496 /* check KB not yet purgeable space on volume */
497 } else if (vars_to_check==CHECK_VKNP) { 497 } else if (vars_to_check==CHECK_VKNP) {
498 498
499 send_buffer = ssprintf(send_buffer,"VKNP%s\r\n",volume_name); 499 asprintf(&send_buffer,"VKNP%s\r\n",volume_name);
500 result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); 500 result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer));
501 if(result!=STATE_OK) 501 if(result!=STATE_OK)
502 return result; 502 return result;
503 503
504 if (!strcmp(recv_buffer,"-1\n")) { 504 if (!strcmp(recv_buffer,"-1\n")) {
505 output_message = ssprintf(output_message,"Error: Volume '%s' does not exist!",volume_name); 505 asprintf(&output_message,"Error: Volume '%s' does not exist!",volume_name);
506 result=STATE_CRITICAL; 506 result=STATE_CRITICAL;
507 } else { 507 } else {
508 non_purgeable_disk_space=strtoul(recv_buffer,NULL,10); 508 non_purgeable_disk_space=strtoul(recv_buffer,NULL,10);
@@ -510,27 +510,27 @@ int main(int argc, char **argv){
510 result=STATE_CRITICAL; 510 result=STATE_CRITICAL;
511 else if(check_warning_value==TRUE && non_purgeable_disk_space >= warning_value) 511 else if(check_warning_value==TRUE && non_purgeable_disk_space >= warning_value)
512 result=STATE_WARNING; 512 result=STATE_WARNING;
513 output_message = ssprintf(output_message,"%s%lu KB not yet purgeable on volume %s",(result==STATE_OK)?"":"Only ",non_purgeable_disk_space,volume_name); 513 asprintf(&output_message,"%s%lu KB not yet purgeable on volume %s",(result==STATE_OK)?"":"Only ",non_purgeable_disk_space,volume_name);
514 } 514 }
515 515
516 /* check % not yet purgeable space on volume */ 516 /* check % not yet purgeable space on volume */
517 } else if (vars_to_check==CHECK_VPNP) { 517 } else if (vars_to_check==CHECK_VPNP) {
518 518
519 send_buffer = ssprintf(send_buffer,"VKNP%s\r\n",volume_name); 519 asprintf(&send_buffer,"VKNP%s\r\n",volume_name);
520 result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); 520 result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer));
521 if(result!=STATE_OK) 521 if(result!=STATE_OK)
522 return result; 522 return result;
523 523
524 if(!strcmp(recv_buffer,"-1\n")){ 524 if(!strcmp(recv_buffer,"-1\n")){
525 525
526 output_message = ssprintf(output_message,"Error: Volume '%s' does not exist!",volume_name); 526 asprintf(&output_message,"Error: Volume '%s' does not exist!",volume_name);
527 result=STATE_CRITICAL; 527 result=STATE_CRITICAL;
528 528
529 } else { 529 } else {
530 530
531 non_purgeable_disk_space=strtoul(recv_buffer,NULL,10); 531 non_purgeable_disk_space=strtoul(recv_buffer,NULL,10);
532 532
533 send_buffer = ssprintf(send_buffer,"VKS%s\r\n",volume_name); 533 asprintf(&send_buffer,"VKS%s\r\n",volume_name);
534 result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); 534 result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer));
535 if(result!=STATE_OK) 535 if(result!=STATE_OK)
536 return result; 536 return result;
@@ -543,13 +543,13 @@ int main(int argc, char **argv){
543 else if(check_warning_value==TRUE && percent_non_purgeable_space >= warning_value) 543 else if(check_warning_value==TRUE && percent_non_purgeable_space >= warning_value)
544 result=STATE_WARNING; 544 result=STATE_WARNING;
545 purgeable_disk_space/=1024; 545 purgeable_disk_space/=1024;
546 output_message = ssprintf(output_message,"%lu MB (%d%%) not yet purgeable on volume %s",non_purgeable_disk_space,percent_non_purgeable_space,volume_name); 546 asprintf(&output_message,"%lu MB (%d%%) not yet purgeable on volume %s",non_purgeable_disk_space,percent_non_purgeable_space,volume_name);
547 } 547 }
548 548
549 /* check # of open files */ 549 /* check # of open files */
550 } else if (vars_to_check==CHECK_OFILES) { 550 } else if (vars_to_check==CHECK_OFILES) {
551 551
552 send_buffer = ssprintf(send_buffer,"S18\r\n"); 552 asprintf(&send_buffer,"S18\r\n");
553 result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); 553 result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer));
554 if(result!=STATE_OK) 554 if(result!=STATE_OK)
555 return result; 555 return result;
@@ -561,12 +561,12 @@ int main(int argc, char **argv){
561 else if(check_warning_value==TRUE && open_files >= warning_value) 561 else if(check_warning_value==TRUE && open_files >= warning_value)
562 result=STATE_WARNING; 562 result=STATE_WARNING;
563 563
564 output_message = ssprintf(output_message,"%d open files",open_files); 564 asprintf(&output_message,"%d open files",open_files);
565 565
566 /* check # of abended threads (Netware 5.x only) */ 566 /* check # of abended threads (Netware 5.x only) */
567 } else if (vars_to_check==CHECK_ABENDS) { 567 } else if (vars_to_check==CHECK_ABENDS) {
568 568
569 send_buffer = ssprintf(send_buffer,"S17\r\n"); 569 asprintf(&send_buffer,"S17\r\n");
570 result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); 570 result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer));
571 if(result!=STATE_OK) 571 if(result!=STATE_OK)
572 return result; 572 return result;
@@ -578,19 +578,19 @@ int main(int argc, char **argv){
578 else if(check_warning_value==TRUE && abended_threads >= warning_value) 578 else if(check_warning_value==TRUE && abended_threads >= warning_value)
579 result=STATE_WARNING; 579 result=STATE_WARNING;
580 580
581 output_message = ssprintf(output_message,"%d abended threads",abended_threads); 581 asprintf(&output_message,"%d abended threads",abended_threads);
582 582
583 /* check # of current service processes (Netware 5.x only) */ 583 /* check # of current service processes (Netware 5.x only) */
584 } else if (vars_to_check==CHECK_CSPROCS) { 584 } else if (vars_to_check==CHECK_CSPROCS) {
585 585
586 send_buffer = ssprintf(send_buffer,"S20\r\n"); 586 asprintf(&send_buffer,"S20\r\n");
587 result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); 587 result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer));
588 if(result!=STATE_OK) 588 if(result!=STATE_OK)
589 return result; 589 return result;
590 590
591 max_service_processes=atoi(recv_buffer); 591 max_service_processes=atoi(recv_buffer);
592 592
593 send_buffer = ssprintf(send_buffer,"S21\r\n"); 593 sprintf(&send_buffer,"S21\r\n");
594 result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); 594 result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer));
595 if(result!=STATE_OK) 595 if(result!=STATE_OK)
596 return result; 596 return result;
@@ -602,7 +602,7 @@ int main(int argc, char **argv){
602 else if(check_warning_value==TRUE && current_service_processes >= warning_value) 602 else if(check_warning_value==TRUE && current_service_processes >= warning_value)
603 result=STATE_WARNING; 603 result=STATE_WARNING;
604 604
605 output_message = ssprintf(output_message,"%d current service processes (%d max)",current_service_processes,max_service_processes); 605 asprintf(&output_message,"%d current service processes (%d max)",current_service_processes,max_service_processes);
606 606
607 } else { 607 } else {
608 608