diff options
| author | Holger Weiss <holger@zedat.fu-berlin.de> | 2013-09-30 00:03:24 +0200 |
|---|---|---|
| committer | Holger Weiss <holger@zedat.fu-berlin.de> | 2013-09-30 00:03:24 +0200 |
| commit | 0b6423f9c99d9edf8c96fefd0f6c453859395aa1 (patch) | |
| tree | 1c2b6b21704a294940f87c7892676998d8371707 /web/attachments/46039-check_nwstat.diff | |
| download | site-0b6423f9c99d9edf8c96fefd0f6c453859395aa1.tar.gz | |
Import Nagios Plugins site
Import the Nagios Plugins web site, Cronjobs, infrastructure scripts,
and configuration files.
Diffstat (limited to 'web/attachments/46039-check_nwstat.diff')
| -rw-r--r-- | web/attachments/46039-check_nwstat.diff | 163 |
1 files changed, 163 insertions, 0 deletions
diff --git a/web/attachments/46039-check_nwstat.diff b/web/attachments/46039-check_nwstat.diff new file mode 100644 index 0000000..7f02eac --- /dev/null +++ b/web/attachments/46039-check_nwstat.diff | |||
| @@ -0,0 +1,163 @@ | |||
| 1 | *** nagios-plugins-1.3.0/plugins/check_nwstat.c Sat Feb 15 13:48:45 2003 | ||
| 2 | --- nagios-plugins-1.3.0-patched/plugins/check_nwstat.c Wed Mar 26 19:02:28 2003 | ||
| 3 | *************** | ||
| 4 | *** 63,68 **** | ||
| 5 | --- 63,73 ---- | ||
| 6 | VKNP<vol> = KB of not yet purgeable space on volume <vol>\n\ | ||
| 7 | ABENDS = number of abended threads (NW 5.x only)\n\ | ||
| 8 | CSPROCS = number of current service processes (NW 5.x only)\n\ | ||
| 9 | + TSYNC = timesync status \n\ | ||
| 10 | + LRUS = LRU sitting time in seconds\n\ | ||
| 11 | + DCB = dirty cache buffers as a percentage of the total\n\ | ||
| 12 | + TCB = dirty cache buffers as a percentage of the original\n\ | ||
| 13 | + | ||
| 14 | -w, --warning=INTEGER\n\ | ||
| 15 | Threshold which will result in a warning status\n\ | ||
| 16 | -c, --critical=INTEGER\n\ | ||
| 17 | *************** | ||
| 18 | *** 84,90 **** | ||
| 19 | extension for NetWare be loaded on the Novell servers you wish to check.\n\ | ||
| 20 | (available from http://www.engr.wisc.edu/~drews/mrtg/)\n\ | ||
| 21 | - Values for critical thresholds should be lower than warning thresholds\n\ | ||
| 22 | ! when the following variables are checked: VPF, VKF, LTCH, CBUFF, and LRUM.\n" | ||
| 23 | |||
| 24 | #include "config.h" | ||
| 25 | #include "common.h" | ||
| 26 | --- 89,95 ---- | ||
| 27 | extension for NetWare be loaded on the Novell servers you wish to check.\n\ | ||
| 28 | (available from http://www.engr.wisc.edu/~drews/mrtg/)\n\ | ||
| 29 | - Values for critical thresholds should be lower than warning thresholds\n\ | ||
| 30 | ! when the following variables are checked: VPF, VKF, LTCH, CBUFF, DCB, TCB, LRUS and LRUM.\n" | ||
| 31 | |||
| 32 | #include "config.h" | ||
| 33 | #include "common.h" | ||
| 34 | *************** | ||
| 35 | *** 114,119 **** | ||
| 36 | --- 119,128 ---- | ||
| 37 | #define CHECK_VPNP 20 /* check % not yet purgeable space on volume */ | ||
| 38 | #define CHECK_ABENDS 21 /* check abended thread count */ | ||
| 39 | #define CHECK_CSPROCS 22 /* check number of current service processes */ | ||
| 40 | + #define CHECK_TSYNC 23 /* check timesync status 0=no 1=yes in sync to the network */ | ||
| 41 | + #define CHECK_LRUS 24 /* check LRU sitting time in seconds */ | ||
| 42 | + #define CHECK_DCB 25 /* check dirty cache buffers as a percentage of the total */ | ||
| 43 | + #define CHECK_TCB 26 /* check total cache buffers as a percentage of the original */ | ||
| 44 | |||
| 45 | #define PORT 9999 | ||
| 46 | |||
| 47 | *************** | ||
| 48 | *** 140,145 **** | ||
| 49 | --- 149,157 ---- | ||
| 50 | char *temp_buffer=NULL; | ||
| 51 | char *netware_version=NULL; | ||
| 52 | |||
| 53 | + int total_cache_buffers=0; | ||
| 54 | + int dirty_cache_buffers=0; | ||
| 55 | + int time_sync_status=0; | ||
| 56 | int open_files=0; | ||
| 57 | int abended_threads=0; | ||
| 58 | int max_service_processes=0; | ||
| 59 | *************** | ||
| 60 | *** 602,607 **** | ||
| 61 | --- 614,683 ---- | ||
| 62 | |||
| 63 | asprintf(&output_message,"%d current service processes (%d max)",current_service_processes,max_service_processes); | ||
| 64 | |||
| 65 | + /* check # Timesync Status */ | ||
| 66 | + } else if (vars_to_check==CHECK_TSYNC) { | ||
| 67 | + | ||
| 68 | + asprintf(&send_buffer,"S22\r\n"); | ||
| 69 | + result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
| 70 | + if(result!=STATE_OK) | ||
| 71 | + return result; | ||
| 72 | + | ||
| 73 | + time_sync_status=atoi(recv_buffer); | ||
| 74 | + | ||
| 75 | + if(time_sync_status==0) { | ||
| 76 | + result=STATE_CRITICAL; | ||
| 77 | + asprintf(&output_message,"Critical: Time not in sync with network!"); | ||
| 78 | + } | ||
| 79 | + else { | ||
| 80 | + asprintf(&output_message,"OK! Time in sync with network!"); | ||
| 81 | + } | ||
| 82 | + | ||
| 83 | + /* check LRU sitting time in secondss */ | ||
| 84 | + } else if (vars_to_check==CHECK_LRUS) { | ||
| 85 | + | ||
| 86 | + send_buffer = strscpy(send_buffer,"S4\r\n"); | ||
| 87 | + result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
| 88 | + if(result!=STATE_OK) | ||
| 89 | + return result; | ||
| 90 | + lru_time=strtoul(recv_buffer,NULL,10); | ||
| 91 | + | ||
| 92 | + if(check_critical_value==TRUE && lru_time <= critical_value) | ||
| 93 | + result=STATE_CRITICAL; | ||
| 94 | + else if(check_warning_value==TRUE && lru_time <= warning_value) | ||
| 95 | + result=STATE_WARNING; | ||
| 96 | + asprintf(&output_message,"LRU sitting time = %lu seconds",lru_time); | ||
| 97 | + | ||
| 98 | + | ||
| 99 | + /* check % dirty cache buffers as a percentage of the total*/ | ||
| 100 | + } else if (vars_to_check==CHECK_DCB) { | ||
| 101 | + | ||
| 102 | + send_buffer = strscpy(send_buffer,"S6\r\n"); | ||
| 103 | + result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
| 104 | + if(result!=STATE_OK) | ||
| 105 | + return result; | ||
| 106 | + dirty_cache_buffers=atoi(recv_buffer); | ||
| 107 | + | ||
| 108 | + if(check_critical_value==TRUE && dirty_cache_buffers <= critical_value) | ||
| 109 | + result=STATE_CRITICAL; | ||
| 110 | + else if(check_warning_value==TRUE && dirty_cache_buffers <= warning_value) | ||
| 111 | + result=STATE_WARNING; | ||
| 112 | + asprintf(&output_message,"dirty cache buffers = %d%% of the total",dirty_cache_buffers); | ||
| 113 | + | ||
| 114 | + /* check % total cache buffers as a percentage of the original*/ | ||
| 115 | + } else if (vars_to_check==CHECK_TCB) { | ||
| 116 | + | ||
| 117 | + send_buffer = strscpy(send_buffer,"S7\r\n"); | ||
| 118 | + result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
| 119 | + if(result!=STATE_OK) | ||
| 120 | + return result; | ||
| 121 | + total_cache_buffers=atoi(recv_buffer); | ||
| 122 | + | ||
| 123 | + if(check_critical_value==TRUE && total_cache_buffers <= critical_value) | ||
| 124 | + result=STATE_CRITICAL; | ||
| 125 | + else if(check_warning_value==TRUE && total_cache_buffers <= warning_value) | ||
| 126 | + result=STATE_WARNING; | ||
| 127 | + asprintf(&output_message,"total cache buffers = %d%% of the original",total_cache_buffers); | ||
| 128 | + | ||
| 129 | } else { | ||
| 130 | |||
| 131 | output_message = strscpy(output_message,"Nothing to check!\n"); | ||
| 132 | *************** | ||
| 133 | *** 706,717 **** | ||
| 134 | --- 782,799 ---- | ||
| 135 | vars_to_check=CHECK_CONNS; | ||
| 136 | else if(!strcmp(optarg,"LTCH")) | ||
| 137 | vars_to_check=CHECK_LTCH; | ||
| 138 | + else if(!strcmp(optarg,"DCB")) | ||
| 139 | + vars_to_check=CHECK_DCB; | ||
| 140 | + else if(!strcmp(optarg,"TCB")) | ||
| 141 | + vars_to_check=CHECK_TCB; | ||
| 142 | else if(!strcmp(optarg,"CBUFF")) | ||
| 143 | vars_to_check=CHECK_CBUFF; | ||
| 144 | else if(!strcmp(optarg,"CDBUFF")) | ||
| 145 | vars_to_check=CHECK_CDBUFF; | ||
| 146 | else if(!strcmp(optarg,"LRUM")) | ||
| 147 | vars_to_check=CHECK_LRUM; | ||
| 148 | + else if(!strcmp(optarg,"LRUS")) | ||
| 149 | + vars_to_check=CHECK_LRUS; | ||
| 150 | else if(strncmp(optarg,"VPF",3)==0){ | ||
| 151 | vars_to_check=CHECK_VPF; | ||
| 152 | volume_name = strscpy(volume_name,optarg+3); | ||
| 153 | *************** | ||
| 154 | *** 769,774 **** | ||
| 155 | --- 851,858 ---- | ||
| 156 | vars_to_check=CHECK_ABENDS; | ||
| 157 | else if(!strcmp(optarg,"CSPROCS")) | ||
| 158 | vars_to_check=CHECK_CSPROCS; | ||
| 159 | + else if(!strcmp(optarg,"TSYNC")) | ||
| 160 | + vars_to_check=CHECK_TSYNC; | ||
| 161 | else | ||
| 162 | return ERROR; | ||
| 163 | break; | ||
