diff options
Diffstat (limited to 'plugins/check_nwstat.c')
-rw-r--r-- | plugins/check_nwstat.c | 203 |
1 files changed, 128 insertions, 75 deletions
diff --git a/plugins/check_nwstat.c b/plugins/check_nwstat.c index 3c9d23e..10c493b 100644 --- a/plugins/check_nwstat.c +++ b/plugins/check_nwstat.c | |||
@@ -46,6 +46,7 @@ enum checkvar { | |||
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 | VPU, /* check % used space on volume */ | ||
49 | VMP, /* check MB purgeable 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 */ |
@@ -104,9 +105,9 @@ 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 | int check_warning_value=FALSE; | 108 | bool check_warning_value = false; |
108 | int check_critical_value=FALSE; | 109 | bool check_critical_value = false; |
109 | int 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 | ||
@@ -146,6 +147,8 @@ main(int argc, char **argv) { | |||
146 | unsigned long nss6_value=0L; | 147 | unsigned long nss6_value=0L; |
147 | unsigned long nss7_value=0L; | 148 | unsigned long nss7_value=0L; |
148 | unsigned long total_disk_space=0L; | 149 | unsigned long total_disk_space=0L; |
150 | unsigned long used_disk_space=0L; | ||
151 | unsigned long percent_used_disk_space=0L; | ||
149 | unsigned long purgeable_disk_space=0L; | 152 | unsigned long purgeable_disk_space=0L; |
150 | unsigned long non_purgeable_disk_space=0L; | 153 | unsigned long non_purgeable_disk_space=0L; |
151 | unsigned long percent_free_space=0; | 154 | unsigned long percent_free_space=0; |
@@ -182,7 +185,7 @@ main(int argc, char **argv) { | |||
182 | my_tcp_connect (server_address, server_port, &sd); | 185 | my_tcp_connect (server_address, server_port, &sd); |
183 | 186 | ||
184 | /* get OS version string */ | 187 | /* get OS version string */ |
185 | if (check_netware_version==TRUE) { | 188 | if (check_netware_version) { |
186 | send_buffer = strdup ("S19\r\n"); | 189 | send_buffer = strdup ("S19\r\n"); |
187 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | 190 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); |
188 | if (result!=STATE_OK) | 191 | if (result!=STATE_OK) |
@@ -231,9 +234,9 @@ main(int argc, char **argv) { | |||
231 | recv_buffer[strlen(recv_buffer)-1]=0; | 234 | recv_buffer[strlen(recv_buffer)-1]=0; |
232 | sprintf(uptime,_("Up %s,"),recv_buffer); | 235 | sprintf(uptime,_("Up %s,"),recv_buffer); |
233 | 236 | ||
234 | if (check_critical_value==TRUE && utilization >= critical_value) | 237 | if (check_critical_value && utilization >= critical_value) |
235 | result=STATE_CRITICAL; | 238 | result=STATE_CRITICAL; |
236 | else if (check_warning_value==TRUE && utilization >= warning_value) | 239 | else if (check_warning_value && utilization >= warning_value) |
237 | result=STATE_WARNING; | 240 | result=STATE_WARNING; |
238 | 241 | ||
239 | xasprintf (&output_message, | 242 | xasprintf (&output_message, |
@@ -259,9 +262,9 @@ main(int argc, char **argv) { | |||
259 | return result; | 262 | return result; |
260 | current_connections=strtoul(recv_buffer,NULL,10); | 263 | current_connections=strtoul(recv_buffer,NULL,10); |
261 | 264 | ||
262 | if (check_critical_value==TRUE && current_connections >= critical_value) | 265 | if (check_critical_value && current_connections >= critical_value) |
263 | result=STATE_CRITICAL; | 266 | result=STATE_CRITICAL; |
264 | else if (check_warning_value==TRUE && current_connections >= warning_value) | 267 | else if (check_warning_value && current_connections >= warning_value) |
265 | result=STATE_WARNING; | 268 | result=STATE_WARNING; |
266 | 269 | ||
267 | xasprintf (&output_message, | 270 | xasprintf (&output_message, |
@@ -284,9 +287,9 @@ main(int argc, char **argv) { | |||
284 | return result; | 287 | return result; |
285 | cache_hits=atoi(recv_buffer); | 288 | cache_hits=atoi(recv_buffer); |
286 | 289 | ||
287 | if (check_critical_value==TRUE && cache_hits <= critical_value) | 290 | if (check_critical_value && cache_hits <= critical_value) |
288 | result=STATE_CRITICAL; | 291 | result=STATE_CRITICAL; |
289 | else if (check_warning_value==TRUE && cache_hits <= warning_value) | 292 | else if (check_warning_value && cache_hits <= warning_value) |
290 | result=STATE_WARNING; | 293 | result=STATE_WARNING; |
291 | 294 | ||
292 | xasprintf (&output_message, | 295 | xasprintf (&output_message, |
@@ -306,9 +309,9 @@ main(int argc, char **argv) { | |||
306 | return result; | 309 | return result; |
307 | cache_buffers=strtoul(recv_buffer,NULL,10); | 310 | cache_buffers=strtoul(recv_buffer,NULL,10); |
308 | 311 | ||
309 | if (check_critical_value==TRUE && cache_buffers <= critical_value) | 312 | if (check_critical_value && cache_buffers <= critical_value) |
310 | result=STATE_CRITICAL; | 313 | result=STATE_CRITICAL; |
311 | else if (check_warning_value==TRUE && cache_buffers <= warning_value) | 314 | else if (check_warning_value && cache_buffers <= warning_value) |
312 | result=STATE_WARNING; | 315 | result=STATE_WARNING; |
313 | 316 | ||
314 | xasprintf (&output_message, | 317 | xasprintf (&output_message, |
@@ -331,9 +334,9 @@ main(int argc, char **argv) { | |||
331 | return result; | 334 | return result; |
332 | cache_buffers=strtoul(recv_buffer,NULL,10); | 335 | cache_buffers=strtoul(recv_buffer,NULL,10); |
333 | 336 | ||
334 | if (check_critical_value==TRUE && cache_buffers >= critical_value) | 337 | if (check_critical_value && cache_buffers >= critical_value) |
335 | result=STATE_CRITICAL; | 338 | result=STATE_CRITICAL; |
336 | else if (check_warning_value==TRUE && cache_buffers >= warning_value) | 339 | else if (check_warning_value && cache_buffers >= warning_value) |
337 | result=STATE_WARNING; | 340 | result=STATE_WARNING; |
338 | 341 | ||
339 | xasprintf (&output_message, | 342 | xasprintf (&output_message, |
@@ -356,9 +359,9 @@ main(int argc, char **argv) { | |||
356 | return result; | 359 | return result; |
357 | lru_time=strtoul(recv_buffer,NULL,10); | 360 | lru_time=strtoul(recv_buffer,NULL,10); |
358 | 361 | ||
359 | if (check_critical_value==TRUE && lru_time <= critical_value) | 362 | if (check_critical_value && lru_time <= critical_value) |
360 | result=STATE_CRITICAL; | 363 | result=STATE_CRITICAL; |
361 | else if (check_warning_value==TRUE && lru_time <= warning_value) | 364 | else if (check_warning_value && lru_time <= warning_value) |
362 | result=STATE_WARNING; | 365 | result=STATE_WARNING; |
363 | 366 | ||
364 | xasprintf (&output_message, | 367 | xasprintf (&output_message, |
@@ -383,9 +386,9 @@ main(int argc, char **argv) { | |||
383 | result=STATE_CRITICAL; | 386 | result=STATE_CRITICAL; |
384 | } else { | 387 | } else { |
385 | free_disk_space=strtoul(recv_buffer,NULL,10); | 388 | free_disk_space=strtoul(recv_buffer,NULL,10); |
386 | if (check_critical_value==TRUE && free_disk_space <= critical_value) | 389 | if (check_critical_value && free_disk_space <= critical_value) |
387 | result=STATE_CRITICAL; | 390 | result=STATE_CRITICAL; |
388 | else if (check_warning_value==TRUE && free_disk_space <= warning_value) | 391 | else if (check_warning_value && free_disk_space <= warning_value) |
389 | result=STATE_WARNING; | 392 | result=STATE_WARNING; |
390 | xasprintf (&output_message, | 393 | xasprintf (&output_message, |
391 | _("%s%lu KB free on volume %s|KBFree%s=%lu;%lu;%lu;;"), | 394 | _("%s%lu KB free on volume %s|KBFree%s=%lu;%lu;%lu;;"), |
@@ -411,9 +414,9 @@ main(int argc, char **argv) { | |||
411 | result=STATE_CRITICAL; | 414 | result=STATE_CRITICAL; |
412 | } else { | 415 | } else { |
413 | free_disk_space=strtoul(recv_buffer,NULL,10); | 416 | free_disk_space=strtoul(recv_buffer,NULL,10); |
414 | if (check_critical_value==TRUE && free_disk_space <= critical_value) | 417 | if (check_critical_value && free_disk_space <= critical_value) |
415 | result=STATE_CRITICAL; | 418 | result=STATE_CRITICAL; |
416 | else if (check_warning_value==TRUE && free_disk_space <= warning_value) | 419 | else if (check_warning_value && free_disk_space <= warning_value) |
417 | result=STATE_WARNING; | 420 | result=STATE_WARNING; |
418 | xasprintf (&output_message, | 421 | xasprintf (&output_message, |
419 | _("%s%lu MB free on volume %s|MBFree%s=%lu;%lu;%lu;;"), | 422 | _("%s%lu MB free on volume %s|MBFree%s=%lu;%lu;%lu;;"), |
@@ -438,9 +441,9 @@ main(int argc, char **argv) { | |||
438 | result=STATE_CRITICAL; | 441 | result=STATE_CRITICAL; |
439 | } else { | 442 | } else { |
440 | free_disk_space=strtoul(recv_buffer,NULL,10); | 443 | free_disk_space=strtoul(recv_buffer,NULL,10); |
441 | if (check_critical_value==TRUE && free_disk_space <= critical_value) | 444 | if (check_critical_value && free_disk_space <= critical_value) |
442 | result=STATE_CRITICAL; | 445 | result=STATE_CRITICAL; |
443 | else if (check_warning_value==TRUE && free_disk_space <= warning_value) | 446 | else if (check_warning_value && free_disk_space <= warning_value) |
444 | result=STATE_WARNING; | 447 | result=STATE_WARNING; |
445 | xasprintf (&output_message, | 448 | xasprintf (&output_message, |
446 | _("%s%lu MB used on volume %s|MBUsed%s=%lu;%lu;%lu;;"), | 449 | _("%s%lu MB used on volume %s|MBUsed%s=%lu;%lu;%lu;;"), |
@@ -452,7 +455,50 @@ main(int argc, char **argv) { | |||
452 | warning_value, | 455 | warning_value, |
453 | critical_value); | 456 | critical_value); |
454 | } | 457 | } |
458 | /* check % used space on volume */ | ||
459 | } else if (vars_to_check==VPU) { | ||
460 | close(sd); | ||
461 | my_tcp_connect (server_address, server_port, &sd); | ||
462 | |||
463 | asprintf (&send_buffer,"VMU%s\r\n",volume_name); | ||
464 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
465 | |||
466 | if (result!=STATE_OK) | ||
467 | return result; | ||
468 | |||
469 | if (!strcmp(recv_buffer,"-1\n")) { | ||
470 | asprintf (&output_message,_("CRITICAL - Volume '%s' does not exist!"),volume_name); | ||
471 | result=STATE_CRITICAL; | ||
472 | |||
473 | } else { | ||
474 | used_disk_space=strtoul(recv_buffer,NULL,10); | ||
475 | close(sd); | ||
476 | my_tcp_connect (server_address, server_port, &sd); | ||
477 | /* get total volume in MB */ | ||
478 | asprintf (&send_buffer,"VMS%s\r\n",volume_name); | ||
479 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
480 | if (result!=STATE_OK) | ||
481 | return result; | ||
482 | total_disk_space=strtoul(recv_buffer,NULL,10); | ||
483 | /* calculate percent used on volume */ | ||
484 | percent_used_disk_space=(unsigned long)(((double)used_disk_space/(double)total_disk_space)*100.0); | ||
455 | 485 | ||
486 | if (check_critical_value && percent_used_disk_space >= critical_value) | ||
487 | result=STATE_CRITICAL; | ||
488 | else if (check_warning_value && percent_used_disk_space >= warning_value) | ||
489 | result=STATE_WARNING; | ||
490 | |||
491 | asprintf (&output_message,_("%lu MB (%lu%%) used on volume %s - total %lu MB|Used space in percent on %s=%lu;%lu;%lu;0;100"), | ||
492 | used_disk_space, | ||
493 | percent_used_disk_space, | ||
494 | volume_name, | ||
495 | total_disk_space, | ||
496 | volume_name, | ||
497 | percent_used_disk_space, | ||
498 | warning_value, | ||
499 | critical_value | ||
500 | ); | ||
501 | } | ||
456 | 502 | ||
457 | /* check % free space on volume */ | 503 | /* check % free space on volume */ |
458 | } else if (vars_to_check==VPF) { | 504 | } else if (vars_to_check==VPF) { |
@@ -485,9 +531,9 @@ main(int argc, char **argv) { | |||
485 | 531 | ||
486 | percent_free_space=(unsigned long)(((double)free_disk_space/(double)total_disk_space)*100.0); | 532 | percent_free_space=(unsigned long)(((double)free_disk_space/(double)total_disk_space)*100.0); |
487 | 533 | ||
488 | if (check_critical_value==TRUE && percent_free_space <= critical_value) | 534 | if (check_critical_value && percent_free_space <= critical_value) |
489 | result=STATE_CRITICAL; | 535 | result=STATE_CRITICAL; |
490 | else if (check_warning_value==TRUE && percent_free_space <= warning_value) | 536 | else if (check_warning_value && percent_free_space <= warning_value) |
491 | result=STATE_WARNING; | 537 | result=STATE_WARNING; |
492 | free_disk_space/=1024; | 538 | free_disk_space/=1024; |
493 | total_disk_space/=1024; | 539 | total_disk_space/=1024; |
@@ -596,14 +642,14 @@ main(int argc, char **argv) { | |||
596 | percent_used_packet_receive_buffers=(unsigned long)(((double)used_packet_receive_buffers/(double)max_packet_receive_buffers)*100.0); | 642 | percent_used_packet_receive_buffers=(unsigned long)(((double)used_packet_receive_buffers/(double)max_packet_receive_buffers)*100.0); |
597 | 643 | ||
598 | if (vars_to_check==UPRB) { | 644 | if (vars_to_check==UPRB) { |
599 | if (check_critical_value==TRUE && used_packet_receive_buffers >= critical_value) | 645 | if (check_critical_value && used_packet_receive_buffers >= critical_value) |
600 | result=STATE_CRITICAL; | 646 | result=STATE_CRITICAL; |
601 | else if (check_warning_value==TRUE && used_packet_receive_buffers >= warning_value) | 647 | else if (check_warning_value && used_packet_receive_buffers >= warning_value) |
602 | result=STATE_WARNING; | 648 | result=STATE_WARNING; |
603 | } else { | 649 | } else { |
604 | if (check_critical_value==TRUE && percent_used_packet_receive_buffers >= critical_value) | 650 | if (check_critical_value && percent_used_packet_receive_buffers >= critical_value) |
605 | result=STATE_CRITICAL; | 651 | result=STATE_CRITICAL; |
606 | else if (check_warning_value==TRUE && percent_used_packet_receive_buffers >= warning_value) | 652 | else if (check_warning_value && percent_used_packet_receive_buffers >= warning_value) |
607 | result=STATE_WARNING; | 653 | result=STATE_WARNING; |
608 | } | 654 | } |
609 | 655 | ||
@@ -625,9 +671,9 @@ main(int argc, char **argv) { | |||
625 | 671 | ||
626 | sap_entries=atoi(recv_buffer); | 672 | sap_entries=atoi(recv_buffer); |
627 | 673 | ||
628 | if (check_critical_value==TRUE && sap_entries >= critical_value) | 674 | if (check_critical_value && sap_entries >= critical_value) |
629 | result=STATE_CRITICAL; | 675 | result=STATE_CRITICAL; |
630 | else if (check_warning_value==TRUE && sap_entries >= warning_value) | 676 | else if (check_warning_value && sap_entries >= warning_value) |
631 | result=STATE_WARNING; | 677 | result=STATE_WARNING; |
632 | 678 | ||
633 | if (sap_number==-1) | 679 | if (sap_number==-1) |
@@ -651,9 +697,9 @@ main(int argc, char **argv) { | |||
651 | result=STATE_CRITICAL; | 697 | result=STATE_CRITICAL; |
652 | } else { | 698 | } else { |
653 | purgeable_disk_space=strtoul(recv_buffer,NULL,10); | 699 | purgeable_disk_space=strtoul(recv_buffer,NULL,10); |
654 | if (check_critical_value==TRUE && purgeable_disk_space >= critical_value) | 700 | if (check_critical_value && purgeable_disk_space >= critical_value) |
655 | result=STATE_CRITICAL; | 701 | result=STATE_CRITICAL; |
656 | else if (check_warning_value==TRUE && purgeable_disk_space >= warning_value) | 702 | else if (check_warning_value && purgeable_disk_space >= warning_value) |
657 | result=STATE_WARNING; | 703 | result=STATE_WARNING; |
658 | xasprintf (&output_message,_("%s%lu KB purgeable on volume %s|Purge%s=%lu;%lu;%lu;;"), | 704 | xasprintf (&output_message,_("%s%lu KB purgeable on volume %s|Purge%s=%lu;%lu;%lu;;"), |
659 | (result==STATE_OK)?"":_("Only "), | 705 | (result==STATE_OK)?"":_("Only "), |
@@ -677,9 +723,9 @@ main(int argc, char **argv) { | |||
677 | result=STATE_CRITICAL; | 723 | result=STATE_CRITICAL; |
678 | } else { | 724 | } else { |
679 | purgeable_disk_space=strtoul(recv_buffer,NULL,10); | 725 | purgeable_disk_space=strtoul(recv_buffer,NULL,10); |
680 | if (check_critical_value==TRUE && purgeable_disk_space >= critical_value) | 726 | if (check_critical_value && purgeable_disk_space >= critical_value) |
681 | result=STATE_CRITICAL; | 727 | result=STATE_CRITICAL; |
682 | else if (check_warning_value==TRUE && purgeable_disk_space >= warning_value) | 728 | else if (check_warning_value && purgeable_disk_space >= warning_value) |
683 | result=STATE_WARNING; | 729 | result=STATE_WARNING; |
684 | xasprintf (&output_message,_("%s%lu MB purgeable on volume %s|Purge%s=%lu;%lu;%lu;;"), | 730 | xasprintf (&output_message,_("%s%lu MB purgeable on volume %s|Purge%s=%lu;%lu;%lu;;"), |
685 | (result==STATE_OK)?"":_("Only "), | 731 | (result==STATE_OK)?"":_("Only "), |
@@ -722,9 +768,9 @@ main(int argc, char **argv) { | |||
722 | 768 | ||
723 | percent_purgeable_space=(unsigned long)(((double)purgeable_disk_space/(double)total_disk_space)*100.0); | 769 | percent_purgeable_space=(unsigned long)(((double)purgeable_disk_space/(double)total_disk_space)*100.0); |
724 | 770 | ||
725 | if (check_critical_value==TRUE && percent_purgeable_space >= critical_value) | 771 | if (check_critical_value && percent_purgeable_space >= critical_value) |
726 | result=STATE_CRITICAL; | 772 | result=STATE_CRITICAL; |
727 | else if (check_warning_value==TRUE && percent_purgeable_space >= warning_value) | 773 | else if (check_warning_value && percent_purgeable_space >= warning_value) |
728 | result=STATE_WARNING; | 774 | result=STATE_WARNING; |
729 | purgeable_disk_space/=1024; | 775 | purgeable_disk_space/=1024; |
730 | xasprintf (&output_message,_("%lu MB (%lu%%) purgeable on volume %s|Purgeable%s=%lu;%lu;%lu;0;100"), | 776 | xasprintf (&output_message,_("%lu MB (%lu%%) purgeable on volume %s|Purgeable%s=%lu;%lu;%lu;0;100"), |
@@ -754,9 +800,9 @@ main(int argc, char **argv) { | |||
754 | result=STATE_CRITICAL; | 800 | result=STATE_CRITICAL; |
755 | } else { | 801 | } else { |
756 | non_purgeable_disk_space=strtoul(recv_buffer,NULL,10); | 802 | non_purgeable_disk_space=strtoul(recv_buffer,NULL,10); |
757 | if (check_critical_value==TRUE && non_purgeable_disk_space >= critical_value) | 803 | if (check_critical_value && non_purgeable_disk_space >= critical_value) |
758 | result=STATE_CRITICAL; | 804 | result=STATE_CRITICAL; |
759 | else if (check_warning_value==TRUE && non_purgeable_disk_space >= warning_value) | 805 | else if (check_warning_value && non_purgeable_disk_space >= warning_value) |
760 | result=STATE_WARNING; | 806 | 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); | 807 | xasprintf (&output_message,_("%s%lu KB not yet purgeable on volume %s"),(result==STATE_OK)?"":_("Only "),non_purgeable_disk_space,volume_name); |
762 | } | 808 | } |
@@ -792,9 +838,9 @@ main(int argc, char **argv) { | |||
792 | 838 | ||
793 | percent_non_purgeable_space=(unsigned long)(((double)non_purgeable_disk_space/(double)total_disk_space)*100.0); | 839 | percent_non_purgeable_space=(unsigned long)(((double)non_purgeable_disk_space/(double)total_disk_space)*100.0); |
794 | 840 | ||
795 | if (check_critical_value==TRUE && percent_non_purgeable_space >= critical_value) | 841 | if (check_critical_value && percent_non_purgeable_space >= critical_value) |
796 | result=STATE_CRITICAL; | 842 | result=STATE_CRITICAL; |
797 | else if (check_warning_value==TRUE && percent_non_purgeable_space >= warning_value) | 843 | else if (check_warning_value && percent_non_purgeable_space >= warning_value) |
798 | result=STATE_WARNING; | 844 | result=STATE_WARNING; |
799 | purgeable_disk_space/=1024; | 845 | 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); | 846 | xasprintf (&output_message,_("%lu MB (%lu%%) not yet purgeable on volume %s"),non_purgeable_disk_space,percent_non_purgeable_space,volume_name); |
@@ -813,9 +859,9 @@ main(int argc, char **argv) { | |||
813 | 859 | ||
814 | open_files=atoi(recv_buffer); | 860 | open_files=atoi(recv_buffer); |
815 | 861 | ||
816 | if (check_critical_value==TRUE && open_files >= critical_value) | 862 | if (check_critical_value && open_files >= critical_value) |
817 | result=STATE_CRITICAL; | 863 | result=STATE_CRITICAL; |
818 | else if (check_warning_value==TRUE && open_files >= warning_value) | 864 | else if (check_warning_value && open_files >= warning_value) |
819 | result=STATE_WARNING; | 865 | result=STATE_WARNING; |
820 | 866 | ||
821 | xasprintf (&output_message,_("%lu open files|Openfiles=%lu;%lu;%lu;0,0"), | 867 | xasprintf (&output_message,_("%lu open files|Openfiles=%lu;%lu;%lu;0,0"), |
@@ -838,9 +884,9 @@ main(int argc, char **argv) { | |||
838 | 884 | ||
839 | abended_threads=atoi(recv_buffer); | 885 | abended_threads=atoi(recv_buffer); |
840 | 886 | ||
841 | if (check_critical_value==TRUE && abended_threads >= critical_value) | 887 | if (check_critical_value && abended_threads >= critical_value) |
842 | result=STATE_CRITICAL; | 888 | result=STATE_CRITICAL; |
843 | else if (check_warning_value==TRUE && abended_threads >= warning_value) | 889 | else if (check_warning_value && abended_threads >= warning_value) |
844 | result=STATE_WARNING; | 890 | result=STATE_WARNING; |
845 | 891 | ||
846 | xasprintf (&output_message,_("%lu abended threads|Abends=%lu;%lu;%lu;;"), | 892 | xasprintf (&output_message,_("%lu abended threads|Abends=%lu;%lu;%lu;;"), |
@@ -872,9 +918,9 @@ main(int argc, char **argv) { | |||
872 | 918 | ||
873 | current_service_processes=atoi(recv_buffer); | 919 | current_service_processes=atoi(recv_buffer); |
874 | 920 | ||
875 | if (check_critical_value==TRUE && current_service_processes >= critical_value) | 921 | if (check_critical_value && current_service_processes >= critical_value) |
876 | result=STATE_CRITICAL; | 922 | result=STATE_CRITICAL; |
877 | else if (check_warning_value==TRUE && current_service_processes >= warning_value) | 923 | else if (check_warning_value && current_service_processes >= warning_value) |
878 | result=STATE_WARNING; | 924 | result=STATE_WARNING; |
879 | 925 | ||
880 | xasprintf (&output_message, | 926 | xasprintf (&output_message, |
@@ -923,9 +969,9 @@ main(int argc, char **argv) { | |||
923 | return result; | 969 | return result; |
924 | lru_time=strtoul(recv_buffer,NULL,10); | 970 | lru_time=strtoul(recv_buffer,NULL,10); |
925 | 971 | ||
926 | if (check_critical_value==TRUE && lru_time <= critical_value) | 972 | if (check_critical_value && lru_time <= critical_value) |
927 | result=STATE_CRITICAL; | 973 | result=STATE_CRITICAL; |
928 | else if (check_warning_value==TRUE && lru_time <= warning_value) | 974 | else if (check_warning_value && lru_time <= warning_value) |
929 | result=STATE_WARNING; | 975 | result=STATE_WARNING; |
930 | xasprintf (&output_message,_("LRU sitting time = %lu seconds"),lru_time); | 976 | xasprintf (&output_message,_("LRU sitting time = %lu seconds"),lru_time); |
931 | 977 | ||
@@ -942,9 +988,9 @@ main(int argc, char **argv) { | |||
942 | return result; | 988 | return result; |
943 | dirty_cache_buffers=atoi(recv_buffer); | 989 | dirty_cache_buffers=atoi(recv_buffer); |
944 | 990 | ||
945 | if (check_critical_value==TRUE && dirty_cache_buffers <= critical_value) | 991 | if (check_critical_value && dirty_cache_buffers <= critical_value) |
946 | result=STATE_CRITICAL; | 992 | result=STATE_CRITICAL; |
947 | else if (check_warning_value==TRUE && dirty_cache_buffers <= warning_value) | 993 | else if (check_warning_value && dirty_cache_buffers <= warning_value) |
948 | result=STATE_WARNING; | 994 | result=STATE_WARNING; |
949 | xasprintf (&output_message,_("Dirty cache buffers = %lu%% of the total|DCB=%lu;%lu;%lu;0;100"), | 995 | xasprintf (&output_message,_("Dirty cache buffers = %lu%% of the total|DCB=%lu;%lu;%lu;0;100"), |
950 | dirty_cache_buffers, | 996 | dirty_cache_buffers, |
@@ -964,9 +1010,9 @@ main(int argc, char **argv) { | |||
964 | return result; | 1010 | return result; |
965 | total_cache_buffers=atoi(recv_buffer); | 1011 | total_cache_buffers=atoi(recv_buffer); |
966 | 1012 | ||
967 | if (check_critical_value==TRUE && total_cache_buffers <= critical_value) | 1013 | if (check_critical_value && total_cache_buffers <= critical_value) |
968 | result=STATE_CRITICAL; | 1014 | result=STATE_CRITICAL; |
969 | else if (check_warning_value==TRUE && total_cache_buffers <= warning_value) | 1015 | else if (check_warning_value && total_cache_buffers <= warning_value) |
970 | result=STATE_WARNING; | 1016 | result=STATE_WARNING; |
971 | xasprintf (&output_message,_("Total cache buffers = %lu%% of the original|TCB=%lu;%lu;%lu;0;100"), | 1017 | xasprintf (&output_message,_("Total cache buffers = %lu%% of the original|TCB=%lu;%lu;%lu;0;100"), |
972 | total_cache_buffers, | 1018 | total_cache_buffers, |
@@ -1034,9 +1080,9 @@ main(int argc, char **argv) { | |||
1034 | result=STATE_CRITICAL; | 1080 | result=STATE_CRITICAL; |
1035 | } else { | 1081 | } else { |
1036 | nrmp_value=strtoul(recv_buffer,NULL,10); | 1082 | nrmp_value=strtoul(recv_buffer,NULL,10); |
1037 | if (check_critical_value==TRUE && nrmp_value <= critical_value) | 1083 | if (check_critical_value && nrmp_value <= critical_value) |
1038 | result=STATE_CRITICAL; | 1084 | result=STATE_CRITICAL; |
1039 | else if (check_warning_value==TRUE && nrmp_value <= warning_value) | 1085 | else if (check_warning_value && nrmp_value <= warning_value) |
1040 | result=STATE_WARNING; | 1086 | result=STATE_WARNING; |
1041 | xasprintf (&output_message, | 1087 | xasprintf (&output_message, |
1042 | _("%s is %lu|%s=%lu;%lu;%lu;;"), | 1088 | _("%s is %lu|%s=%lu;%lu;%lu;;"), |
@@ -1060,9 +1106,9 @@ main(int argc, char **argv) { | |||
1060 | result=STATE_CRITICAL; | 1106 | result=STATE_CRITICAL; |
1061 | } else { | 1107 | } else { |
1062 | nrmm_value=strtoul(recv_buffer,NULL,10); | 1108 | nrmm_value=strtoul(recv_buffer,NULL,10); |
1063 | if (check_critical_value==TRUE && nrmm_value <= critical_value) | 1109 | if (check_critical_value && nrmm_value <= critical_value) |
1064 | result=STATE_CRITICAL; | 1110 | result=STATE_CRITICAL; |
1065 | else if (check_warning_value==TRUE && nrmm_value <= warning_value) | 1111 | else if (check_warning_value && nrmm_value <= warning_value) |
1066 | result=STATE_WARNING; | 1112 | result=STATE_WARNING; |
1067 | xasprintf (&output_message, | 1113 | xasprintf (&output_message, |
1068 | _("%s is %lu|%s=%lu;%lu;%lu;;"), | 1114 | _("%s is %lu|%s=%lu;%lu;%lu;;"), |
@@ -1086,9 +1132,9 @@ main(int argc, char **argv) { | |||
1086 | result=STATE_CRITICAL; | 1132 | result=STATE_CRITICAL; |
1087 | } else { | 1133 | } else { |
1088 | nrms_value=strtoul(recv_buffer,NULL,10); | 1134 | nrms_value=strtoul(recv_buffer,NULL,10); |
1089 | if (check_critical_value==TRUE && nrms_value >= critical_value) | 1135 | if (check_critical_value && nrms_value >= critical_value) |
1090 | result=STATE_CRITICAL; | 1136 | result=STATE_CRITICAL; |
1091 | else if (check_warning_value==TRUE && nrms_value >= warning_value) | 1137 | else if (check_warning_value && nrms_value >= warning_value) |
1092 | result=STATE_WARNING; | 1138 | result=STATE_WARNING; |
1093 | xasprintf (&output_message, | 1139 | xasprintf (&output_message, |
1094 | _("%s is %lu|%s=%lu;%lu;%lu;;"), | 1140 | _("%s is %lu|%s=%lu;%lu;%lu;;"), |
@@ -1112,9 +1158,9 @@ main(int argc, char **argv) { | |||
1112 | result=STATE_CRITICAL; | 1158 | result=STATE_CRITICAL; |
1113 | } else { | 1159 | } else { |
1114 | nss1_value=strtoul(recv_buffer,NULL,10); | 1160 | nss1_value=strtoul(recv_buffer,NULL,10); |
1115 | if (check_critical_value==TRUE && nss1_value >= critical_value) | 1161 | if (check_critical_value && nss1_value >= critical_value) |
1116 | result=STATE_CRITICAL; | 1162 | result=STATE_CRITICAL; |
1117 | else if (check_warning_value==TRUE && nss1_value >= warning_value) | 1163 | else if (check_warning_value && nss1_value >= warning_value) |
1118 | result=STATE_WARNING; | 1164 | result=STATE_WARNING; |
1119 | xasprintf (&output_message, | 1165 | xasprintf (&output_message, |
1120 | _("%s is %lu|%s=%lu;%lu;%lu;;"), | 1166 | _("%s is %lu|%s=%lu;%lu;%lu;;"), |
@@ -1138,9 +1184,9 @@ main(int argc, char **argv) { | |||
1138 | result=STATE_CRITICAL; | 1184 | result=STATE_CRITICAL; |
1139 | } else { | 1185 | } else { |
1140 | nss2_value=strtoul(recv_buffer,NULL,10); | 1186 | nss2_value=strtoul(recv_buffer,NULL,10); |
1141 | if (check_critical_value==TRUE && nss2_value >= critical_value) | 1187 | if (check_critical_value && nss2_value >= critical_value) |
1142 | result=STATE_CRITICAL; | 1188 | result=STATE_CRITICAL; |
1143 | else if (check_warning_value==TRUE && nss2_value >= warning_value) | 1189 | else if (check_warning_value && nss2_value >= warning_value) |
1144 | result=STATE_WARNING; | 1190 | result=STATE_WARNING; |
1145 | xasprintf (&output_message, | 1191 | xasprintf (&output_message, |
1146 | _("%s is %lu|%s=%lu;%lu;%lu;;"), | 1192 | _("%s is %lu|%s=%lu;%lu;%lu;;"), |
@@ -1164,9 +1210,9 @@ main(int argc, char **argv) { | |||
1164 | result=STATE_CRITICAL; | 1210 | result=STATE_CRITICAL; |
1165 | } else { | 1211 | } else { |
1166 | nss3_value=strtoul(recv_buffer,NULL,10); | 1212 | nss3_value=strtoul(recv_buffer,NULL,10); |
1167 | if (check_critical_value==TRUE && nss3_value >= critical_value) | 1213 | if (check_critical_value && nss3_value >= critical_value) |
1168 | result=STATE_CRITICAL; | 1214 | result=STATE_CRITICAL; |
1169 | else if (check_warning_value==TRUE && nss3_value >= warning_value) | 1215 | else if (check_warning_value && nss3_value >= warning_value) |
1170 | result=STATE_WARNING; | 1216 | result=STATE_WARNING; |
1171 | xasprintf (&output_message, | 1217 | xasprintf (&output_message, |
1172 | _("%s is %lu|%s=%lu;%lu;%lu;;"), | 1218 | _("%s is %lu|%s=%lu;%lu;%lu;;"), |
@@ -1190,9 +1236,9 @@ main(int argc, char **argv) { | |||
1190 | result=STATE_CRITICAL; | 1236 | result=STATE_CRITICAL; |
1191 | } else { | 1237 | } else { |
1192 | nss4_value=strtoul(recv_buffer,NULL,10); | 1238 | nss4_value=strtoul(recv_buffer,NULL,10); |
1193 | if (check_critical_value==TRUE && nss4_value >= critical_value) | 1239 | if (check_critical_value && nss4_value >= critical_value) |
1194 | result=STATE_CRITICAL; | 1240 | result=STATE_CRITICAL; |
1195 | else if (check_warning_value==TRUE && nss4_value >= warning_value) | 1241 | else if (check_warning_value && nss4_value >= warning_value) |
1196 | result=STATE_WARNING; | 1242 | result=STATE_WARNING; |
1197 | xasprintf (&output_message, | 1243 | xasprintf (&output_message, |
1198 | _("%s is %lu|%s=%lu;%lu;%lu;;"), | 1244 | _("%s is %lu|%s=%lu;%lu;%lu;;"), |
@@ -1216,9 +1262,9 @@ main(int argc, char **argv) { | |||
1216 | result=STATE_CRITICAL; | 1262 | result=STATE_CRITICAL; |
1217 | } else { | 1263 | } else { |
1218 | nss5_value=strtoul(recv_buffer,NULL,10); | 1264 | nss5_value=strtoul(recv_buffer,NULL,10); |
1219 | if (check_critical_value==TRUE && nss5_value >= critical_value) | 1265 | if (check_critical_value && nss5_value >= critical_value) |
1220 | result=STATE_CRITICAL; | 1266 | result=STATE_CRITICAL; |
1221 | else if (check_warning_value==TRUE && nss5_value >= warning_value) | 1267 | else if (check_warning_value && nss5_value >= warning_value) |
1222 | result=STATE_WARNING; | 1268 | result=STATE_WARNING; |
1223 | xasprintf (&output_message, | 1269 | xasprintf (&output_message, |
1224 | _("%s is %lu|%s=%lu;%lu;%lu;;"), | 1270 | _("%s is %lu|%s=%lu;%lu;%lu;;"), |
@@ -1242,9 +1288,9 @@ main(int argc, char **argv) { | |||
1242 | result=STATE_CRITICAL; | 1288 | result=STATE_CRITICAL; |
1243 | } else { | 1289 | } else { |
1244 | nss6_value=strtoul(recv_buffer,NULL,10); | 1290 | nss6_value=strtoul(recv_buffer,NULL,10); |
1245 | if (check_critical_value==TRUE && nss6_value >= critical_value) | 1291 | if (check_critical_value && nss6_value >= critical_value) |
1246 | result=STATE_CRITICAL; | 1292 | result=STATE_CRITICAL; |
1247 | else if (check_warning_value==TRUE && nss6_value >= warning_value) | 1293 | else if (check_warning_value && nss6_value >= warning_value) |
1248 | result=STATE_WARNING; | 1294 | result=STATE_WARNING; |
1249 | xasprintf (&output_message, | 1295 | xasprintf (&output_message, |
1250 | _("%s is %lu|%s=%lu;%lu;%lu;;"), | 1296 | _("%s is %lu|%s=%lu;%lu;%lu;;"), |
@@ -1268,9 +1314,9 @@ main(int argc, char **argv) { | |||
1268 | result=STATE_CRITICAL; | 1314 | result=STATE_CRITICAL; |
1269 | } else { | 1315 | } else { |
1270 | nss7_value=strtoul(recv_buffer,NULL,10); | 1316 | nss7_value=strtoul(recv_buffer,NULL,10); |
1271 | if (check_critical_value==TRUE && nss7_value >= critical_value) | 1317 | if (check_critical_value && nss7_value >= critical_value) |
1272 | result=STATE_CRITICAL; | 1318 | result=STATE_CRITICAL; |
1273 | else if (check_warning_value==TRUE && nss7_value >= warning_value) | 1319 | else if (check_warning_value && nss7_value >= warning_value) |
1274 | result=STATE_WARNING; | 1320 | result=STATE_WARNING; |
1275 | xasprintf (&output_message, | 1321 | xasprintf (&output_message, |
1276 | _("%s is %lu|%s=%lu;%lu;%lu;;"), | 1322 | _("%s is %lu|%s=%lu;%lu;%lu;;"), |
@@ -1362,7 +1408,7 @@ int process_arguments(int argc, char **argv) { | |||
1362 | server_address=optarg; | 1408 | server_address=optarg; |
1363 | break; | 1409 | break; |
1364 | case 'o': /* display nos version */ | 1410 | case 'o': /* display nos version */ |
1365 | check_netware_version=TRUE; | 1411 | check_netware_version = true; |
1366 | break; | 1412 | break; |
1367 | case 'p': /* port */ | 1413 | case 'p': /* port */ |
1368 | if (is_intnonneg(optarg)) | 1414 | if (is_intnonneg(optarg)) |
@@ -1450,6 +1496,12 @@ int process_arguments(int argc, char **argv) { | |||
1450 | if (!strcmp(volume_name,"")) | 1496 | if (!strcmp(volume_name,"")) |
1451 | volume_name = strdup ("SYS"); | 1497 | volume_name = strdup ("SYS"); |
1452 | } | 1498 | } |
1499 | else if (strncmp(optarg,"VPU",3)==0) { | ||
1500 | vars_to_check=VPU; | ||
1501 | volume_name = strdup (optarg+3); | ||
1502 | if (!strcmp(volume_name,"")) | ||
1503 | volume_name = strdup ("SYS"); | ||
1504 | } | ||
1453 | else if (strncmp(optarg,"VPP",3)==0) { | 1505 | else if (strncmp(optarg,"VPP",3)==0) { |
1454 | vars_to_check=VPP; | 1506 | vars_to_check=VPP; |
1455 | volume_name = strdup (optarg+3); | 1507 | volume_name = strdup (optarg+3); |
@@ -1569,11 +1621,11 @@ int process_arguments(int argc, char **argv) { | |||
1569 | break; | 1621 | break; |
1570 | case 'w': /* warning threshold */ | 1622 | case 'w': /* warning threshold */ |
1571 | warning_value=strtoul(optarg,NULL,10); | 1623 | warning_value=strtoul(optarg,NULL,10); |
1572 | check_warning_value=TRUE; | 1624 | check_warning_value = true; |
1573 | break; | 1625 | break; |
1574 | case 'c': /* critical threshold */ | 1626 | case 'c': /* critical threshold */ |
1575 | critical_value=strtoul(optarg,NULL,10); | 1627 | critical_value=strtoul(optarg,NULL,10); |
1576 | check_critical_value=TRUE; | 1628 | check_critical_value = true; |
1577 | break; | 1629 | break; |
1578 | case 't': /* timeout */ | 1630 | case 't': /* timeout */ |
1579 | socket_timeout=atoi(optarg); | 1631 | socket_timeout=atoi(optarg); |
@@ -1626,6 +1678,7 @@ void print_help(void) | |||
1626 | printf (" %s\n", _("OFILES = number of open files")); | 1678 | printf (" %s\n", _("OFILES = number of open files")); |
1627 | printf (" %s\n", _(" VMF<vol> = MB of free space on Volume <vol>")); | 1679 | printf (" %s\n", _(" VMF<vol> = MB of free space on Volume <vol>")); |
1628 | printf (" %s\n", _(" VMU<vol> = MB used space on Volume <vol>")); | 1680 | printf (" %s\n", _(" VMU<vol> = MB used space on Volume <vol>")); |
1681 | printf (" %s\n", _(" VPU<vol> = percent used space on Volume <vol>")); | ||
1629 | printf (" %s\n", _(" VMP<vol> = MB of purgeable space on Volume <vol>")); | 1682 | printf (" %s\n", _(" VMP<vol> = MB of purgeable space on Volume <vol>")); |
1630 | printf (" %s\n", _(" VPF<vol> = percent free space on volume <vol>")); | 1683 | printf (" %s\n", _(" VPF<vol> = percent free space on volume <vol>")); |
1631 | printf (" %s\n", _(" VKF<vol> = KB of free space on volume <vol>")); | 1684 | printf (" %s\n", _(" VKF<vol> = KB of free space on volume <vol>")); |