summaryrefslogtreecommitdiffstats
path: root/plugins/check_nwstat.c
diff options
context:
space:
mode:
authorAnders Kaseorg <andersk@mit.edu>2012-06-29 04:57:48 (GMT)
committerHolger Weiss <holger@zedat.fu-berlin.de>2012-06-29 11:39:11 (GMT)
commit028d50d6f99e647a325a0a68303016382c4bbdc9 (patch)
tree1d9a14635602169d137409becfa108cd6bdb371c /plugins/check_nwstat.c
parent9976876584e5a1df6e1c9315212c3d274df7a12e (diff)
downloadmonitoring-plugins-028d50d6f99e647a325a0a68303016382c4bbdc9.tar.gz
Die when asprintf fails
Fixes many instances of warning: ignoring return value of 'asprintf', declared with attribute warn_unused_result [-Wunused-result] Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Diffstat (limited to 'plugins/check_nwstat.c')
-rw-r--r--plugins/check_nwstat.c204
1 files changed, 102 insertions, 102 deletions
diff --git a/plugins/check_nwstat.c b/plugins/check_nwstat.c
index 81c5575..6ebe8f8 100644
--- a/plugins/check_nwstat.c
+++ b/plugins/check_nwstat.c
@@ -191,7 +191,7 @@ main(int argc, char **argv) {
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 asprintf (&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("");
@@ -215,7 +215,7 @@ main(int argc, char **argv) {
215 close(sd); 215 close(sd);
216 my_tcp_connect (server_address, server_port, &sd); 216 my_tcp_connect (server_address, server_port, &sd);
217 217
218 asprintf (&send_buffer,"UTIL%s\r\n",temp_buffer); 218 xasprintf (&send_buffer,"UTIL%s\r\n",temp_buffer);
219 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); 219 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
220 if (result!=STATE_OK) 220 if (result!=STATE_OK)
221 return result; 221 return result;
@@ -236,7 +236,7 @@ main(int argc, char **argv) {
236 else if (check_warning_value==TRUE && utilization >= warning_value) 236 else if (check_warning_value==TRUE && utilization >= warning_value)
237 result=STATE_WARNING; 237 result=STATE_WARNING;
238 238
239 asprintf (&output_message, 239 xasprintf (&output_message,
240 _("Load %s - %s %s-min load average = %lu%%|load%s=%lu;%lu;%lu;0;100"), 240 _("Load %s - %s %s-min load average = %lu%%|load%s=%lu;%lu;%lu;0;100"),
241 state_text(result), 241 state_text(result),
242 uptime, 242 uptime,
@@ -264,7 +264,7 @@ main(int argc, char **argv) {
264 else if (check_warning_value==TRUE && current_connections >= warning_value) 264 else if (check_warning_value==TRUE && current_connections >= warning_value)
265 result=STATE_WARNING; 265 result=STATE_WARNING;
266 266
267 asprintf (&output_message, 267 xasprintf (&output_message,
268 _("Conns %s - %lu current connections|Conns=%lu;%lu;%lu;;"), 268 _("Conns %s - %lu current connections|Conns=%lu;%lu;%lu;;"),
269 state_text(result), 269 state_text(result),
270 current_connections, 270 current_connections,
@@ -289,7 +289,7 @@ main(int argc, char **argv) {
289 else if (check_warning_value==TRUE && cache_hits <= warning_value) 289 else if (check_warning_value==TRUE && cache_hits <= warning_value)
290 result=STATE_WARNING; 290 result=STATE_WARNING;
291 291
292 asprintf (&output_message, 292 xasprintf (&output_message,
293 _("%s: Long term cache hits = %lu%%"), 293 _("%s: Long term cache hits = %lu%%"),
294 state_text(result), 294 state_text(result),
295 cache_hits); 295 cache_hits);
@@ -311,7 +311,7 @@ main(int argc, char **argv) {
311 else if (check_warning_value==TRUE && cache_buffers <= warning_value) 311 else if (check_warning_value==TRUE && cache_buffers <= warning_value)
312 result=STATE_WARNING; 312 result=STATE_WARNING;
313 313
314 asprintf (&output_message, 314 xasprintf (&output_message,
315 _("%s: Total cache buffers = %lu|Cachebuffers=%lu;%lu;%lu;;"), 315 _("%s: Total cache buffers = %lu|Cachebuffers=%lu;%lu;%lu;;"),
316 state_text(result), 316 state_text(result),
317 cache_buffers, 317 cache_buffers,
@@ -336,7 +336,7 @@ main(int argc, char **argv) {
336 else if (check_warning_value==TRUE && cache_buffers >= warning_value) 336 else if (check_warning_value==TRUE && cache_buffers >= warning_value)
337 result=STATE_WARNING; 337 result=STATE_WARNING;
338 338
339 asprintf (&output_message, 339 xasprintf (&output_message,
340 _("%s: Dirty cache buffers = %lu|Dirty-Cache-Buffers=%lu;%lu;%lu;;"), 340 _("%s: Dirty cache buffers = %lu|Dirty-Cache-Buffers=%lu;%lu;%lu;;"),
341 state_text(result), 341 state_text(result),
342 cache_buffers, 342 cache_buffers,
@@ -361,7 +361,7 @@ main(int argc, char **argv) {
361 else if (check_warning_value==TRUE && lru_time <= warning_value) 361 else if (check_warning_value==TRUE && lru_time <= warning_value)
362 result=STATE_WARNING; 362 result=STATE_WARNING;
363 363
364 asprintf (&output_message, 364 xasprintf (&output_message,
365 _("%s: LRU sitting time = %lu minutes"), 365 _("%s: LRU sitting time = %lu minutes"),
366 state_text(result), 366 state_text(result),
367 lru_time); 367 lru_time);
@@ -373,13 +373,13 @@ main(int argc, char **argv) {
373 close(sd); 373 close(sd);
374 my_tcp_connect (server_address, server_port, &sd); 374 my_tcp_connect (server_address, server_port, &sd);
375 375
376 asprintf (&send_buffer,"VKF%s\r\n",volume_name); 376 xasprintf (&send_buffer,"VKF%s\r\n",volume_name);
377 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); 377 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
378 if (result!=STATE_OK) 378 if (result!=STATE_OK)
379 return result; 379 return result;
380 380
381 if (!strcmp(recv_buffer,"-1\n")) { 381 if (!strcmp(recv_buffer,"-1\n")) {
382 asprintf (&output_message,_("CRITICAL - Volume '%s' does not exist!"),volume_name); 382 xasprintf (&output_message,_("CRITICAL - Volume '%s' does not exist!"),volume_name);
383 result=STATE_CRITICAL; 383 result=STATE_CRITICAL;
384 } else { 384 } else {
385 free_disk_space=strtoul(recv_buffer,NULL,10); 385 free_disk_space=strtoul(recv_buffer,NULL,10);
@@ -387,7 +387,7 @@ main(int argc, char **argv) {
387 result=STATE_CRITICAL; 387 result=STATE_CRITICAL;
388 else if (check_warning_value==TRUE && free_disk_space <= warning_value) 388 else if (check_warning_value==TRUE && free_disk_space <= warning_value)
389 result=STATE_WARNING; 389 result=STATE_WARNING;
390 asprintf (&output_message, 390 xasprintf (&output_message,
391 _("%s%lu KB free on volume %s|KBFree%s=%lu;%lu;%lu;;"), 391 _("%s%lu KB free on volume %s|KBFree%s=%lu;%lu;%lu;;"),
392 (result==STATE_OK)?"":_("Only "), 392 (result==STATE_OK)?"":_("Only "),
393 free_disk_space, 393 free_disk_space,
@@ -401,13 +401,13 @@ main(int argc, char **argv) {
401 /* check MB free space on volume */ 401 /* check MB free space on volume */
402 } else if (vars_to_check==VMF) { 402 } else if (vars_to_check==VMF) {
403 403
404 asprintf (&send_buffer,"VMF%s\r\n",volume_name); 404 xasprintf (&send_buffer,"VMF%s\r\n",volume_name);
405 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); 405 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
406 if (result!=STATE_OK) 406 if (result!=STATE_OK)
407 return result; 407 return result;
408 408
409 if (!strcmp(recv_buffer,"-1\n")) { 409 if (!strcmp(recv_buffer,"-1\n")) {
410 asprintf (&output_message,_("CRITICAL - Volume '%s' does not exist!"),volume_name); 410 xasprintf (&output_message,_("CRITICAL - Volume '%s' does not exist!"),volume_name);
411 result=STATE_CRITICAL; 411 result=STATE_CRITICAL;
412 } else { 412 } else {
413 free_disk_space=strtoul(recv_buffer,NULL,10); 413 free_disk_space=strtoul(recv_buffer,NULL,10);
@@ -415,7 +415,7 @@ main(int argc, char **argv) {
415 result=STATE_CRITICAL; 415 result=STATE_CRITICAL;
416 else if (check_warning_value==TRUE && free_disk_space <= warning_value) 416 else if (check_warning_value==TRUE && free_disk_space <= warning_value)
417 result=STATE_WARNING; 417 result=STATE_WARNING;
418 asprintf (&output_message, 418 xasprintf (&output_message,
419 _("%s%lu MB free on volume %s|MBFree%s=%lu;%lu;%lu;;"), 419 _("%s%lu MB free on volume %s|MBFree%s=%lu;%lu;%lu;;"),
420 (result==STATE_OK)?"":_("Only "), 420 (result==STATE_OK)?"":_("Only "),
421 free_disk_space, 421 free_disk_space,
@@ -428,13 +428,13 @@ main(int argc, char **argv) {
428 /* check MB used space on volume */ 428 /* check MB used space on volume */
429 } else if (vars_to_check==VMU) { 429 } else if (vars_to_check==VMU) {
430 430
431 asprintf (&send_buffer,"VMU%s\r\n",volume_name); 431 xasprintf (&send_buffer,"VMU%s\r\n",volume_name);
432 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); 432 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
433 if (result!=STATE_OK) 433 if (result!=STATE_OK)
434 return result; 434 return result;
435 435
436 if (!strcmp(recv_buffer,"-1\n")) { 436 if (!strcmp(recv_buffer,"-1\n")) {
437 asprintf (&output_message,_("CRITICAL - Volume '%s' does not exist!"),volume_name); 437 xasprintf (&output_message,_("CRITICAL - Volume '%s' does not exist!"),volume_name);
438 result=STATE_CRITICAL; 438 result=STATE_CRITICAL;
439 } else { 439 } else {
440 free_disk_space=strtoul(recv_buffer,NULL,10); 440 free_disk_space=strtoul(recv_buffer,NULL,10);
@@ -442,7 +442,7 @@ main(int argc, char **argv) {
442 result=STATE_CRITICAL; 442 result=STATE_CRITICAL;
443 else if (check_warning_value==TRUE && free_disk_space <= warning_value) 443 else if (check_warning_value==TRUE && free_disk_space <= warning_value)
444 result=STATE_WARNING; 444 result=STATE_WARNING;
445 asprintf (&output_message, 445 xasprintf (&output_message,
446 _("%s%lu MB used on volume %s|MBUsed%s=%lu;%lu;%lu;;"), 446 _("%s%lu MB used on volume %s|MBUsed%s=%lu;%lu;%lu;;"),
447 (result==STATE_OK)?"":_("Only "), 447 (result==STATE_OK)?"":_("Only "),
448 free_disk_space, 448 free_disk_space,
@@ -460,14 +460,14 @@ main(int argc, char **argv) {
460 close(sd); 460 close(sd);
461 my_tcp_connect (server_address, server_port, &sd); 461 my_tcp_connect (server_address, server_port, &sd);
462 462
463 asprintf (&send_buffer,"VKF%s\r\n",volume_name); 463 xasprintf (&send_buffer,"VKF%s\r\n",volume_name);
464 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); 464 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
465 if (result!=STATE_OK) 465 if (result!=STATE_OK)
466 return result; 466 return result;
467 467
468 if (!strcmp(recv_buffer,"-1\n")) { 468 if (!strcmp(recv_buffer,"-1\n")) {
469 469
470 asprintf (&output_message,_("CRITICAL - Volume '%s' does not exist!"),volume_name); 470 xasprintf (&output_message,_("CRITICAL - Volume '%s' does not exist!"),volume_name);
471 result=STATE_CRITICAL; 471 result=STATE_CRITICAL;
472 472
473 } else { 473 } else {
@@ -477,7 +477,7 @@ main(int argc, char **argv) {
477 close(sd); 477 close(sd);
478 my_tcp_connect (server_address, server_port, &sd); 478 my_tcp_connect (server_address, server_port, &sd);
479 479
480 asprintf (&send_buffer,"VKS%s\r\n",volume_name); 480 xasprintf (&send_buffer,"VKS%s\r\n",volume_name);
481 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); 481 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
482 if (result!=STATE_OK) 482 if (result!=STATE_OK)
483 return result; 483 return result;
@@ -491,7 +491,7 @@ main(int argc, char **argv) {
491 result=STATE_WARNING; 491 result=STATE_WARNING;
492 free_disk_space/=1024; 492 free_disk_space/=1024;
493 total_disk_space/=1024; 493 total_disk_space/=1024;
494 asprintf (&output_message,_("%lu MB (%lu%%) free on volume %s - total %lu MB|FreeMB%s=%lu;%lu;%lu;0;100"), 494 xasprintf (&output_message,_("%lu MB (%lu%%) free on volume %s - total %lu MB|FreeMB%s=%lu;%lu;%lu;0;100"),
495 free_disk_space, 495 free_disk_space,
496 percent_free_space, 496 percent_free_space,
497 volume_name, 497 volume_name,
@@ -525,7 +525,7 @@ main(int argc, char **argv) {
525 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); 525 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
526 temp_buffer=strtok(recv_buffer,"\r\n"); 526 temp_buffer=strtok(recv_buffer,"\r\n");
527 527
528 asprintf (&output_message,_("Directory Services Database is %s (DS version %s)"),(result==STATE_OK)?"open":"closed",temp_buffer); 528 xasprintf (&output_message,_("Directory Services Database is %s (DS version %s)"),(result==STATE_OK)?"open":"closed",temp_buffer);
529 529
530 /* check to see if logins are enabled */ 530 /* check to see if logins are enabled */
531 } else if (vars_to_check==LOGINS) { 531 } else if (vars_to_check==LOGINS) {
@@ -542,13 +542,13 @@ main(int argc, char **argv) {
542 else 542 else
543 result=STATE_WARNING; 543 result=STATE_WARNING;
544 544
545 asprintf (&output_message,_("Logins are %s"),(result==STATE_OK)?_("enabled"):_("disabled")); 545 xasprintf (&output_message,_("Logins are %s"),(result==STATE_OK)?_("enabled"):_("disabled"));
546 546
547 547
548 /* check NRM Health Status Summary*/ 548 /* check NRM Health Status Summary*/
549 } else if (vars_to_check==NRMH) { 549 } else if (vars_to_check==NRMH) {
550 550
551 asprintf (&send_buffer,"NRMH\r\n"); 551 xasprintf (&send_buffer,"NRMH\r\n");
552 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); 552 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
553 if (result!=STATE_OK) 553 if (result!=STATE_OK)
554 return result; 554 return result;
@@ -557,15 +557,15 @@ main(int argc, char **argv) {
557 557
558 if (nrm_health_status==2) { 558 if (nrm_health_status==2) {
559 result=STATE_OK; 559 result=STATE_OK;
560 asprintf (&output_message,_("CRITICAL - NRM Status is bad!")); 560 xasprintf (&output_message,_("CRITICAL - NRM Status is bad!"));
561 } 561 }
562 else { 562 else {
563 if (nrm_health_status==1) { 563 if (nrm_health_status==1) {
564 result=STATE_WARNING; 564 result=STATE_WARNING;
565 asprintf (&output_message,_("Warning - NRM Status is suspect!")); 565 xasprintf (&output_message,_("Warning - NRM Status is suspect!"));
566 } 566 }
567 567
568 asprintf (&output_message,_("OK - NRM Status is good!")); 568 xasprintf (&output_message,_("OK - NRM Status is good!"));
569 } 569 }
570 570
571 571
@@ -576,7 +576,7 @@ main(int argc, char **argv) {
576 close(sd); 576 close(sd);
577 my_tcp_connect (server_address, server_port, &sd); 577 my_tcp_connect (server_address, server_port, &sd);
578 578
579 asprintf (&send_buffer,"S15\r\n"); 579 xasprintf (&send_buffer,"S15\r\n");
580 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); 580 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
581 if (result!=STATE_OK) 581 if (result!=STATE_OK)
582 return result; 582 return result;
@@ -586,7 +586,7 @@ main(int argc, char **argv) {
586 close(sd); 586 close(sd);
587 my_tcp_connect (server_address, server_port, &sd); 587 my_tcp_connect (server_address, server_port, &sd);
588 588
589 asprintf (&send_buffer,"S16\r\n"); 589 xasprintf (&send_buffer,"S16\r\n");
590 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); 590 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
591 if (result!=STATE_OK) 591 if (result!=STATE_OK)
592 return result; 592 return result;
@@ -607,7 +607,7 @@ main(int argc, char **argv) {
607 result=STATE_WARNING; 607 result=STATE_WARNING;
608 } 608 }
609 609
610 asprintf (&output_message,_("%lu of %lu (%lu%%) packet receive buffers used"),used_packet_receive_buffers,max_packet_receive_buffers,percent_used_packet_receive_buffers); 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);
611 611
612 /* check SAP table entries */ 612 /* check SAP table entries */
613 } else if (vars_to_check==SAPENTRIES) { 613 } else if (vars_to_check==SAPENTRIES) {
@@ -616,9 +616,9 @@ main(int argc, char **argv) {
616 my_tcp_connect (server_address, server_port, &sd); 616 my_tcp_connect (server_address, server_port, &sd);
617 617
618 if (sap_number==-1) 618 if (sap_number==-1)
619 asprintf (&send_buffer,"S9\r\n"); 619 xasprintf (&send_buffer,"S9\r\n");
620 else 620 else
621 asprintf (&send_buffer,"S9.%d\r\n",sap_number); 621 xasprintf (&send_buffer,"S9.%d\r\n",sap_number);
622 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); 622 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
623 if (result!=STATE_OK) 623 if (result!=STATE_OK)
624 return result; 624 return result;
@@ -631,9 +631,9 @@ main(int argc, char **argv) {
631 result=STATE_WARNING; 631 result=STATE_WARNING;
632 632
633 if (sap_number==-1) 633 if (sap_number==-1)
634 asprintf (&output_message,_("%lu entries in SAP table"),sap_entries); 634 xasprintf (&output_message,_("%lu entries in SAP table"),sap_entries);
635 else 635 else
636 asprintf (&output_message,_("%lu entries in SAP table for SAP type %d"),sap_entries,sap_number); 636 xasprintf (&output_message,_("%lu entries in SAP table for SAP type %d"),sap_entries,sap_number);
637 637
638 /* check KB purgeable space on volume */ 638 /* check KB purgeable space on volume */
639 } else if (vars_to_check==VKP) { 639 } else if (vars_to_check==VKP) {
@@ -641,13 +641,13 @@ main(int argc, char **argv) {
641 close(sd); 641 close(sd);
642 my_tcp_connect (server_address, server_port, &sd); 642 my_tcp_connect (server_address, server_port, &sd);
643 643
644 asprintf (&send_buffer,"VKP%s\r\n",volume_name); 644 xasprintf (&send_buffer,"VKP%s\r\n",volume_name);
645 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); 645 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
646 if (result!=STATE_OK) 646 if (result!=STATE_OK)
647 return result; 647 return result;
648 648
649 if (!strcmp(recv_buffer,"-1\n")) { 649 if (!strcmp(recv_buffer,"-1\n")) {
650 asprintf (&output_message,_("CRITICAL - Volume '%s' does not exist!"),volume_name); 650 xasprintf (&output_message,_("CRITICAL - Volume '%s' does not exist!"),volume_name);
651 result=STATE_CRITICAL; 651 result=STATE_CRITICAL;
652 } else { 652 } else {
653 purgeable_disk_space=strtoul(recv_buffer,NULL,10); 653 purgeable_disk_space=strtoul(recv_buffer,NULL,10);
@@ -655,7 +655,7 @@ main(int argc, char **argv) {
655 result=STATE_CRITICAL; 655 result=STATE_CRITICAL;
656 else if (check_warning_value==TRUE && purgeable_disk_space >= warning_value) 656 else if (check_warning_value==TRUE && purgeable_disk_space >= warning_value)
657 result=STATE_WARNING; 657 result=STATE_WARNING;
658 asprintf (&output_message,_("%s%lu KB purgeable on volume %s|Purge%s=%lu;%lu;%lu;;"), 658 xasprintf (&output_message,_("%s%lu KB purgeable on volume %s|Purge%s=%lu;%lu;%lu;;"),
659 (result==STATE_OK)?"":_("Only "), 659 (result==STATE_OK)?"":_("Only "),
660 purgeable_disk_space, 660 purgeable_disk_space,
661 volume_name, 661 volume_name,
@@ -667,13 +667,13 @@ main(int argc, char **argv) {
667 /* check MB purgeable space on volume */ 667 /* check MB purgeable space on volume */
668 } else if (vars_to_check==VMP) { 668 } else if (vars_to_check==VMP) {
669 669
670 asprintf (&send_buffer,"VMP%s\r\n",volume_name); 670 xasprintf (&send_buffer,"VMP%s\r\n",volume_name);
671 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); 671 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
672 if (result!=STATE_OK) 672 if (result!=STATE_OK)
673 return result; 673 return result;
674 674
675 if (!strcmp(recv_buffer,"-1\n")) { 675 if (!strcmp(recv_buffer,"-1\n")) {
676 asprintf (&output_message,_("CRITICAL - Volume '%s' does not exist!"),volume_name); 676 xasprintf (&output_message,_("CRITICAL - Volume '%s' does not exist!"),volume_name);
677 result=STATE_CRITICAL; 677 result=STATE_CRITICAL;
678 } else { 678 } else {
679 purgeable_disk_space=strtoul(recv_buffer,NULL,10); 679 purgeable_disk_space=strtoul(recv_buffer,NULL,10);
@@ -681,7 +681,7 @@ main(int argc, char **argv) {
681 result=STATE_CRITICAL; 681 result=STATE_CRITICAL;
682 else if (check_warning_value==TRUE && purgeable_disk_space >= warning_value) 682 else if (check_warning_value==TRUE && purgeable_disk_space >= warning_value)
683 result=STATE_WARNING; 683 result=STATE_WARNING;
684 asprintf (&output_message,_("%s%lu MB purgeable on volume %s|Purge%s=%lu;%lu;%lu;;"), 684 xasprintf (&output_message,_("%s%lu MB purgeable on volume %s|Purge%s=%lu;%lu;%lu;;"),
685 (result==STATE_OK)?"":_("Only "), 685 (result==STATE_OK)?"":_("Only "),
686 purgeable_disk_space, 686 purgeable_disk_space,
687 volume_name, 687 volume_name,
@@ -697,14 +697,14 @@ main(int argc, char **argv) {
697 close(sd); 697 close(sd);
698 my_tcp_connect (server_address, server_port, &sd); 698 my_tcp_connect (server_address, server_port, &sd);
699 699
700 asprintf (&send_buffer,"VKP%s\r\n",volume_name); 700 xasprintf (&send_buffer,"VKP%s\r\n",volume_name);
701 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); 701 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
702 if (result!=STATE_OK) 702 if (result!=STATE_OK)
703 return result; 703 return result;
704 704
705 if (!strcmp(recv_buffer,"-1\n")) { 705 if (!strcmp(recv_buffer,"-1\n")) {
706 706
707 asprintf (&output_message,_("CRITICAL - Volume '%s' does not exist!"),volume_name); 707 xasprintf (&output_message,_("CRITICAL - Volume '%s' does not exist!"),volume_name);
708 result=STATE_CRITICAL; 708 result=STATE_CRITICAL;
709 709
710 } else { 710 } else {
@@ -714,7 +714,7 @@ main(int argc, char **argv) {
714 close(sd); 714 close(sd);
715 my_tcp_connect (server_address, server_port, &sd); 715 my_tcp_connect (server_address, server_port, &sd);
716 716
717 asprintf (&send_buffer,"VKS%s\r\n",volume_name); 717 xasprintf (&send_buffer,"VKS%s\r\n",volume_name);
718 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); 718 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
719 if (result!=STATE_OK) 719 if (result!=STATE_OK)
720 return result; 720 return result;
@@ -727,7 +727,7 @@ main(int argc, char **argv) {
727 else if (check_warning_value==TRUE && percent_purgeable_space >= warning_value) 727 else if (check_warning_value==TRUE && percent_purgeable_space >= warning_value)
728 result=STATE_WARNING; 728 result=STATE_WARNING;
729 purgeable_disk_space/=1024; 729 purgeable_disk_space/=1024;
730 asprintf (&output_message,_("%lu MB (%lu%%) purgeable on volume %s|Purgeable%s=%lu;%lu;%lu;0;100"), 730 xasprintf (&output_message,_("%lu MB (%lu%%) purgeable on volume %s|Purgeable%s=%lu;%lu;%lu;0;100"),
731 purgeable_disk_space, 731 purgeable_disk_space,
732 percent_purgeable_space, 732 percent_purgeable_space,
733 volume_name, 733 volume_name,
@@ -744,13 +744,13 @@ main(int argc, char **argv) {
744 close(sd); 744 close(sd);
745 my_tcp_connect (server_address, server_port, &sd); 745 my_tcp_connect (server_address, server_port, &sd);
746 746
747 asprintf (&send_buffer,"VKNP%s\r\n",volume_name); 747 xasprintf (&send_buffer,"VKNP%s\r\n",volume_name);
748 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); 748 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
749 if (result!=STATE_OK) 749 if (result!=STATE_OK)
750 return result; 750 return result;
751 751
752 if (!strcmp(recv_buffer,"-1\n")) { 752 if (!strcmp(recv_buffer,"-1\n")) {
753 asprintf (&output_message,_("CRITICAL - Volume '%s' does not exist!"),volume_name); 753 xasprintf (&output_message,_("CRITICAL - Volume '%s' does not exist!"),volume_name);
754 result=STATE_CRITICAL; 754 result=STATE_CRITICAL;
755 } else { 755 } else {
756 non_purgeable_disk_space=strtoul(recv_buffer,NULL,10); 756 non_purgeable_disk_space=strtoul(recv_buffer,NULL,10);
@@ -758,7 +758,7 @@ main(int argc, char **argv) {
758 result=STATE_CRITICAL; 758 result=STATE_CRITICAL;
759 else if (check_warning_value==TRUE && non_purgeable_disk_space >= warning_value) 759 else if (check_warning_value==TRUE && non_purgeable_disk_space >= warning_value)
760 result=STATE_WARNING; 760 result=STATE_WARNING;
761 asprintf (&output_message,_("%s%lu KB not yet purgeable on volume %s"),(result==STATE_OK)?"":_("Only "),non_purgeable_disk_space,volume_name); 761 xasprintf (&output_message,_("%s%lu KB not yet purgeable on volume %s"),(result==STATE_OK)?"":_("Only "),non_purgeable_disk_space,volume_name);
762 } 762 }
763 763
764 /* check % not yet purgeable space on volume */ 764 /* check % not yet purgeable space on volume */
@@ -767,14 +767,14 @@ main(int argc, char **argv) {
767 close(sd); 767 close(sd);
768 my_tcp_connect (server_address, server_port, &sd); 768 my_tcp_connect (server_address, server_port, &sd);
769 769
770 asprintf (&send_buffer,"VKNP%s\r\n",volume_name); 770 xasprintf (&send_buffer,"VKNP%s\r\n",volume_name);
771 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); 771 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
772 if (result!=STATE_OK) 772 if (result!=STATE_OK)
773 return result; 773 return result;
774 774
775 if (!strcmp(recv_buffer,"-1\n")) { 775 if (!strcmp(recv_buffer,"-1\n")) {
776 776
777 asprintf (&output_message,_("CRITICAL - Volume '%s' does not exist!"),volume_name); 777 xasprintf (&output_message,_("CRITICAL - Volume '%s' does not exist!"),volume_name);
778 result=STATE_CRITICAL; 778 result=STATE_CRITICAL;
779 779
780 } else { 780 } else {
@@ -784,7 +784,7 @@ main(int argc, char **argv) {
784 close(sd); 784 close(sd);
785 my_tcp_connect (server_address, server_port, &sd); 785 my_tcp_connect (server_address, server_port, &sd);
786 786
787 asprintf (&send_buffer,"VKS%s\r\n",volume_name); 787 xasprintf (&send_buffer,"VKS%s\r\n",volume_name);
788 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));
789 if (result!=STATE_OK) 789 if (result!=STATE_OK)
790 return result; 790 return result;
@@ -797,7 +797,7 @@ main(int argc, char **argv) {
797 else if (check_warning_value==TRUE && percent_non_purgeable_space >= warning_value) 797 else if (check_warning_value==TRUE && percent_non_purgeable_space >= warning_value)
798 result=STATE_WARNING; 798 result=STATE_WARNING;
799 purgeable_disk_space/=1024; 799 purgeable_disk_space/=1024;
800 asprintf (&output_message,_("%lu MB (%lu%%) not yet purgeable on volume %s"),non_purgeable_disk_space,percent_non_purgeable_space,volume_name); 800 xasprintf (&output_message,_("%lu MB (%lu%%) not yet purgeable on volume %s"),non_purgeable_disk_space,percent_non_purgeable_space,volume_name);
801 } 801 }
802 802
803 /* check # of open files */ 803 /* check # of open files */
@@ -806,7 +806,7 @@ main(int argc, char **argv) {
806 close(sd); 806 close(sd);
807 my_tcp_connect (server_address, server_port, &sd); 807 my_tcp_connect (server_address, server_port, &sd);
808 808
809 asprintf (&send_buffer,"S18\r\n"); 809 xasprintf (&send_buffer,"S18\r\n");
810 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); 810 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
811 if (result!=STATE_OK) 811 if (result!=STATE_OK)
812 return result; 812 return result;
@@ -818,7 +818,7 @@ main(int argc, char **argv) {
818 else if (check_warning_value==TRUE && open_files >= warning_value) 818 else if (check_warning_value==TRUE && open_files >= warning_value)
819 result=STATE_WARNING; 819 result=STATE_WARNING;
820 820
821 asprintf (&output_message,_("%lu open files|Openfiles=%lu;%lu;%lu;0,0"), 821 xasprintf (&output_message,_("%lu open files|Openfiles=%lu;%lu;%lu;0,0"),
822 open_files, 822 open_files,
823 open_files, 823 open_files,
824 warning_value, 824 warning_value,
@@ -831,7 +831,7 @@ main(int argc, char **argv) {
831 close(sd); 831 close(sd);
832 my_tcp_connect (server_address, server_port, &sd); 832 my_tcp_connect (server_address, server_port, &sd);
833 833
834 asprintf (&send_buffer,"S17\r\n"); 834 xasprintf (&send_buffer,"S17\r\n");
835 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); 835 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
836 if (result!=STATE_OK) 836 if (result!=STATE_OK)
837 return result; 837 return result;
@@ -843,7 +843,7 @@ main(int argc, char **argv) {
843 else if (check_warning_value==TRUE && abended_threads >= warning_value) 843 else if (check_warning_value==TRUE && abended_threads >= warning_value)
844 result=STATE_WARNING; 844 result=STATE_WARNING;
845 845
846 asprintf (&output_message,_("%lu abended threads|Abends=%lu;%lu;%lu;;"), 846 xasprintf (&output_message,_("%lu abended threads|Abends=%lu;%lu;%lu;;"),
847 abended_threads, 847 abended_threads,
848 abended_threads, 848 abended_threads,
849 warning_value, 849 warning_value,
@@ -855,7 +855,7 @@ main(int argc, char **argv) {
855 close(sd); 855 close(sd);
856 my_tcp_connect (server_address, server_port, &sd); 856 my_tcp_connect (server_address, server_port, &sd);
857 857
858 asprintf (&send_buffer,"S20\r\n"); 858 xasprintf (&send_buffer,"S20\r\n");
859 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); 859 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
860 if (result!=STATE_OK) 860 if (result!=STATE_OK)
861 return result; 861 return result;
@@ -865,7 +865,7 @@ main(int argc, char **argv) {
865 close(sd); 865 close(sd);
866 my_tcp_connect (server_address, server_port, &sd); 866 my_tcp_connect (server_address, server_port, &sd);
867 867
868 asprintf (&send_buffer,"S21\r\n"); 868 xasprintf (&send_buffer,"S21\r\n");
869 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); 869 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
870 if (result!=STATE_OK) 870 if (result!=STATE_OK)
871 return result; 871 return result;
@@ -877,7 +877,7 @@ main(int argc, char **argv) {
877 else if (check_warning_value==TRUE && current_service_processes >= warning_value) 877 else if (check_warning_value==TRUE && current_service_processes >= warning_value)
878 result=STATE_WARNING; 878 result=STATE_WARNING;
879 879
880 asprintf (&output_message, 880 xasprintf (&output_message,
881 _("%lu current service processes (%lu max)|Processes=%lu;%lu;%lu;0;%lu"), 881 _("%lu current service processes (%lu max)|Processes=%lu;%lu;%lu;0;%lu"),
882 current_service_processes, 882 current_service_processes,
883 max_service_processes, 883 max_service_processes,
@@ -892,7 +892,7 @@ main(int argc, char **argv) {
892 close(sd); 892 close(sd);
893 my_tcp_connect (server_address, server_port, &sd); 893 my_tcp_connect (server_address, server_port, &sd);
894 894
895 asprintf (&send_buffer,"S22\r\n"); 895 xasprintf (&send_buffer,"S22\r\n");
896 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); 896 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
897 if (result!=STATE_OK) 897 if (result!=STATE_OK)
898 return result; 898 return result;
@@ -901,10 +901,10 @@ main(int argc, char **argv) {
901 901
902 if (time_sync_status==0) { 902 if (time_sync_status==0) {
903 result=STATE_CRITICAL; 903 result=STATE_CRITICAL;
904 asprintf (&output_message,_("CRITICAL - Time not in sync with network!")); 904 xasprintf (&output_message,_("CRITICAL - Time not in sync with network!"));
905 } 905 }
906 else { 906 else {
907 asprintf (&output_message,_("OK - Time in sync with network!")); 907 xasprintf (&output_message,_("OK - Time in sync with network!"));
908 } 908 }
909 909
910 910
@@ -927,7 +927,7 @@ main(int argc, char **argv) {
927 result=STATE_CRITICAL; 927 result=STATE_CRITICAL;
928 else if (check_warning_value==TRUE && lru_time <= warning_value) 928 else if (check_warning_value==TRUE && lru_time <= warning_value)
929 result=STATE_WARNING; 929 result=STATE_WARNING;
930 asprintf (&output_message,_("LRU sitting time = %lu seconds"),lru_time); 930 xasprintf (&output_message,_("LRU sitting time = %lu seconds"),lru_time);
931 931
932 932
933 /* check % dirty cacheobuffers as a percentage of the total*/ 933 /* check % dirty cacheobuffers as a percentage of the total*/
@@ -946,7 +946,7 @@ main(int argc, char **argv) {
946 result=STATE_CRITICAL; 946 result=STATE_CRITICAL;
947 else if (check_warning_value==TRUE && dirty_cache_buffers <= warning_value) 947 else if (check_warning_value==TRUE && dirty_cache_buffers <= warning_value)
948 result=STATE_WARNING; 948 result=STATE_WARNING;
949 asprintf (&output_message,_("Dirty cache buffers = %lu%% of the total|DCB=%lu;%lu;%lu;0;100"), 949 xasprintf (&output_message,_("Dirty cache buffers = %lu%% of the total|DCB=%lu;%lu;%lu;0;100"),
950 dirty_cache_buffers, 950 dirty_cache_buffers,
951 dirty_cache_buffers, 951 dirty_cache_buffers,
952 warning_value, 952 warning_value,
@@ -968,7 +968,7 @@ main(int argc, char **argv) {
968 result=STATE_CRITICAL; 968 result=STATE_CRITICAL;
969 else if (check_warning_value==TRUE && total_cache_buffers <= warning_value) 969 else if (check_warning_value==TRUE && total_cache_buffers <= warning_value)
970 result=STATE_WARNING; 970 result=STATE_WARNING;
971 asprintf (&output_message,_("Total cache buffers = %lu%% of the original|TCB=%lu;%lu;%lu;0;100"), 971 xasprintf (&output_message,_("Total cache buffers = %lu%% of the original|TCB=%lu;%lu;%lu;0;100"),
972 total_cache_buffers, 972 total_cache_buffers,
973 total_cache_buffers, 973 total_cache_buffers,
974 warning_value, 974 warning_value,
@@ -979,21 +979,21 @@ main(int argc, char **argv) {
979 close(sd); 979 close(sd);
980 my_tcp_connect (server_address, server_port, &sd); 980 my_tcp_connect (server_address, server_port, &sd);
981 981
982 asprintf (&send_buffer,"S13\r\n"); 982 xasprintf (&send_buffer,"S13\r\n");
983 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); 983 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
984 if (result!=STATE_OK) 984 if (result!=STATE_OK)
985 return result; 985 return result;
986 986
987 recv_buffer[strlen(recv_buffer)-1]=0; 987 recv_buffer[strlen(recv_buffer)-1]=0;
988 988
989 asprintf (&output_message,_("NDS Version %s"),recv_buffer); 989 xasprintf (&output_message,_("NDS Version %s"),recv_buffer);
990 990
991 } else if (vars_to_check==UPTIME) { 991 } else if (vars_to_check==UPTIME) {
992 992
993 close(sd); 993 close(sd);
994 my_tcp_connect (server_address, server_port, &sd); 994 my_tcp_connect (server_address, server_port, &sd);
995 995
996 asprintf (&send_buffer,"UPTIME\r\n"); 996 xasprintf (&send_buffer,"UPTIME\r\n");
997 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); 997 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
998 if (result!=STATE_OK) 998 if (result!=STATE_OK)
999 return result; 999 return result;
@@ -1002,35 +1002,35 @@ main(int argc, char **argv) {
1002 recv_buffer[sizeof(recv_buffer)-1]=0; 1002 recv_buffer[sizeof(recv_buffer)-1]=0;
1003 recv_buffer[strlen(recv_buffer)-1]=0; 1003 recv_buffer[strlen(recv_buffer)-1]=0;
1004 1004
1005 asprintf (&output_message,_("Up %s"),recv_buffer); 1005 xasprintf (&output_message,_("Up %s"),recv_buffer);
1006 1006
1007 } else if (vars_to_check==NLM) { 1007 } else if (vars_to_check==NLM) {
1008 1008
1009 close(sd); 1009 close(sd);
1010 my_tcp_connect (server_address, server_port, &sd); 1010 my_tcp_connect (server_address, server_port, &sd);
1011 1011
1012 asprintf (&send_buffer,"S24:%s\r\n",nlm_name); 1012 xasprintf (&send_buffer,"S24:%s\r\n",nlm_name);
1013 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); 1013 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
1014 if (result!=STATE_OK) 1014 if (result!=STATE_OK)
1015 return result; 1015 return result;
1016 1016
1017 recv_buffer[strlen(recv_buffer)-1]=0; 1017 recv_buffer[strlen(recv_buffer)-1]=0;
1018 if (strcmp(recv_buffer,"-1")) { 1018 if (strcmp(recv_buffer,"-1")) {
1019 asprintf (&output_message,_("Module %s version %s is loaded"),nlm_name,recv_buffer); 1019 xasprintf (&output_message,_("Module %s version %s is loaded"),nlm_name,recv_buffer);
1020 } else { 1020 } else {
1021 result=STATE_CRITICAL; 1021 result=STATE_CRITICAL;
1022 asprintf (&output_message,_("Module %s is not loaded"),nlm_name); 1022 xasprintf (&output_message,_("Module %s is not loaded"),nlm_name);
1023 1023
1024 } 1024 }
1025 } else if (vars_to_check==NRMP) { 1025 } else if (vars_to_check==NRMP) {
1026 1026
1027 asprintf (&send_buffer,"NRMP:%s\r\n",nrmp_name); 1027 xasprintf (&send_buffer,"NRMP:%s\r\n",nrmp_name);
1028 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); 1028 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
1029 if (result!=STATE_OK) 1029 if (result!=STATE_OK)
1030 return result; 1030 return result;
1031 1031
1032 if (!strcmp(recv_buffer,"-1\n")) { 1032 if (!strcmp(recv_buffer,"-1\n")) {
1033 asprintf (&output_message,_("CRITICAL - Value '%s' does not exist!"),nrmp_name); 1033 xasprintf (&output_message,_("CRITICAL - Value '%s' does not exist!"),nrmp_name);
1034 result=STATE_CRITICAL; 1034 result=STATE_CRITICAL;
1035 } else { 1035 } else {
1036 nrmp_value=strtoul(recv_buffer,NULL,10); 1036 nrmp_value=strtoul(recv_buffer,NULL,10);
@@ -1038,7 +1038,7 @@ main(int argc, char **argv) {
1038 result=STATE_CRITICAL; 1038 result=STATE_CRITICAL;
1039 else if (check_warning_value==TRUE && nrmp_value <= warning_value) 1039 else if (check_warning_value==TRUE && nrmp_value <= warning_value)
1040 result=STATE_WARNING; 1040 result=STATE_WARNING;
1041 asprintf (&output_message, 1041 xasprintf (&output_message,
1042 _("%s is %lu|%s=%lu;%lu;%lu;;"), 1042 _("%s is %lu|%s=%lu;%lu;%lu;;"),
1043 nrmp_name, 1043 nrmp_name,
1044 nrmp_value, 1044 nrmp_value,
@@ -1050,13 +1050,13 @@ main(int argc, char **argv) {
1050 1050
1051 } else if (vars_to_check==NRMM) { 1051 } else if (vars_to_check==NRMM) {
1052 1052
1053 asprintf (&send_buffer,"NRMM:%s\r\n",nrmm_name); 1053 xasprintf (&send_buffer,"NRMM:%s\r\n",nrmm_name);
1054 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); 1054 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
1055 if (result!=STATE_OK) 1055 if (result!=STATE_OK)
1056 return result; 1056 return result;
1057 1057
1058 if (!strcmp(recv_buffer,"-1\n")) { 1058 if (!strcmp(recv_buffer,"-1\n")) {
1059 asprintf (&output_message,_("CRITICAL - Value '%s' does not exist!"),nrmm_name); 1059 xasprintf (&output_message,_("CRITICAL - Value '%s' does not exist!"),nrmm_name);
1060 result=STATE_CRITICAL; 1060 result=STATE_CRITICAL;
1061 } else { 1061 } else {
1062 nrmm_value=strtoul(recv_buffer,NULL,10); 1062 nrmm_value=strtoul(recv_buffer,NULL,10);
@@ -1064,7 +1064,7 @@ main(int argc, char **argv) {
1064 result=STATE_CRITICAL; 1064 result=STATE_CRITICAL;
1065 else if (check_warning_value==TRUE && nrmm_value <= warning_value) 1065 else if (check_warning_value==TRUE && nrmm_value <= warning_value)
1066 result=STATE_WARNING; 1066 result=STATE_WARNING;
1067 asprintf (&output_message, 1067 xasprintf (&output_message,
1068 _("%s is %lu|%s=%lu;%lu;%lu;;"), 1068 _("%s is %lu|%s=%lu;%lu;%lu;;"),
1069 nrmm_name, 1069 nrmm_name,
1070 nrmm_value, 1070 nrmm_value,
@@ -1076,13 +1076,13 @@ main(int argc, char **argv) {
1076 1076
1077 } else if (vars_to_check==NRMS) { 1077 } else if (vars_to_check==NRMS) {
1078 1078
1079 asprintf (&send_buffer,"NRMS:%s\r\n",nrms_name); 1079 xasprintf (&send_buffer,"NRMS:%s\r\n",nrms_name);
1080 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); 1080 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
1081 if (result!=STATE_OK) 1081 if (result!=STATE_OK)
1082 return result; 1082 return result;
1083 1083
1084 if (!strcmp(recv_buffer,"-1\n")) { 1084 if (!strcmp(recv_buffer,"-1\n")) {
1085 asprintf (&output_message,_("CRITICAL - Value '%s' does not exist!"),nrms_name); 1085 xasprintf (&output_message,_("CRITICAL - Value '%s' does not exist!"),nrms_name);
1086 result=STATE_CRITICAL; 1086 result=STATE_CRITICAL;
1087 } else { 1087 } else {
1088 nrms_value=strtoul(recv_buffer,NULL,10); 1088 nrms_value=strtoul(recv_buffer,NULL,10);
@@ -1090,7 +1090,7 @@ main(int argc, char **argv) {
1090 result=STATE_CRITICAL; 1090 result=STATE_CRITICAL;
1091 else if (check_warning_value==TRUE && nrms_value >= warning_value) 1091 else if (check_warning_value==TRUE && nrms_value >= warning_value)
1092 result=STATE_WARNING; 1092 result=STATE_WARNING;
1093 asprintf (&output_message, 1093 xasprintf (&output_message,
1094 _("%s is %lu|%s=%lu;%lu;%lu;;"), 1094 _("%s is %lu|%s=%lu;%lu;%lu;;"),
1095 nrms_name, 1095 nrms_name,
1096 nrms_value, 1096 nrms_value,
@@ -1102,13 +1102,13 @@ main(int argc, char **argv) {
1102 1102
1103 } else if (vars_to_check==NSS1) { 1103 } else if (vars_to_check==NSS1) {
1104 1104
1105 asprintf (&send_buffer,"NSS1:%s\r\n",nss1_name); 1105 xasprintf (&send_buffer,"NSS1:%s\r\n",nss1_name);
1106 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); 1106 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
1107 if (result!=STATE_OK) 1107 if (result!=STATE_OK)
1108 return result; 1108 return result;
1109 1109
1110 if (!strcmp(recv_buffer,"-1\n")) { 1110 if (!strcmp(recv_buffer,"-1\n")) {
1111 asprintf (&output_message,_("CRITICAL - Value '%s' does not exist!"),nss1_name); 1111 xasprintf (&output_message,_("CRITICAL - Value '%s' does not exist!"),nss1_name);
1112 result=STATE_CRITICAL; 1112 result=STATE_CRITICAL;
1113 } else { 1113 } else {
1114 nss1_value=strtoul(recv_buffer,NULL,10); 1114 nss1_value=strtoul(recv_buffer,NULL,10);
@@ -1116,7 +1116,7 @@ main(int argc, char **argv) {
1116 result=STATE_CRITICAL; 1116 result=STATE_CRITICAL;
1117 else if (check_warning_value==TRUE && nss1_value >= warning_value) 1117 else if (check_warning_value==TRUE && nss1_value >= warning_value)
1118 result=STATE_WARNING; 1118 result=STATE_WARNING;
1119 asprintf (&output_message, 1119 xasprintf (&output_message,
1120 _("%s is %lu|%s=%lu;%lu;%lu;;"), 1120 _("%s is %lu|%s=%lu;%lu;%lu;;"),
1121 nss1_name, 1121 nss1_name,
1122 nss1_value, 1122 nss1_value,
@@ -1128,13 +1128,13 @@ main(int argc, char **argv) {
1128 1128
1129 } else if (vars_to_check==NSS2) { 1129 } else if (vars_to_check==NSS2) {
1130 1130
1131 asprintf (&send_buffer,"NSS2:%s\r\n",nss2_name); 1131 xasprintf (&send_buffer,"NSS2:%s\r\n",nss2_name);
1132 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); 1132 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
1133 if (result!=STATE_OK) 1133 if (result!=STATE_OK)
1134 return result; 1134 return result;
1135 1135
1136 if (!strcmp(recv_buffer,"-1\n")) { 1136 if (!strcmp(recv_buffer,"-1\n")) {
1137 asprintf (&output_message,_("CRITICAL - Value '%s' does not exist!"),nss2_name); 1137 xasprintf (&output_message,_("CRITICAL - Value '%s' does not exist!"),nss2_name);
1138 result=STATE_CRITICAL; 1138 result=STATE_CRITICAL;
1139 } else { 1139 } else {
1140 nss2_value=strtoul(recv_buffer,NULL,10); 1140 nss2_value=strtoul(recv_buffer,NULL,10);
@@ -1142,7 +1142,7 @@ main(int argc, char **argv) {
1142 result=STATE_CRITICAL; 1142 result=STATE_CRITICAL;
1143 else if (check_warning_value==TRUE && nss2_value >= warning_value) 1143 else if (check_warning_value==TRUE && nss2_value >= warning_value)
1144 result=STATE_WARNING; 1144 result=STATE_WARNING;
1145 asprintf (&output_message, 1145 xasprintf (&output_message,
1146 _("%s is %lu|%s=%lu;%lu;%lu;;"), 1146 _("%s is %lu|%s=%lu;%lu;%lu;;"),
1147 nss2_name, 1147 nss2_name,
1148 nss2_value, 1148 nss2_value,
@@ -1154,13 +1154,13 @@ main(int argc, char **argv) {
1154 1154
1155 } else if (vars_to_check==NSS3) { 1155 } else if (vars_to_check==NSS3) {
1156 1156
1157 asprintf (&send_buffer,"NSS3:%s\r\n",nss3_name); 1157 xasprintf (&send_buffer,"NSS3:%s\r\n",nss3_name);
1158 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); 1158 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
1159 if (result!=STATE_OK) 1159 if (result!=STATE_OK)
1160 return result; 1160 return result;
1161 1161
1162 if (!strcmp(recv_buffer,"-1\n")) { 1162 if (!strcmp(recv_buffer,"-1\n")) {
1163 asprintf (&output_message,_("CRITICAL - Value '%s' does not exist!"),nss3_name); 1163 xasprintf (&output_message,_("CRITICAL - Value '%s' does not exist!"),nss3_name);
1164 result=STATE_CRITICAL; 1164 result=STATE_CRITICAL;
1165 } else { 1165 } else {
1166 nss3_value=strtoul(recv_buffer,NULL,10); 1166 nss3_value=strtoul(recv_buffer,NULL,10);
@@ -1168,7 +1168,7 @@ main(int argc, char **argv) {
1168 result=STATE_CRITICAL; 1168 result=STATE_CRITICAL;
1169 else if (check_warning_value==TRUE && nss3_value >= warning_value) 1169 else if (check_warning_value==TRUE && nss3_value >= warning_value)
1170 result=STATE_WARNING; 1170 result=STATE_WARNING;
1171 asprintf (&output_message, 1171 xasprintf (&output_message,
1172 _("%s is %lu|%s=%lu;%lu;%lu;;"), 1172 _("%s is %lu|%s=%lu;%lu;%lu;;"),
1173 nss3_name, 1173 nss3_name,
1174 nss3_value, 1174 nss3_value,
@@ -1180,13 +1180,13 @@ main(int argc, char **argv) {
1180 1180
1181 } else if (vars_to_check==NSS4) { 1181 } else if (vars_to_check==NSS4) {
1182 1182
1183 asprintf (&send_buffer,"NSS4:%s\r\n",nss4_name); 1183 xasprintf (&send_buffer,"NSS4:%s\r\n",nss4_name);
1184 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); 1184 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
1185 if (result!=STATE_OK) 1185 if (result!=STATE_OK)
1186 return result; 1186 return result;
1187 1187
1188 if (!strcmp(recv_buffer,"-1\n")) { 1188 if (!strcmp(recv_buffer,"-1\n")) {
1189 asprintf (&output_message,_("CRITICAL - Value '%s' does not exist!"),nss4_name); 1189 xasprintf (&output_message,_("CRITICAL - Value '%s' does not exist!"),nss4_name);
1190 result=STATE_CRITICAL; 1190 result=STATE_CRITICAL;
1191 } else { 1191 } else {
1192 nss4_value=strtoul(recv_buffer,NULL,10); 1192 nss4_value=strtoul(recv_buffer,NULL,10);
@@ -1194,7 +1194,7 @@ main(int argc, char **argv) {
1194 result=STATE_CRITICAL; 1194 result=STATE_CRITICAL;
1195 else if (check_warning_value==TRUE && nss4_value >= warning_value) 1195 else if (check_warning_value==TRUE && nss4_value >= warning_value)
1196 result=STATE_WARNING; 1196 result=STATE_WARNING;
1197 asprintf (&output_message, 1197 xasprintf (&output_message,
1198 _("%s is %lu|%s=%lu;%lu;%lu;;"), 1198 _("%s is %lu|%s=%lu;%lu;%lu;;"),
1199 nss4_name, 1199 nss4_name,
1200 nss4_value, 1200 nss4_value,
@@ -1206,13 +1206,13 @@ main(int argc, char **argv) {
1206 1206
1207 } else if (vars_to_check==NSS5) { 1207 } else if (vars_to_check==NSS5) {
1208 1208
1209 asprintf (&send_buffer,"NSS5:%s\r\n",nss5_name); 1209 xasprintf (&send_buffer,"NSS5:%s\r\n",nss5_name);
1210 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); 1210 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
1211 if (result!=STATE_OK) 1211 if (result!=STATE_OK)
1212 return result; 1212 return result;
1213 1213
1214 if (!strcmp(recv_buffer,"-1\n")) { 1214 if (!strcmp(recv_buffer,"-1\n")) {
1215 asprintf (&output_message,_("CRITICAL - Value '%s' does not exist!"),nss5_name); 1215 xasprintf (&output_message,_("CRITICAL - Value '%s' does not exist!"),nss5_name);
1216 result=STATE_CRITICAL; 1216 result=STATE_CRITICAL;
1217 } else { 1217 } else {
1218 nss5_value=strtoul(recv_buffer,NULL,10); 1218 nss5_value=strtoul(recv_buffer,NULL,10);
@@ -1220,7 +1220,7 @@ main(int argc, char **argv) {
1220 result=STATE_CRITICAL; 1220 result=STATE_CRITICAL;
1221 else if (check_warning_value==TRUE && nss5_value >= warning_value) 1221 else if (check_warning_value==TRUE && nss5_value >= warning_value)
1222 result=STATE_WARNING; 1222 result=STATE_WARNING;
1223 asprintf (&output_message, 1223 xasprintf (&output_message,
1224 _("%s is %lu|%s=%lu;%lu;%lu;;"), 1224 _("%s is %lu|%s=%lu;%lu;%lu;;"),
1225 nss5_name, 1225 nss5_name,
1226 nss5_value, 1226 nss5_value,
@@ -1232,13 +1232,13 @@ main(int argc, char **argv) {
1232 1232
1233 } else if (vars_to_check==NSS6) { 1233 } else if (vars_to_check==NSS6) {
1234 1234
1235 asprintf (&send_buffer,"NSS6:%s\r\n",nss6_name); 1235 xasprintf (&send_buffer,"NSS6:%s\r\n",nss6_name);
1236 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); 1236 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
1237 if (result!=STATE_OK) 1237 if (result!=STATE_OK)
1238 return result; 1238 return result;
1239 1239
1240 if (!strcmp(recv_buffer,"-1\n")) { 1240 if (!strcmp(recv_buffer,"-1\n")) {
1241 asprintf (&output_message,_("CRITICAL - Value '%s' does not exist!"),nss6_name); 1241 xasprintf (&output_message,_("CRITICAL - Value '%s' does not exist!"),nss6_name);
1242 result=STATE_CRITICAL; 1242 result=STATE_CRITICAL;
1243 } else { 1243 } else {
1244 nss6_value=strtoul(recv_buffer,NULL,10); 1244 nss6_value=strtoul(recv_buffer,NULL,10);
@@ -1246,7 +1246,7 @@ main(int argc, char **argv) {
1246 result=STATE_CRITICAL; 1246 result=STATE_CRITICAL;
1247 else if (check_warning_value==TRUE && nss6_value >= warning_value) 1247 else if (check_warning_value==TRUE && nss6_value >= warning_value)
1248 result=STATE_WARNING; 1248 result=STATE_WARNING;
1249 asprintf (&output_message, 1249 xasprintf (&output_message,
1250 _("%s is %lu|%s=%lu;%lu;%lu;;"), 1250 _("%s is %lu|%s=%lu;%lu;%lu;;"),
1251 nss6_name, 1251 nss6_name,
1252 nss6_value, 1252 nss6_value,
@@ -1258,13 +1258,13 @@ main(int argc, char **argv) {
1258 1258
1259 } else if (vars_to_check==NSS7) { 1259 } else if (vars_to_check==NSS7) {
1260 1260
1261 asprintf (&send_buffer,"NSS7:%s\r\n",nss7_name); 1261 xasprintf (&send_buffer,"NSS7:%s\r\n",nss7_name);
1262 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); 1262 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
1263 if (result!=STATE_OK) 1263 if (result!=STATE_OK)
1264 return result; 1264 return result;
1265 1265
1266 if (!strcmp(recv_buffer,"-1\n")) { 1266 if (!strcmp(recv_buffer,"-1\n")) {
1267 asprintf (&output_message,_("CRITICAL - Value '%s' does not exist!"),nss7_name); 1267 xasprintf (&output_message,_("CRITICAL - Value '%s' does not exist!"),nss7_name);
1268 result=STATE_CRITICAL; 1268 result=STATE_CRITICAL;
1269 } else { 1269 } else {
1270 nss7_value=strtoul(recv_buffer,NULL,10); 1270 nss7_value=strtoul(recv_buffer,NULL,10);
@@ -1272,7 +1272,7 @@ main(int argc, char **argv) {
1272 result=STATE_CRITICAL; 1272 result=STATE_CRITICAL;
1273 else if (check_warning_value==TRUE && nss7_value >= warning_value) 1273 else if (check_warning_value==TRUE && nss7_value >= warning_value)
1274 result=STATE_WARNING; 1274 result=STATE_WARNING;
1275 asprintf (&output_message, 1275 xasprintf (&output_message,
1276 _("%s is %lu|%s=%lu;%lu;%lu;;"), 1276 _("%s is %lu|%s=%lu;%lu;%lu;;"),
1277 nss7_name, 1277 nss7_name,
1278 nss7_value, 1278 nss7_value,
@@ -1591,7 +1591,7 @@ int process_arguments(int argc, char **argv) {
1591void print_help(void) 1591void print_help(void)
1592{ 1592{
1593 char *myport; 1593 char *myport;
1594 asprintf (&myport, "%d", PORT); 1594 xasprintf (&myport, "%d", PORT);
1595 1595
1596 print_revision (progname, NP_VERSION); 1596 print_revision (progname, NP_VERSION);
1597 1597