summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--THANKS.in1
-rw-r--r--plugins/check_nwstat.c634
2 files changed, 611 insertions, 24 deletions
diff --git a/THANKS.in b/THANKS.in
index 751c3b49..5cdcdf71 100644
--- a/THANKS.in
+++ b/THANKS.in
@@ -190,3 +190,4 @@ Ari Pollak
190Lance Albertson 190Lance Albertson
191Nathan Vonnahme 191Nathan Vonnahme
192Mike Emigh 192Mike Emigh
193Christian Mies
diff --git a/plugins/check_nwstat.c b/plugins/check_nwstat.c
index 7495cae9..f93dee38 100644
--- a/plugins/check_nwstat.c
+++ b/plugins/check_nwstat.c
@@ -34,6 +34,9 @@ enum checkvar {
34 LOAD15, /* check 15 minute CPU load */ 34 LOAD15, /* check 15 minute CPU load */
35 CONNS, /* check number of connections */ 35 CONNS, /* check number of connections */
36 VPF, /* check % free space on volume */ 36 VPF, /* check % free space on volume */
37 VMF, /* check MB free space on volume */
38 VMU, /* check MB used space on volume */
39 VMP, /* check MB purgeable space on volume */
37 VKF, /* check KB free space on volume */ 40 VKF, /* check KB free space on volume */
38 LTCH, /* check long-term cache hit percentage */ 41 LTCH, /* check long-term cache hit percentage */
39 CBUFF, /* check total cache buffers */ 42 CBUFF, /* check total cache buffers */
@@ -41,6 +44,7 @@ enum checkvar {
41 LRUM, /* check LRU sitting time in minutes */ 44 LRUM, /* check LRU sitting time in minutes */
42 DSDB, /* check to see if DS Database is open */ 45 DSDB, /* check to see if DS Database is open */
43 LOGINS, /* check to see if logins are enabled */ 46 LOGINS, /* check to see if logins are enabled */
47 NRMH, /* check to see NRM Health Status */
44 PUPRB, /* check % of used packet receive buffers */ 48 PUPRB, /* check % of used packet receive buffers */
45 UPRB, /* check used packet receive buffers */ 49 UPRB, /* check used packet receive buffers */
46 SAPENTRIES, /* check SAP entries */ 50 SAPENTRIES, /* check SAP entries */
@@ -57,7 +61,17 @@ enum checkvar {
57 TCB, /* check total cache buffers as a percentage of the original */ 61 TCB, /* check total cache buffers as a percentage of the original */
58 DSVER, /* check NDS version */ 62 DSVER, /* check NDS version */
59 UPTIME, /* check server uptime */ 63 UPTIME, /* check server uptime */
60 NLM /* check NLM loaded */ 64 NLM, /* check NLM loaded */
65 NRMP, /* check NRM Process Values */
66 NRMM, /* check NRM Memory Values */
67 NRMS, /* check NRM Values */
68 NSS1, /* check Statistics from _Admin:Manage_NSS\GeneralStats.xml */
69 NSS2, /* check Statistics from _Admin:Manage_NSS\BufferCache.xml */
70 NSS3, /* check statistics from _Admin:Manage_NSS\NameCache.xml */
71 NSS4, /* check statistics from _Admin:Manage_NSS\FileStats.xml */
72 NSS5, /* check statistics from _Admin:Manage_NSS\ObjectCache.xml */
73 NSS6, /* check statistics from _Admin:Manage_NSS\Thread.xml */
74 NSS7 /* check statistics from _Admin:Manage_NSS\AuthorizationCache.xml */
61}; 75};
62 76
63enum { 77enum {
@@ -67,6 +81,16 @@ enum {
67char *server_address=NULL; 81char *server_address=NULL;
68char *volume_name=NULL; 82char *volume_name=NULL;
69char *nlm_name=NULL; 83char *nlm_name=NULL;
84char *nrmp_name=NULL;
85char *nrmm_name=NULL;
86char *nrms_name=NULL;
87char *nss1_name=NULL;
88char *nss2_name=NULL;
89char *nss3_name=NULL;
90char *nss4_name=NULL;
91char *nss5_name=NULL;
92char *nss6_name=NULL;
93char *nss7_name=NULL;
70int server_port=PORT; 94int server_port=PORT;
71unsigned long warning_value=0L; 95unsigned long warning_value=0L;
72unsigned long critical_value=0L; 96unsigned long critical_value=0L;
@@ -93,6 +117,7 @@ main(int argc, char **argv) {
93 char *netware_version=NULL; 117 char *netware_version=NULL;
94 118
95 int time_sync_status=0; 119 int time_sync_status=0;
120 int nrm_health_status=0;
96 unsigned long total_cache_buffers=0; 121 unsigned long total_cache_buffers=0;
97 unsigned long dirty_cache_buffers=0; 122 unsigned long dirty_cache_buffers=0;
98 unsigned long open_files=0; 123 unsigned long open_files=0;
@@ -100,6 +125,16 @@ main(int argc, char **argv) {
100 unsigned long max_service_processes=0; 125 unsigned long max_service_processes=0;
101 unsigned long current_service_processes=0; 126 unsigned long current_service_processes=0;
102 unsigned long free_disk_space=0L; 127 unsigned long free_disk_space=0L;
128 unsigned long nrmp_value=0L;
129 unsigned long nrmm_value=0L;
130 unsigned long nrms_value=0L;
131 unsigned long nss1_value=0L;
132 unsigned long nss2_value=0L;
133 unsigned long nss3_value=0L;
134 unsigned long nss4_value=0L;
135 unsigned long nss5_value=0L;
136 unsigned long nss6_value=0L;
137 unsigned long nss7_value=0L;
103 unsigned long total_disk_space=0L; 138 unsigned long total_disk_space=0L;
104 unsigned long purgeable_disk_space=0L; 139 unsigned long purgeable_disk_space=0L;
105 unsigned long non_purgeable_disk_space=0L; 140 unsigned long non_purgeable_disk_space=0L;
@@ -189,11 +224,15 @@ main(int argc, char **argv) {
189 result=STATE_WARNING; 224 result=STATE_WARNING;
190 225
191 asprintf (&output_message, 226 asprintf (&output_message,
192 _("Load %s - %s %s-min load average = %lu%%"), 227 _("Load %s - %s %s-min load average = %lu%%|load%s=%lu;%lu;%lu;0;100"),
193 state_text(result), 228 state_text(result),
194 uptime, 229 uptime,
195 temp_buffer, 230 temp_buffer,
196 utilization); 231 utilization,
232 temp_buffer,
233 utilization,
234 warning_value,
235 critical_value);
197 236
198 /* check number of user connections */ 237 /* check number of user connections */
199 } else if (vars_to_check==CONNS) { 238 } else if (vars_to_check==CONNS) {
@@ -213,9 +252,12 @@ main(int argc, char **argv) {
213 result=STATE_WARNING; 252 result=STATE_WARNING;
214 253
215 asprintf (&output_message, 254 asprintf (&output_message,
216 _("Conns %s - %lu current connections"), 255 _("Conns %s - %lu current connections|Conns=%lu;%lu;%lu;;"),
217 state_text(result), 256 state_text(result),
218 current_connections); 257 current_connections,
258 current_connections,
259 warning_value,
260 critical_value);
219 261
220 /* check % long term cache hits */ 262 /* check % long term cache hits */
221 } else if (vars_to_check==LTCH) { 263 } else if (vars_to_check==LTCH) {
@@ -257,9 +299,12 @@ main(int argc, char **argv) {
257 result=STATE_WARNING; 299 result=STATE_WARNING;
258 300
259 asprintf (&output_message, 301 asprintf (&output_message,
260 _("%s: Total cache buffers = %lu"), 302 _("%s: Total cache buffers = %lu|Cachebuffers=%lu;%lu;%lu;;"),
261 state_text(result), 303 state_text(result),
262 cache_buffers); 304 cache_buffers,
305 cache_buffers,
306 warning_value,
307 critical_value);
263 308
264 /* check dirty cache buffers */ 309 /* check dirty cache buffers */
265 } else if (vars_to_check==CDBUFF) { 310 } else if (vars_to_check==CDBUFF) {
@@ -279,9 +324,12 @@ main(int argc, char **argv) {
279 result=STATE_WARNING; 324 result=STATE_WARNING;
280 325
281 asprintf (&output_message, 326 asprintf (&output_message,
282 _("%s: Dirty cache buffers = %lu"), 327 _("%s: Dirty cache buffers = %lu|Dirty-Cache-Buffers=%lu;%lu;%lu;;"),
283 state_text(result), 328 state_text(result),
284 cache_buffers); 329 cache_buffers,
330 cache_buffers,
331 warning_value,
332 critical_value);
285 333
286 /* check LRU sitting time in minutes */ 334 /* check LRU sitting time in minutes */
287 } else if (vars_to_check==LRUM) { 335 } else if (vars_to_check==LRUM) {
@@ -327,12 +375,72 @@ main(int argc, char **argv) {
327 else if (check_warning_value==TRUE && free_disk_space <= warning_value) 375 else if (check_warning_value==TRUE && free_disk_space <= warning_value)
328 result=STATE_WARNING; 376 result=STATE_WARNING;
329 asprintf (&output_message, 377 asprintf (&output_message,
330 _("%s%lu KB free on volume %s"), 378 _("%s%lu KB free on volume %s|KBFree%s=%lu;%lu;%lu;;"),
331 (result==STATE_OK)?"":_("Only "), 379 (result==STATE_OK)?"":_("Only "),
332 free_disk_space, 380 free_disk_space,
333 volume_name); 381 volume_name,
382 volume_name,
383 free_disk_space,
384 warning_value,
385 critical_value);
334 } 386 }
335 387
388 /* check MB free space on volume */
389 } else if (vars_to_check==VMF) {
390
391 asprintf (&send_buffer,"VMF%s\r\n",volume_name);
392 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
393 if (result!=STATE_OK)
394 return result;
395
396 if (!strcmp(recv_buffer,"-1\n")) {
397 asprintf (&output_message,_("CRITICAL - Volume '%s' does not exist!"),volume_name);
398 result=STATE_CRITICAL;
399 } else {
400 free_disk_space=strtoul(recv_buffer,NULL,10);
401 if (check_critical_value==TRUE && free_disk_space <= critical_value)
402 result=STATE_CRITICAL;
403 else if (check_warning_value==TRUE && free_disk_space <= warning_value)
404 result=STATE_WARNING;
405 asprintf (&output_message,
406 _("%s%lu MB free on volume %s|MBFree%s=%lu;%lu;%lu;;"),
407 (result==STATE_OK)?"":_("Only "),
408 free_disk_space,
409 volume_name,
410 volume_name,
411 free_disk_space,
412 warning_value,
413 critical_value);
414 }
415 /* check MB used space on volume */
416 } else if (vars_to_check==VMU) {
417
418 asprintf (&send_buffer,"VMU%s\r\n",volume_name);
419 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
420 if (result!=STATE_OK)
421 return result;
422
423 if (!strcmp(recv_buffer,"-1\n")) {
424 asprintf (&output_message,_("CRITICAL - Volume '%s' does not exist!"),volume_name);
425 result=STATE_CRITICAL;
426 } else {
427 free_disk_space=strtoul(recv_buffer,NULL,10);
428 if (check_critical_value==TRUE && free_disk_space <= critical_value)
429 result=STATE_CRITICAL;
430 else if (check_warning_value==TRUE && free_disk_space <= warning_value)
431 result=STATE_WARNING;
432 asprintf (&output_message,
433 _("%s%lu MB used on volume %s|MBUsed%s=%lu;%lu;%lu;;"),
434 (result==STATE_OK)?"":_("Only "),
435 free_disk_space,
436 volume_name,
437 volume_name,
438 free_disk_space,
439 warning_value,
440 critical_value);
441 }
442
443
336 /* check % free space on volume */ 444 /* check % free space on volume */
337 } else if (vars_to_check==VPF) { 445 } else if (vars_to_check==VPF) {
338 446
@@ -370,7 +478,16 @@ main(int argc, char **argv) {
370 result=STATE_WARNING; 478 result=STATE_WARNING;
371 free_disk_space/=1024; 479 free_disk_space/=1024;
372 total_disk_space/=1024; 480 total_disk_space/=1024;
373 asprintf (&output_message,_("%lu MB (%lu%%) free on volume %s - total %lu MB"),free_disk_space,percent_free_space,volume_name,total_disk_space); 481 asprintf (&output_message,_("%lu MB (%lu%%) free on volume %s - total %lu MB|FreeMB%s=%lu;%lu;%lu;0;100"),
482 free_disk_space,
483 percent_free_space,
484 volume_name,
485 total_disk_space,
486 volume_name,
487 percent_free_space,
488 warning_value,
489 critical_value
490 );
374 } 491 }
375 492
376 /* check to see if DS Database is open or closed */ 493 /* check to see if DS Database is open or closed */
@@ -411,9 +528,35 @@ main(int argc, char **argv) {
411 result=STATE_OK; 528 result=STATE_OK;
412 else 529 else
413 result=STATE_WARNING; 530 result=STATE_WARNING;
414 531
415 asprintf (&output_message,_("Logins are %s"),(result==STATE_OK)?_("enabled"):_("disabled")); 532 asprintf (&output_message,_("Logins are %s"),(result==STATE_OK)?_("enabled"):_("disabled"));
416 533
534
535 /* check NRM Health Status Summary*/
536 } else if (vars_to_check==NRMH) {
537
538 asprintf (&send_buffer,"NRMH\r\n");
539 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
540 if (result!=STATE_OK)
541 return result;
542
543 nrm_health_status=atoi(recv_buffer);
544
545 if (nrm_health_status==2) {
546 result=STATE_OK;
547 asprintf (&output_message,_("CRITICAL - NRM Status is bad!"));
548 }
549 else {
550 if (nrm_health_status==1) {
551 result=STATE_WARNING;
552 asprintf (&output_message,_("Warning - NRM Status is suspect!"));
553 }
554
555 asprintf (&output_message,_("OK - NRM Status is good!"));
556 }
557
558
559
417 /* check packet receive buffers */ 560 /* check packet receive buffers */
418 } else if (vars_to_check==UPRB || vars_to_check==PUPRB) { 561 } else if (vars_to_check==UPRB || vars_to_check==PUPRB) {
419 562
@@ -499,7 +642,40 @@ main(int argc, char **argv) {
499 result=STATE_CRITICAL; 642 result=STATE_CRITICAL;
500 else if (check_warning_value==TRUE && purgeable_disk_space >= warning_value) 643 else if (check_warning_value==TRUE && purgeable_disk_space >= warning_value)
501 result=STATE_WARNING; 644 result=STATE_WARNING;
502 asprintf (&output_message,_("%s%lu KB purgeable on volume %s"),(result==STATE_OK)?"":_("Only "),purgeable_disk_space,volume_name); 645 asprintf (&output_message,_("%s%lu KB purgeable on volume %s|Purge%s=%lu;%lu;%lu;;"),
646 (result==STATE_OK)?"":_("Only "),
647 purgeable_disk_space,
648 volume_name,
649 volume_name,
650 purgeable_disk_space,
651 warning_value,
652 critical_value);
653 }
654 /* check MB purgeable space on volume */
655 } else if (vars_to_check==VMP) {
656
657 asprintf (&send_buffer,"VMP%s\r\n",volume_name);
658 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
659 if (result!=STATE_OK)
660 return result;
661
662 if (!strcmp(recv_buffer,"-1\n")) {
663 asprintf (&output_message,_("CRITICAL - Volume '%s' does not exist!"),volume_name);
664 result=STATE_CRITICAL;
665 } else {
666 purgeable_disk_space=strtoul(recv_buffer,NULL,10);
667 if (check_critical_value==TRUE && purgeable_disk_space >= critical_value)
668 result=STATE_CRITICAL;
669 else if (check_warning_value==TRUE && purgeable_disk_space >= warning_value)
670 result=STATE_WARNING;
671 asprintf (&output_message,_("%s%lu MB purgeable on volume %s|Purge%s=%lu;%lu;%lu;;"),
672 (result==STATE_OK)?"":_("Only "),
673 purgeable_disk_space,
674 volume_name,
675 volume_name,
676 purgeable_disk_space,
677 warning_value,
678 critical_value);
503 } 679 }
504 680
505 /* check % purgeable space on volume */ 681 /* check % purgeable space on volume */
@@ -538,7 +714,15 @@ main(int argc, char **argv) {
538 else if (check_warning_value==TRUE && percent_purgeable_space >= warning_value) 714 else if (check_warning_value==TRUE && percent_purgeable_space >= warning_value)
539 result=STATE_WARNING; 715 result=STATE_WARNING;
540 purgeable_disk_space/=1024; 716 purgeable_disk_space/=1024;
541 asprintf (&output_message,_("%lu MB (%lu%%) purgeable on volume %s"),purgeable_disk_space,percent_purgeable_space,volume_name); 717 asprintf (&output_message,_("%lu MB (%lu%%) purgeable on volume %s|Purgeable%s=%lu;%lu;%lu;0;100"),
718 purgeable_disk_space,
719 percent_purgeable_space,
720 volume_name,
721 volume_name,
722 percent_purgeable_space,
723 warning_value,
724 critical_value
725 );
542 } 726 }
543 727
544 /* check KB not yet purgeable space on volume */ 728 /* check KB not yet purgeable space on volume */
@@ -621,9 +805,14 @@ main(int argc, char **argv) {
621 else if (check_warning_value==TRUE && open_files >= warning_value) 805 else if (check_warning_value==TRUE && open_files >= warning_value)
622 result=STATE_WARNING; 806 result=STATE_WARNING;
623 807
624 asprintf (&output_message,_("%lu open files"),open_files); 808 asprintf (&output_message,_("%lu open files|Openfiles=%lu;%lu;%lu;0,0"),
809 open_files,
810 open_files,
811 warning_value,
812 critical_value);
813
625 814
626 /* check # of abended threads (Netware 5.x only) */ 815 /* check # of abended threads (Netware > 5.x only) */
627 } else if (vars_to_check==ABENDS) { 816 } else if (vars_to_check==ABENDS) {
628 817
629 close(sd); 818 close(sd);
@@ -641,7 +830,11 @@ main(int argc, char **argv) {
641 else if (check_warning_value==TRUE && abended_threads >= warning_value) 830 else if (check_warning_value==TRUE && abended_threads >= warning_value)
642 result=STATE_WARNING; 831 result=STATE_WARNING;
643 832
644 asprintf (&output_message,_("%lu abended threads"),abended_threads); 833 asprintf (&output_message,_("%lu abended threads|Abends=%lu;%lu;%lu;;"),
834 abended_threads,
835 abended_threads,
836 warning_value,
837 critical_value);
645 838
646 /* check # of current service processes (Netware 5.x only) */ 839 /* check # of current service processes (Netware 5.x only) */
647 } else if (vars_to_check==CSPROCS) { 840 } else if (vars_to_check==CSPROCS) {
@@ -672,9 +865,13 @@ main(int argc, char **argv) {
672 result=STATE_WARNING; 865 result=STATE_WARNING;
673 866
674 asprintf (&output_message, 867 asprintf (&output_message,
675 _("%lu current service processes (%lu max)"), 868 _("%lu current service processes (%lu max)|Processes=%lu;%lu;%lu;0;%lu"),
676 current_service_processes, 869 current_service_processes,
677 max_service_processes); 870 max_service_processes,
871 current_service_processes,
872 warning_value,
873 critical_value,
874 max_service_processes);
678 875
679 /* check # Timesync Status */ 876 /* check # Timesync Status */
680 } else if (vars_to_check==TSYNC) { 877 } else if (vars_to_check==TSYNC) {
@@ -697,6 +894,10 @@ main(int argc, char **argv) {
697 asprintf (&output_message,_("OK - Time in sync with network!")); 894 asprintf (&output_message,_("OK - Time in sync with network!"));
698 } 895 }
699 896
897
898
899
900
700 /* check LRU sitting time in secondss */ 901 /* check LRU sitting time in secondss */
701 } else if (vars_to_check==LRUS) { 902 } else if (vars_to_check==LRUS) {
702 903
@@ -732,7 +933,11 @@ main(int argc, char **argv) {
732 result=STATE_CRITICAL; 933 result=STATE_CRITICAL;
733 else if (check_warning_value==TRUE && dirty_cache_buffers <= warning_value) 934 else if (check_warning_value==TRUE && dirty_cache_buffers <= warning_value)
734 result=STATE_WARNING; 935 result=STATE_WARNING;
735 asprintf (&output_message,_("Dirty cache buffers = %lu%% of the total"),dirty_cache_buffers); 936 asprintf (&output_message,_("Dirty cache buffers = %lu%% of the total|DCB=%lu;%lu;%lu;0;100"),
937 dirty_cache_buffers,
938 dirty_cache_buffers,
939 warning_value,
940 critical_value);
736 941
737 /* check % total cache buffers as a percentage of the original*/ 942 /* check % total cache buffers as a percentage of the original*/
738 } else if (vars_to_check==TCB) { 943 } else if (vars_to_check==TCB) {
@@ -750,7 +955,11 @@ main(int argc, char **argv) {
750 result=STATE_CRITICAL; 955 result=STATE_CRITICAL;
751 else if (check_warning_value==TRUE && total_cache_buffers <= warning_value) 956 else if (check_warning_value==TRUE && total_cache_buffers <= warning_value)
752 result=STATE_WARNING; 957 result=STATE_WARNING;
753 asprintf (&output_message,_("Total cache buffers = %lu%% of the original"),total_cache_buffers); 958 asprintf (&output_message,_("Total cache buffers = %lu%% of the original|TCB=%lu;%lu;%lu;0;100"),
959 total_cache_buffers,
960 total_cache_buffers,
961 warning_value,
962 critical_value);
754 963
755 } else if (vars_to_check==DSVER) { 964 } else if (vars_to_check==DSVER) {
756 965
@@ -798,9 +1007,271 @@ main(int argc, char **argv) {
798 } else { 1007 } else {
799 result=STATE_CRITICAL; 1008 result=STATE_CRITICAL;
800 asprintf (&output_message,_("Module %s is not loaded"),nlm_name); 1009 asprintf (&output_message,_("Module %s is not loaded"),nlm_name);
1010
1011 }
1012 } else if (vars_to_check==NRMP) {
1013
1014 asprintf (&send_buffer,"NRMP:%s\r\n",nrmp_name);
1015 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
1016 if (result!=STATE_OK)
1017 return result;
1018
1019 if (!strcmp(recv_buffer,"-1\n")) {
1020 asprintf (&output_message,_("CRITICAL - Value '%s' does not exist!"),nrmp_name);
1021 result=STATE_CRITICAL;
1022 } else {
1023 nrmp_value=strtoul(recv_buffer,NULL,10);
1024 if (check_critical_value==TRUE && nrmp_value <= critical_value)
1025 result=STATE_CRITICAL;
1026 else if (check_warning_value==TRUE && nrmp_value <= warning_value)
1027 result=STATE_WARNING;
1028 asprintf (&output_message,
1029 _("%s is %lu|%s=%lu;%lu;%lu;;"),
1030 nrmp_name,
1031 nrmp_value,
1032 nrmp_name,
1033 nrmp_value,
1034 warning_value,
1035 critical_value);
1036 }
1037
1038 } else if (vars_to_check==NRMM) {
1039
1040 asprintf (&send_buffer,"NRMM:%s\r\n",nrmm_name);
1041 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
1042 if (result!=STATE_OK)
1043 return result;
1044
1045 if (!strcmp(recv_buffer,"-1\n")) {
1046 asprintf (&output_message,_("CRITICAL - Value '%s' does not exist!"),nrmm_name);
1047 result=STATE_CRITICAL;
1048 } else {
1049 nrmm_value=strtoul(recv_buffer,NULL,10);
1050 if (check_critical_value==TRUE && nrmm_value <= critical_value)
1051 result=STATE_CRITICAL;
1052 else if (check_warning_value==TRUE && nrmm_value <= warning_value)
1053 result=STATE_WARNING;
1054 asprintf (&output_message,
1055 _("%s is %lu|%s=%lu;%lu;%lu;;"),
1056 nrmm_name,
1057 nrmm_value,
1058 nrmm_name,
1059 nrmm_value,
1060 warning_value,
1061 critical_value);
1062 }
1063
1064 } else if (vars_to_check==NRMS) {
1065
1066 asprintf (&send_buffer,"NRMS:%s\r\n",nrms_name);
1067 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
1068 if (result!=STATE_OK)
1069 return result;
1070
1071 if (!strcmp(recv_buffer,"-1\n")) {
1072 asprintf (&output_message,_("CRITICAL - Value '%s' does not exist!"),nrms_name);
1073 result=STATE_CRITICAL;
1074 } else {
1075 nrms_value=strtoul(recv_buffer,NULL,10);
1076 if (check_critical_value==TRUE && nrms_value >= critical_value)
1077 result=STATE_CRITICAL;
1078 else if (check_warning_value==TRUE && nrms_value >= warning_value)
1079 result=STATE_WARNING;
1080 asprintf (&output_message,
1081 _("%s is %lu|%s=%lu;%lu;%lu;;"),
1082 nrms_name,
1083 nrms_value,
1084 nrms_name,
1085 nrms_value,
1086 warning_value,
1087 critical_value);
1088 }
1089
1090 } else if (vars_to_check==NSS1) {
1091
1092 asprintf (&send_buffer,"NSS1:%s\r\n",nss1_name);
1093 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
1094 if (result!=STATE_OK)
1095 return result;
1096
1097 if (!strcmp(recv_buffer,"-1\n")) {
1098 asprintf (&output_message,_("CRITICAL - Value '%s' does not exist!"),nss1_name);
1099 result=STATE_CRITICAL;
1100 } else {
1101 nss1_value=strtoul(recv_buffer,NULL,10);
1102 if (check_critical_value==TRUE && nss1_value >= critical_value)
1103 result=STATE_CRITICAL;
1104 else if (check_warning_value==TRUE && nss1_value >= warning_value)
1105 result=STATE_WARNING;
1106 asprintf (&output_message,
1107 _("%s is %lu|%s=%lu;%lu;%lu;;"),
1108 nss1_name,
1109 nss1_value,
1110 nss1_name,
1111 nss1_value,
1112 warning_value,
1113 critical_value);
1114 }
1115
1116 } else if (vars_to_check==NSS2) {
1117
1118 asprintf (&send_buffer,"NSS2:%s\r\n",nss2_name);
1119 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
1120 if (result!=STATE_OK)
1121 return result;
1122
1123 if (!strcmp(recv_buffer,"-1\n")) {
1124 asprintf (&output_message,_("CRITICAL - Value '%s' does not exist!"),nss2_name);
1125 result=STATE_CRITICAL;
1126 } else {
1127 nss2_value=strtoul(recv_buffer,NULL,10);
1128 if (check_critical_value==TRUE && nss2_value >= critical_value)
1129 result=STATE_CRITICAL;
1130 else if (check_warning_value==TRUE && nss2_value >= warning_value)
1131 result=STATE_WARNING;
1132 asprintf (&output_message,
1133 _("%s is %lu|%s=%lu;%lu;%lu;;"),
1134 nss2_name,
1135 nss2_value,
1136 nss2_name,
1137 nss2_value,
1138 warning_value,
1139 critical_value);
1140 }
1141
1142 } else if (vars_to_check==NSS3) {
1143
1144 asprintf (&send_buffer,"NSS3:%s\r\n",nss3_name);
1145 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
1146 if (result!=STATE_OK)
1147 return result;
1148
1149 if (!strcmp(recv_buffer,"-1\n")) {
1150 asprintf (&output_message,_("CRITICAL - Value '%s' does not exist!"),nss3_name);
1151 result=STATE_CRITICAL;
1152 } else {
1153 nss3_value=strtoul(recv_buffer,NULL,10);
1154 if (check_critical_value==TRUE && nss3_value >= critical_value)
1155 result=STATE_CRITICAL;
1156 else if (check_warning_value==TRUE && nss3_value >= warning_value)
1157 result=STATE_WARNING;
1158 asprintf (&output_message,
1159 _("%s is %lu|%s=%lu;%lu;%lu;;"),
1160 nss3_name,
1161 nss3_value,
1162 nss3_name,
1163 nss3_value,
1164 warning_value,
1165 critical_value);
1166 }
1167
1168 } else if (vars_to_check==NSS4) {
1169
1170 asprintf (&send_buffer,"NSS4:%s\r\n",nss4_name);
1171 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
1172 if (result!=STATE_OK)
1173 return result;
1174
1175 if (!strcmp(recv_buffer,"-1\n")) {
1176 asprintf (&output_message,_("CRITICAL - Value '%s' does not exist!"),nss4_name);
1177 result=STATE_CRITICAL;
1178 } else {
1179 nss4_value=strtoul(recv_buffer,NULL,10);
1180 if (check_critical_value==TRUE && nss4_value >= critical_value)
1181 result=STATE_CRITICAL;
1182 else if (check_warning_value==TRUE && nss4_value >= warning_value)
1183 result=STATE_WARNING;
1184 asprintf (&output_message,
1185 _("%s is %lu|%s=%lu;%lu;%lu;;"),
1186 nss4_name,
1187 nss4_value,
1188 nss4_name,
1189 nss4_value,
1190 warning_value,
1191 critical_value);
1192 }
1193
1194 } else if (vars_to_check==NSS5) {
1195
1196 asprintf (&send_buffer,"NSS5:%s\r\n",nss5_name);
1197 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
1198 if (result!=STATE_OK)
1199 return result;
1200
1201 if (!strcmp(recv_buffer,"-1\n")) {
1202 asprintf (&output_message,_("CRITICAL - Value '%s' does not exist!"),nss5_name);
1203 result=STATE_CRITICAL;
1204 } else {
1205 nss5_value=strtoul(recv_buffer,NULL,10);
1206 if (check_critical_value==TRUE && nss5_value >= critical_value)
1207 result=STATE_CRITICAL;
1208 else if (check_warning_value==TRUE && nss5_value >= warning_value)
1209 result=STATE_WARNING;
1210 asprintf (&output_message,
1211 _("%s is %lu|%s=%lu;%lu;%lu;;"),
1212 nss5_name,
1213 nss5_value,
1214 nss5_name,
1215 nss5_value,
1216 warning_value,
1217 critical_value);
1218 }
1219
1220 } else if (vars_to_check==NSS6) {
1221
1222 asprintf (&send_buffer,"NSS6:%s\r\n",nss6_name);
1223 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
1224 if (result!=STATE_OK)
1225 return result;
1226
1227 if (!strcmp(recv_buffer,"-1\n")) {
1228 asprintf (&output_message,_("CRITICAL - Value '%s' does not exist!"),nss6_name);
1229 result=STATE_CRITICAL;
1230 } else {
1231 nss6_value=strtoul(recv_buffer,NULL,10);
1232 if (check_critical_value==TRUE && nss6_value >= critical_value)
1233 result=STATE_CRITICAL;
1234 else if (check_warning_value==TRUE && nss6_value >= warning_value)
1235 result=STATE_WARNING;
1236 asprintf (&output_message,
1237 _("%s is %lu|%s=%lu;%lu;%lu;;"),
1238 nss6_name,
1239 nss6_value,
1240 nss6_name,
1241 nss6_value,
1242 warning_value,
1243 critical_value);
1244 }
1245
1246 } else if (vars_to_check==NSS7) {
1247
1248 asprintf (&send_buffer,"NSS7:%s\r\n",nss7_name);
1249 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
1250 if (result!=STATE_OK)
1251 return result;
1252
1253 if (!strcmp(recv_buffer,"-1\n")) {
1254 asprintf (&output_message,_("CRITICAL - Value '%s' does not exist!"),nss7_name);
1255 result=STATE_CRITICAL;
1256 } else {
1257 nss7_value=strtoul(recv_buffer,NULL,10);
1258 if (check_critical_value==TRUE && nss7_value >= critical_value)
1259 result=STATE_CRITICAL;
1260 else if (check_warning_value==TRUE && nss7_value >= warning_value)
1261 result=STATE_WARNING;
1262 asprintf (&output_message,
1263 _("%s is %lu|%s=%lu;%lu;%lu;;"),
1264 nss7_name,
1265 nss7_value,
1266 nss7_name,
1267 nss7_value,
1268 warning_value,
1269 critical_value);
801 } 1270 }
802 1271
803 } else { 1272
1273}
1274 else {
804 1275
805 output_message = strdup (_("Nothing to check!\n")); 1276 output_message = strdup (_("Nothing to check!\n"));
806 result=STATE_UNKNOWN; 1277 result=STATE_UNKNOWN;
@@ -923,10 +1394,18 @@ int process_arguments(int argc, char **argv) {
923 if (!strcmp(volume_name,"")) 1394 if (!strcmp(volume_name,""))
924 volume_name = strdup ("SYS"); 1395 volume_name = strdup ("SYS");
925 } 1396 }
1397 else if (strncmp(optarg,"VMF",3)==0) {
1398 vars_to_check=VMF;
1399 volume_name = strdup (optarg+3);
1400 if (!strcmp(volume_name,""))
1401 volume_name = strdup ("SYS");
1402 }
926 else if (!strcmp(optarg,"DSDB")) 1403 else if (!strcmp(optarg,"DSDB"))
927 vars_to_check=DSDB; 1404 vars_to_check=DSDB;
928 else if (!strcmp(optarg,"LOGINS")) 1405 else if (!strcmp(optarg,"LOGINS"))
929 vars_to_check=LOGINS; 1406 vars_to_check=LOGINS;
1407 else if (!strcmp(optarg,"NRMH"))
1408 vars_to_check=NRMH;
930 else if (!strcmp(optarg,"UPRB")) 1409 else if (!strcmp(optarg,"UPRB"))
931 vars_to_check=UPRB; 1410 vars_to_check=UPRB;
932 else if (!strcmp(optarg,"PUPRB")) 1411 else if (!strcmp(optarg,"PUPRB"))
@@ -946,6 +1425,18 @@ int process_arguments(int argc, char **argv) {
946 if (!strcmp(volume_name,"")) 1425 if (!strcmp(volume_name,""))
947 volume_name = strdup ("SYS"); 1426 volume_name = strdup ("SYS");
948 } 1427 }
1428 else if (strncmp(optarg,"VMP",3)==0) {
1429 vars_to_check=VMP;
1430 volume_name = strdup (optarg+3);
1431 if (!strcmp(volume_name,""))
1432 volume_name = strdup ("SYS");
1433 }
1434 else if (strncmp(optarg,"VMU",3)==0) {
1435 vars_to_check=VMU;
1436 volume_name = strdup (optarg+3);
1437 if (!strcmp(volume_name,""))
1438 volume_name = strdup ("SYS");
1439 }
949 else if (strncmp(optarg,"VPP",3)==0) { 1440 else if (strncmp(optarg,"VPP",3)==0) {
950 vars_to_check=VPP; 1441 vars_to_check=VPP;
951 volume_name = strdup (optarg+3); 1442 volume_name = strdup (optarg+3);
@@ -979,6 +1470,87 @@ int process_arguments(int argc, char **argv) {
979 vars_to_check=NLM; 1470 vars_to_check=NLM;
980 nlm_name=strdup (optarg+4); 1471 nlm_name=strdup (optarg+4);
981 } 1472 }
1473 else if (strncmp(optarg,"NRMP",4)==0) {
1474 vars_to_check=NRMP;
1475 nrmp_name = strdup (optarg+4);
1476 if (!strcmp(nrmp_name,""))
1477 nrmp_name = strdup ("AVAILABLE_MEMORY");
1478 }
1479 else if (strncmp(optarg,"NRMM",4)==0) {
1480 vars_to_check=NRMM;
1481 nrmm_name = strdup (optarg+4);
1482 if (!strcmp(nrmm_name,""))
1483 nrmm_name = strdup ("AVAILABLE_CACHE_MEMORY");
1484
1485 }
1486
1487 else if (strncmp(optarg,"NRMS",4)==0) {
1488 vars_to_check=NRMS;
1489 nrms_name = strdup (optarg+4);
1490 if (!strcmp(nrms_name,""))
1491 nrms_name = strdup ("USED_SWAP_SPACE");
1492
1493 }
1494
1495 else if (strncmp(optarg,"NSS1",4)==0) {
1496 vars_to_check=NSS1;
1497 nss1_name = strdup (optarg+4);
1498 if (!strcmp(nss1_name,""))
1499 nss1_name = strdup ("CURRENTBUFFERCACHESIZE");
1500
1501 }
1502
1503 else if (strncmp(optarg,"NSS2",4)==0) {
1504 vars_to_check=NSS2;
1505 nss2_name = strdup (optarg+4);
1506 if (!strcmp(nss2_name,""))
1507 nss2_name = strdup ("CACHEHITS");
1508
1509 }
1510
1511 else if (strncmp(optarg,"NSS3",4)==0) {
1512 vars_to_check=NSS3;
1513 nss3_name = strdup (optarg+4);
1514 if (!strcmp(nss3_name,""))
1515 nss3_name = strdup ("CACHEGITPERCENT");
1516
1517 }
1518
1519 else if (strncmp(optarg,"NSS4",4)==0) {
1520 vars_to_check=NSS4;
1521 nss4_name = strdup (optarg+4);
1522 if (!strcmp(nss4_name,""))
1523 nss4_name = strdup ("CURRENTOPENCOUNT");
1524
1525 }
1526
1527 else if (strncmp(optarg,"NSS5",4)==0) {
1528 vars_to_check=NSS5;
1529 nss5_name = strdup (optarg+4);
1530 if (!strcmp(nss5_name,""))
1531 nss5_name = strdup ("CACHEMISSES");
1532
1533 }
1534
1535
1536 else if (strncmp(optarg,"NSS6",4)==0) {
1537 vars_to_check=NSS6;
1538 nss6_name = strdup (optarg+4);
1539 if (!strcmp(nss6_name,""))
1540 nss6_name = strdup ("PENDINGWORKSCOUNT");
1541
1542 }
1543
1544
1545 else if (strncmp(optarg,"NSS7",4)==0) {
1546 vars_to_check=NSS7;
1547 nss7_name = strdup (optarg+4);
1548 if (!strcmp(nss7_name,""))
1549 nss7_name = strdup ("CACHESIZE");
1550
1551 }
1552
1553
982 else 1554 else
983 return ERROR; 1555 return ERROR;
984 break; 1556 break;
@@ -1043,6 +1615,9 @@ void print_help(void)
1043 1615
1044 printf (_("\ 1616 printf (_("\
1045 OFILES = number of open files\n\ 1617 OFILES = number of open files\n\
1618 VMF<vol> = MB of free space on Volume <vol>\n\
1619 VMU<vol> = MB used space on Volume <vol>\n\
1620 VMP<vol> = MB of purgeable space on Volume <vol>\n\
1046 VPF<vol> = percent free space on volume <vol>\n\ 1621 VPF<vol> = percent free space on volume <vol>\n\
1047 VKF<vol> = KB of free space on volume <vol>\n\ 1622 VKF<vol> = KB of free space on volume <vol>\n\
1048 VPP<vol> = percent purgeable space on volume <vol>\n\ 1623 VPP<vol> = percent purgeable space on volume <vol>\n\
@@ -1061,9 +1636,20 @@ void print_help(void)
1061 SAPENTRIES<n> = number of entries in the SAP table for SAP type <n>\n")); 1636 SAPENTRIES<n> = number of entries in the SAP table for SAP type <n>\n"));
1062 1637
1063 printf (_("\ 1638 printf (_("\
1064 TSYNC = timesync status \n\ 1639 TSYNC = timesync status\n\
1065 LOGINS = check to see if logins are enabled\n\ 1640 LOGINS = check to see if logins are enabled\n\
1066 CONNS = number of currently licensed connections\n\ 1641 CONNS = number of currently licensed connections\n\
1642 NRMH = NRM Summary Status\n\
1643 NRMP<stat> = Returns the current value for a NRM health item\n\
1644 NRMM<stat> = Returns the current memory stats from NRM\n\
1645 NRMS<stat> = Returns the current Swapfile stats from NRM\n\
1646 NSS1<stat> = Statistics from _Admin:Manage_NSS\\GeneralStats.xml\n\
1647 NSS2<stat> = Statistics from _Admin:Manage_NSS\\BufferCache.xml\n\
1648 NSS3<stat> = Statistics from _Admin:Manage_NSS\\NameCache.xml\n\
1649 NSS4<stat> = Statistics from _Admin:Manage_NSS\\FileStats.xml\n\
1650 NSS5<stat> = Statistics from _Admin:Manage_NSS\\ObjectCache.xml\n\
1651 NSS6<stat> = Statistics from _Admin:Manage_NSS\\Thread.xml\n\
1652 NSS7<stat> = Statistics from _Admin:Manage_NSS\\AuthorizationCache.xml\n\
1067 NLM:<nlm> = check if NLM is loaded and report version\n\ 1653 NLM:<nlm> = check if NLM is loaded and report version\n\
1068 (e.g. \"NLM:TSANDS.NLM\")\n")); 1654 (e.g. \"NLM:TSANDS.NLM\")\n"));
1069 1655