summaryrefslogtreecommitdiffstats
path: root/plugins/check_nwstat.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/check_nwstat.c')
-rw-r--r--plugins/check_nwstat.c86
1 files changed, 85 insertions, 1 deletions
diff --git a/plugins/check_nwstat.c b/plugins/check_nwstat.c
index 100be12..17459f8 100644
--- a/plugins/check_nwstat.c
+++ b/plugins/check_nwstat.c
@@ -63,6 +63,10 @@ to gather the requested system information.\n"
63 VKNP<vol> = KB of not yet purgeable space on volume <vol>\n\ 63 VKNP<vol> = KB of not yet purgeable space on volume <vol>\n\
64 ABENDS = number of abended threads (NW 5.x only)\n\ 64 ABENDS = number of abended threads (NW 5.x only)\n\
65 CSPROCS = number of current service processes (NW 5.x only)\n\ 65 CSPROCS = number of current service processes (NW 5.x only)\n\
66 TSYNC = timesync status \n\
67 LRUS = LRU sitting time in seconds\n\
68 DCB = dirty cache buffers as a percentage of the total\n\
69 TCB = dirty cache buffers as a percentage of the original\n\
66-w, --warning=INTEGER\n\ 70-w, --warning=INTEGER\n\
67 Threshold which will result in a warning status\n\ 71 Threshold which will result in a warning status\n\
68-c, --critical=INTEGER\n\ 72-c, --critical=INTEGER\n\
@@ -84,7 +88,8 @@ Notes:\n\
84 extension for NetWare be loaded on the Novell servers you wish to check.\n\ 88 extension for NetWare be loaded on the Novell servers you wish to check.\n\
85 (available from http://www.engr.wisc.edu/~drews/mrtg/)\n\ 89 (available from http://www.engr.wisc.edu/~drews/mrtg/)\n\
86- Values for critical thresholds should be lower than warning thresholds\n\ 90- Values for critical thresholds should be lower than warning thresholds\n\
87 when the following variables are checked: VPF, VKF, LTCH, CBUFF, and LRUM.\n" 91 when the following variables are checked: VPF, VKF, LTCH, CBUFF, DCB, \n\
92 TCB, LRUS and LRUM.\n"
88 93
89#include "config.h" 94#include "config.h"
90#include "common.h" 95#include "common.h"
@@ -114,6 +119,10 @@ Notes:\n\
114#define CHECK_VPNP 20 /* check % not yet purgeable space on volume */ 119#define CHECK_VPNP 20 /* check % not yet purgeable space on volume */
115#define CHECK_ABENDS 21 /* check abended thread count */ 120#define CHECK_ABENDS 21 /* check abended thread count */
116#define CHECK_CSPROCS 22 /* check number of current service processes */ 121#define CHECK_CSPROCS 22 /* check number of current service processes */
122#define CHECK_TSYNC 23 /* check timesync status 0=no 1=yes in sync to the network */
123#define CHECK_LRUS 24 /* check LRU sitting time in seconds */
124#define CHECK_DCB 25 /* check dirty cache buffers as a percentage of the total */
125#define CHECK_TCB 26 /* check total cache buffers as a percentage of the original */
117 126
118#define PORT 9999 127#define PORT 9999
119 128
@@ -140,6 +149,9 @@ int main(int argc, char **argv){
140 char *temp_buffer=NULL; 149 char *temp_buffer=NULL;
141 char *netware_version=NULL; 150 char *netware_version=NULL;
142 151
152 int total_cache_buffers=0;
153 int dirty_cache_buffers=0;
154 int time_sync_status=0;
143 int open_files=0; 155 int open_files=0;
144 int abended_threads=0; 156 int abended_threads=0;
145 int max_service_processes=0; 157 int max_service_processes=0;
@@ -602,6 +614,70 @@ int main(int argc, char **argv){
602 614
603 asprintf(&output_message,"%d current service processes (%d max)",current_service_processes,max_service_processes); 615 asprintf(&output_message,"%d current service processes (%d max)",current_service_processes,max_service_processes);
604 616
617 /* check # Timesync Status */
618 } else if (vars_to_check==CHECK_TSYNC) {
619
620 asprintf(&send_buffer,"S22\r\n");
621 result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer));
622 if(result!=STATE_OK)
623 return result;
624
625 time_sync_status=atoi(recv_buffer);
626
627 if(time_sync_status==0) {
628 result=STATE_CRITICAL;
629 asprintf(&output_message,"Critical: Time not in sync with network!");
630 }
631 else {
632 asprintf(&output_message,"OK! Time in sync with network!");
633 }
634
635 /* check LRU sitting time in secondss */
636 } else if (vars_to_check==CHECK_LRUS) {
637
638 send_buffer = strscpy(send_buffer,"S4\r\n");
639 result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer));
640 if(result!=STATE_OK)
641 return result;
642 lru_time=strtoul(recv_buffer,NULL,10);
643
644 if(check_critical_value==TRUE && lru_time <= critical_value)
645 result=STATE_CRITICAL;
646 else if(check_warning_value==TRUE && lru_time <= warning_value)
647 result=STATE_WARNING;
648 asprintf(&output_message,"LRU sitting time = %lu seconds",lru_time);
649
650
651 /* check % dirty cache buffers as a percentage of the total*/
652 } else if (vars_to_check==CHECK_DCB) {
653
654 send_buffer = strscpy(send_buffer,"S6\r\n");
655 result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer));
656 if(result!=STATE_OK)
657 return result;
658 dirty_cache_buffers=atoi(recv_buffer);
659
660 if(check_critical_value==TRUE && dirty_cache_buffers <= critical_value)
661 result=STATE_CRITICAL;
662 else if(check_warning_value==TRUE && dirty_cache_buffers <= warning_value)
663 result=STATE_WARNING;
664 asprintf(&output_message,"dirty cache buffers = %d%% of the total",dirty_cache_buffers);
665
666 /* check % total cache buffers as a percentage of the original*/
667 } else if (vars_to_check==CHECK_TCB) {
668
669 send_buffer = strscpy(send_buffer,"S7\r\n");
670 result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer));
671 if(result!=STATE_OK)
672 return result;
673 total_cache_buffers=atoi(recv_buffer);
674
675 if(check_critical_value==TRUE && total_cache_buffers <= critical_value)
676 result=STATE_CRITICAL;
677 else if(check_warning_value==TRUE && total_cache_buffers <= warning_value)
678 result=STATE_WARNING;
679 asprintf(&output_message,"total cache buffers = %d%% of the original",total_cache_buffers);
680
605 } else { 681 } else {
606 682
607 output_message = strscpy(output_message,"Nothing to check!\n"); 683 output_message = strscpy(output_message,"Nothing to check!\n");
@@ -700,12 +776,18 @@ int process_arguments(int argc, char **argv){
700 vars_to_check=CHECK_CONNS; 776 vars_to_check=CHECK_CONNS;
701 else if(!strcmp(optarg,"LTCH")) 777 else if(!strcmp(optarg,"LTCH"))
702 vars_to_check=CHECK_LTCH; 778 vars_to_check=CHECK_LTCH;
779 else if(!strcmp(optarg,"DCB"))
780 vars_to_check=CHECK_DCB;
781 else if(!strcmp(optarg,"TCB"))
782 vars_to_check=CHECK_TCB;
703 else if(!strcmp(optarg,"CBUFF")) 783 else if(!strcmp(optarg,"CBUFF"))
704 vars_to_check=CHECK_CBUFF; 784 vars_to_check=CHECK_CBUFF;
705 else if(!strcmp(optarg,"CDBUFF")) 785 else if(!strcmp(optarg,"CDBUFF"))
706 vars_to_check=CHECK_CDBUFF; 786 vars_to_check=CHECK_CDBUFF;
707 else if(!strcmp(optarg,"LRUM")) 787 else if(!strcmp(optarg,"LRUM"))
708 vars_to_check=CHECK_LRUM; 788 vars_to_check=CHECK_LRUM;
789 else if(!strcmp(optarg,"LRUS"))
790 vars_to_check=CHECK_LRUS;
709 else if(strncmp(optarg,"VPF",3)==0){ 791 else if(strncmp(optarg,"VPF",3)==0){
710 vars_to_check=CHECK_VPF; 792 vars_to_check=CHECK_VPF;
711 volume_name = strscpy(volume_name,optarg+3); 793 volume_name = strscpy(volume_name,optarg+3);
@@ -763,6 +845,8 @@ int process_arguments(int argc, char **argv){
763 vars_to_check=CHECK_ABENDS; 845 vars_to_check=CHECK_ABENDS;
764 else if(!strcmp(optarg,"CSPROCS")) 846 else if(!strcmp(optarg,"CSPROCS"))
765 vars_to_check=CHECK_CSPROCS; 847 vars_to_check=CHECK_CSPROCS;
848 else if(!strcmp(optarg,"TSYNC"))
849 vars_to_check=CHECK_TSYNC;
766 else 850 else
767 return ERROR; 851 return ERROR;
768 break; 852 break;