diff options
author | Karl DeBisschop <kdebisschop@users.sourceforge.net> | 2003-08-06 12:11:21 +0000 |
---|---|---|
committer | Karl DeBisschop <kdebisschop@users.sourceforge.net> | 2003-08-06 12:11:21 +0000 |
commit | 48c14d20bd4112826e4ac7775b847f8015c3c610 (patch) | |
tree | ebac1785d58073ac432bd08cbd45fbbbbbad7cfc /plugins | |
parent | 43efd2700d6e918e15b370f18f9ca70bb9a93a1a (diff) | |
download | monitoring-plugins-48c14d20bd4112826e4ac7775b847f8015c3c610.tar.gz |
markup for translation
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@649 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/check_nwstat.c | 1003 |
1 files changed, 518 insertions, 485 deletions
diff --git a/plugins/check_nwstat.c b/plugins/check_nwstat.c index 5dbde9ce..94f0543b 100644 --- a/plugins/check_nwstat.c +++ b/plugins/check_nwstat.c | |||
@@ -1,136 +1,66 @@ | |||
1 | /****************************************************************************** | 1 | /****************************************************************************** |
2 | * | 2 | |
3 | * Program: NetWare statistics plugin for Nagios | 3 | This program is free software; you can redistribute it and/or modify |
4 | * License: GPL | 4 | it under the terms of the GNU General Public License as published by |
5 | * | 5 | the Free Software Foundation; either version 2 of the License, or |
6 | * License Information: | 6 | (at your option) any later version. |
7 | * | 7 | |
8 | * This program is free software; you can redistribute it and/or modify | 8 | This program is distributed in the hope that it will be useful, |
9 | * it under the terms of the GNU General Public License as published by | 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 | * the Free Software Foundation; either version 2 of the License, or | 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
11 | * (at your option) any later version. | 11 | GNU General Public License for more details. |
12 | * | 12 | |
13 | * This program is distributed in the hope that it will be useful, | 13 | You should have received a copy of the GNU General Public License |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 | along with this program; if not, write to the Free Software |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 15 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
16 | * GNU General Public License for more details. | 16 | |
17 | * | 17 | ******************************************************************************/ |
18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
21 | * | ||
22 | * $Id$ | ||
23 | * | ||
24 | *****************************************************************************/ | ||
25 | 18 | ||
26 | const char *progname = "check_nwstat"; | 19 | const char *progname = "check_nwstat"; |
27 | #define REVISION "$Revision$" | 20 | const char *revision = "$Revision$"; |
28 | #define COPYRIGHT "Copyright (c) 1999-2001 Ethan Galstad" | 21 | const char *copyright = "2000-2003"; |
29 | 22 | const char *email = "nagiosplug-devel@lists.sourceforge.net"; | |
30 | #define SUMMARY "\ | ||
31 | This plugin attempts to contact the MRTGEXT NLM running on a Novell server\n\ | ||
32 | to gather the requested system information.\n" | ||
33 | |||
34 | #define OPTIONS "\ | ||
35 | -H host [-v variable] [-w warning] [-c critical]\n\ | ||
36 | [-p port] [-t timeout]" | ||
37 | |||
38 | #define LONGOPTIONS "\ | ||
39 | -H, --hostname=HOST\n\ | ||
40 | Name of the host to check\n\ | ||
41 | -v, --variable=STRING\n\ | ||
42 | Variable to check. Valid variables include:\n\ | ||
43 | LOAD1 = 1 minute average CPU load\n\ | ||
44 | LOAD5 = 5 minute average CPU load\n\ | ||
45 | LOAD15 = 15 minute average CPU load\n\ | ||
46 | CONNS = number of currently licensed connections\n\ | ||
47 | VPF<vol> = percent free space on volume <vol>\n\ | ||
48 | VKF<vol> = KB of free space on volume <vol>\n\ | ||
49 | LTCH = percent long term cache hits\n\ | ||
50 | CBUFF = current number of cache buffers\n\ | ||
51 | CDBUFF = current number of dirty cache buffers\n\ | ||
52 | LRUM = LRU sitting time in minutes\n\ | ||
53 | DSDB = check to see if DS Database is open\n\ | ||
54 | DSVER = NDS version\n\ | ||
55 | LOGINS = check to see if logins are enabled\n\ | ||
56 | UPRB = used packet receive buffers\n\ | ||
57 | PUPRB = percent (of max) used packet receive buffers\n\ | ||
58 | SAPENTRIES = number of entries in the SAP table\n\ | ||
59 | SAPENTRIES<n> = number of entries in the SAP table for SAP type <n>\n\ | ||
60 | OFILES = number of open files\n\ | ||
61 | VPP<vol> = percent purgeable space on volume <vol>\n\ | ||
62 | VKP<vol> = KB of purgeable space on volume <vol>\n\ | ||
63 | VPNP<vol> = percent not yet purgeable space on volume <vol>\n\ | ||
64 | VKNP<vol> = KB of not yet purgeable space on volume <vol>\n\ | ||
65 | ABENDS = number of abended threads (NW 5.x only)\n\ | ||
66 | CSPROCS = number of current service processes (NW 5.x only)\n\ | ||
67 | TSYNC = timesync status \n\ | ||
68 | LRUS = LRU sitting time in seconds\n\ | ||
69 | DCB = dirty cache buffers as a percentage of the total\n\ | ||
70 | TCB = dirty cache buffers as a percentage of the original\n\ | ||
71 | UPTIME = server uptime\n\ | ||
72 | NLM:<nlm> = check if NLM is loaded and report version (e.g. \"NLM:TSANDS.NLM\")\n\ | ||
73 | -w, --warning=INTEGER\n\ | ||
74 | Threshold which will result in a warning status\n\ | ||
75 | -c, --critical=INTEGER\n\ | ||
76 | Threshold which will result in a critical status\n\ | ||
77 | -p, --port=INTEGER\n\ | ||
78 | Optional port number (default: %d)\n\ | ||
79 | -t, --timeout=INTEGER\n\ | ||
80 | Seconds before connection attempt times out (default: %d)\n\ | ||
81 | -o, --osversion\n\ | ||
82 | Include server version string in results\n\ | ||
83 | -h, --help\n\ | ||
84 | Print this help screen\n\ | ||
85 | -V, --version\n\ | ||
86 | Print version information\n" | ||
87 | |||
88 | #define DESCRIPTION "\ | ||
89 | Notes:\n\ | ||
90 | - This plugin requres that the MRTGEXT.NLM file from James Drews' MRTG\n\ | ||
91 | extension for NetWare be loaded on the Novell servers you wish to check.\n\ | ||
92 | (available from http://www.engr.wisc.edu/~drews/mrtg/)\n\ | ||
93 | - Values for critical thresholds should be lower than warning thresholds\n\ | ||
94 | when the following variables are checked: VPF, VKF, LTCH, CBUFF, DCB, \n\ | ||
95 | TCB, LRUS and LRUM.\n" | ||
96 | 23 | ||
97 | #include "config.h" | ||
98 | #include "common.h" | 24 | #include "common.h" |
99 | #include "netutils.h" | 25 | #include "netutils.h" |
100 | #include "utils.h" | 26 | #include "utils.h" |
101 | 27 | ||
102 | #define CHECK_NONE 0 | 28 | enum checkvar { |
103 | #define CHECK_LOAD1 1 /* check 1 minute CPU load */ | 29 | NONE, |
104 | #define CHECK_LOAD5 2 /* check 5 minute CPU load */ | 30 | LOAD1, /* check 1 minute CPU load */ |
105 | #define CHECK_LOAD15 3 /* check 15 minute CPU load */ | 31 | LOAD5, /* check 5 minute CPU load */ |
106 | #define CHECK_CONNS 4 /* check number of connections */ | 32 | LOAD15, /* check 15 minute CPU load */ |
107 | #define CHECK_VPF 5 /* check % free space on volume */ | 33 | CONNS, /* check number of connections */ |
108 | #define CHECK_VKF 6 /* check KB free space on volume */ | 34 | VPF, /* check % free space on volume */ |
109 | #define CHECK_LTCH 7 /* check long-term cache hit percentage */ | 35 | VKF, /* check KB free space on volume */ |
110 | #define CHECK_CBUFF 8 /* check total cache buffers */ | 36 | LTCH, /* check long-term cache hit percentage */ |
111 | #define CHECK_CDBUFF 9 /* check dirty cache buffers */ | 37 | CBUFF, /* check total cache buffers */ |
112 | #define CHECK_LRUM 10 /* check LRU sitting time in minutes */ | 38 | CDBUFF, /* check dirty cache buffers */ |
113 | #define CHECK_DSDB 11 /* check to see if DS Database is open */ | 39 | LRUM, /* check LRU sitting time in minutes */ |
114 | #define CHECK_LOGINS 12 /* check to see if logins are enabled */ | 40 | DSDB, /* check to see if DS Database is open */ |
115 | #define CHECK_PUPRB 13 /* check % of used packet receive buffers */ | 41 | LOGINS, /* check to see if logins are enabled */ |
116 | #define CHECK_UPRB 14 /* check used packet receive buffers */ | 42 | PUPRB, /* check % of used packet receive buffers */ |
117 | #define CHECK_SAPENTRIES 15 /* check SAP entries */ | 43 | UPRB, /* check used packet receive buffers */ |
118 | #define CHECK_OFILES 16 /* check number of open files */ | 44 | SAPENTRIES, /* check SAP entries */ |
119 | #define CHECK_VKP 17 /* check KB purgeable space on volume */ | 45 | OFILES, /* check number of open files */ |
120 | #define CHECK_VPP 18 /* check % purgeable space on volume */ | 46 | VKP, /* check KB purgeable space on volume */ |
121 | #define CHECK_VKNP 19 /* check KB not yet purgeable space on volume */ | 47 | VPP, /* check % purgeable space on volume */ |
122 | #define CHECK_VPNP 20 /* check % not yet purgeable space on volume */ | 48 | VKNP, /* check KB not yet purgeable space on volume */ |
123 | #define CHECK_ABENDS 21 /* check abended thread count */ | 49 | VPNP, /* check % not yet purgeable space on volume */ |
124 | #define CHECK_CSPROCS 22 /* check number of current service processes */ | 50 | ABENDS, /* check abended thread count */ |
125 | #define CHECK_TSYNC 23 /* check timesync status 0=no 1=yes in sync to the network */ | 51 | CSPROCS, /* check number of current service processes */ |
126 | #define CHECK_LRUS 24 /* check LRU sitting time in seconds */ | 52 | TSYNC, /* check timesync status 0=no 1=yes in sync to the network */ |
127 | #define CHECK_DCB 25 /* check dirty cache buffers as a percentage of the total */ | 53 | LRUS, /* check LRU sitting time in seconds */ |
128 | #define CHECK_TCB 26 /* check total cache buffers as a percentage of the original */ | 54 | DCB, /* check dirty cache buffers as a percentage of the total */ |
129 | #define CHECK_DSVER 27 /* check NDS version */ | 55 | TCB, /* check total cache buffers as a percentage of the original */ |
130 | #define CHECK_UPTIME 28 /* check server uptime */ | 56 | DSVER, /* check NDS version */ |
131 | #define CHECK_NLM 29 /* check NLM loaded */ | 57 | UPTIME, /* check server uptime */ |
132 | 58 | NLM /* check NLM loaded */ | |
133 | #define PORT 9999 | 59 | }; |
60 | |||
61 | enum { | ||
62 | PORT = 9999 | ||
63 | }; | ||
134 | 64 | ||
135 | char *server_address=NULL; | 65 | char *server_address=NULL; |
136 | char *volume_name=NULL; | 66 | char *volume_name=NULL; |
@@ -141,14 +71,15 @@ unsigned long critical_value=0L; | |||
141 | int check_warning_value=FALSE; | 71 | int check_warning_value=FALSE; |
142 | int check_critical_value=FALSE; | 72 | int check_critical_value=FALSE; |
143 | int check_netware_version=FALSE; | 73 | int check_netware_version=FALSE; |
144 | unsigned long vars_to_check=CHECK_NONE; | 74 | enum checkvar vars_to_check = NONE; |
145 | int sap_number=-1; | 75 | int sap_number=-1; |
146 | 76 | ||
147 | int process_arguments(int, char **); | 77 | int process_arguments(int, char **); |
148 | void print_usage(void); | 78 | void print_usage(void); |
149 | void print_help(void); | 79 | void print_help(void); |
150 | 80 | ||
151 | int main(int argc, char **argv){ | 81 | int |
82 | main(int argc, char **argv) { | ||
152 | int result; | 83 | int result; |
153 | char *send_buffer=NULL; | 84 | char *send_buffer=NULL; |
154 | char recv_buffer[MAX_INPUT_BUFFER]; | 85 | char recv_buffer[MAX_INPUT_BUFFER]; |
@@ -156,33 +87,33 @@ int main(int argc, char **argv){ | |||
156 | char *temp_buffer=NULL; | 87 | char *temp_buffer=NULL; |
157 | char *netware_version=NULL; | 88 | char *netware_version=NULL; |
158 | 89 | ||
159 | int total_cache_buffers=0; | ||
160 | int dirty_cache_buffers=0; | ||
161 | int time_sync_status=0; | 90 | int time_sync_status=0; |
162 | int open_files=0; | 91 | unsigned long total_cache_buffers=0; |
163 | int abended_threads=0; | 92 | unsigned long dirty_cache_buffers=0; |
164 | int max_service_processes=0; | 93 | unsigned long open_files=0; |
165 | int current_service_processes=0; | 94 | unsigned long abended_threads=0; |
95 | unsigned long max_service_processes=0; | ||
96 | unsigned long current_service_processes=0; | ||
166 | unsigned long free_disk_space=0L; | 97 | unsigned long free_disk_space=0L; |
167 | unsigned long total_disk_space=0L; | 98 | unsigned long total_disk_space=0L; |
168 | unsigned long purgeable_disk_space=0L; | 99 | unsigned long purgeable_disk_space=0L; |
169 | unsigned long non_purgeable_disk_space=0L; | 100 | unsigned long non_purgeable_disk_space=0L; |
170 | int percent_free_space=0; | 101 | unsigned long percent_free_space=0; |
171 | int percent_purgeable_space=0; | 102 | unsigned long percent_purgeable_space=0; |
172 | int percent_non_purgeable_space=0; | 103 | unsigned long percent_non_purgeable_space=0; |
173 | unsigned long current_connections=0L; | 104 | unsigned long current_connections=0L; |
174 | unsigned long utilization=0L; | 105 | unsigned long utilization=0L; |
175 | int cache_hits=0; | 106 | unsigned long cache_hits=0; |
176 | unsigned long cache_buffers=0L; | 107 | unsigned long cache_buffers=0L; |
177 | unsigned long lru_time=0L; | 108 | unsigned long lru_time=0L; |
178 | char uptime[MAX_INPUT_BUFFER]; | 109 | unsigned long max_packet_receive_buffers=0; |
179 | int max_packet_receive_buffers=0; | 110 | unsigned long used_packet_receive_buffers=0; |
180 | int used_packet_receive_buffers=0; | ||
181 | unsigned long percent_used_packet_receive_buffers=0L; | 111 | unsigned long percent_used_packet_receive_buffers=0L; |
182 | int sap_entries=0; | 112 | unsigned long sap_entries=0; |
113 | char uptime[MAX_INPUT_BUFFER]; | ||
183 | 114 | ||
184 | if(process_arguments(argc,argv)==ERROR) | 115 | if (process_arguments(argc,argv)==ERROR) |
185 | usage("Could not parse arguments\n"); | 116 | usage(_("Could not parse arguments\n")); |
186 | 117 | ||
187 | /* initialize alarm signal handling */ | 118 | /* initialize alarm signal handling */ |
188 | signal(SIGALRM,socket_timeout_alarm_handler); | 119 | signal(SIGALRM,socket_timeout_alarm_handler); |
@@ -192,536 +123,567 @@ int main(int argc, char **argv){ | |||
192 | 123 | ||
193 | /* get OS version string */ | 124 | /* get OS version string */ |
194 | if (check_netware_version==TRUE) { | 125 | if (check_netware_version==TRUE) { |
195 | send_buffer = strscpy(send_buffer,"S19\r\n"); | 126 | send_buffer = strdup ("S19\r\n"); |
196 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); | 127 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); |
197 | if(result!=STATE_OK) | 128 | if (result!=STATE_OK) |
198 | return result; | 129 | return result; |
199 | if(!strcmp(recv_buffer,"-1\n")) | 130 | if (!strcmp(recv_buffer,"-1\n")) |
200 | asprintf(&netware_version,""); | 131 | asprintf (&netware_version, "%s", ""); |
201 | else { | 132 | else { |
202 | recv_buffer[strlen(recv_buffer)-1]=0; | 133 | recv_buffer[strlen(recv_buffer)-1]=0; |
203 | asprintf(&netware_version,"NetWare %s: ",recv_buffer); | 134 | asprintf (&netware_version,_("NetWare %s: "),recv_buffer); |
204 | } | 135 | } |
205 | } else | 136 | } else |
206 | asprintf(&netware_version,""); | 137 | asprintf (&netware_version, "%s", ""); |
207 | 138 | ||
208 | 139 | ||
209 | /* check CPU load */ | 140 | /* check CPU load */ |
210 | if (vars_to_check==CHECK_LOAD1 || vars_to_check==CHECK_LOAD5 || vars_to_check==CHECK_LOAD15) { | 141 | if (vars_to_check==LOAD1 || vars_to_check==LOAD5 || vars_to_check==LOAD15) { |
211 | 142 | ||
212 | switch(vars_to_check){ | 143 | switch(vars_to_check) { |
213 | case CHECK_LOAD1: | 144 | case LOAD1: |
214 | temp_buffer = strscpy(temp_buffer,"1"); | 145 | temp_buffer = strdup ("1"); |
215 | break; | 146 | break; |
216 | case CHECK_LOAD5: | 147 | case LOAD5: |
217 | temp_buffer = strscpy(temp_buffer,"5"); | 148 | temp_buffer = strdup ("5"); |
218 | break; | 149 | break; |
219 | default: | 150 | default: |
220 | temp_buffer = strscpy(temp_buffer,"15"); | 151 | temp_buffer = strdup ("15"); |
221 | break; | 152 | break; |
222 | } | 153 | } |
223 | 154 | ||
224 | asprintf(&send_buffer,"UTIL%s\r\n",temp_buffer); | 155 | asprintf (&send_buffer,"UTIL%s\r\n",temp_buffer); |
225 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); | 156 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); |
226 | if(result!=STATE_OK) | 157 | if (result!=STATE_OK) |
227 | return result; | 158 | return result; |
228 | utilization=strtoul(recv_buffer,NULL,10); | 159 | utilization=strtoul(recv_buffer,NULL,10); |
229 | send_buffer = strscpy(send_buffer,"UPTIME\r\n"); | 160 | send_buffer = strdup ("UPTIME\r\n"); |
230 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); | 161 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); |
231 | if(result!=STATE_OK) | 162 | if (result!=STATE_OK) |
232 | return result; | 163 | return result; |
233 | recv_buffer[strlen(recv_buffer)-1]=0; | 164 | recv_buffer[strlen(recv_buffer)-1]=0; |
234 | sprintf(uptime,"Up %s,",recv_buffer); | 165 | sprintf(uptime,_("Up %s,"),recv_buffer); |
235 | 166 | ||
236 | if(check_critical_value==TRUE && utilization >= critical_value) | 167 | if (check_critical_value==TRUE && utilization >= critical_value) |
237 | result=STATE_CRITICAL; | 168 | result=STATE_CRITICAL; |
238 | else if(check_warning_value==TRUE && utilization >= warning_value) | 169 | else if (check_warning_value==TRUE && utilization >= warning_value) |
239 | result=STATE_WARNING; | 170 | result=STATE_WARNING; |
240 | 171 | ||
241 | asprintf(&output_message,"Load %s - %s %s-min load average = %lu%%",(result==STATE_OK)?"ok":"problem",uptime,temp_buffer,utilization); | 172 | asprintf (&output_message, |
173 | _("Load %s - %s %s-min load average = %lu%%"), | ||
174 | state_text(result), | ||
175 | uptime, | ||
176 | temp_buffer, | ||
177 | utilization); | ||
242 | 178 | ||
243 | /* check number of user connections */ | 179 | /* check number of user connections */ |
244 | } else if (vars_to_check==CHECK_CONNS) { | 180 | } else if (vars_to_check==CONNS) { |
245 | 181 | ||
246 | send_buffer = strscpy(send_buffer,"CONNECT\r\n"); | 182 | send_buffer = strdup ("CONNECT\r\n"); |
247 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); | 183 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); |
248 | if(result!=STATE_OK) | 184 | if (result!=STATE_OK) |
249 | return result; | 185 | return result; |
250 | current_connections=strtoul(recv_buffer,NULL,10); | 186 | current_connections=strtoul(recv_buffer,NULL,10); |
251 | 187 | ||
252 | if(check_critical_value==TRUE && current_connections >= critical_value) | 188 | if (check_critical_value==TRUE && current_connections >= critical_value) |
253 | result=STATE_CRITICAL; | 189 | result=STATE_CRITICAL; |
254 | else if(check_warning_value==TRUE && current_connections >= warning_value) | 190 | else if (check_warning_value==TRUE && current_connections >= warning_value) |
255 | result=STATE_WARNING; | 191 | result=STATE_WARNING; |
256 | asprintf(&output_message,"Conns %s - %lu current connections",(result==STATE_OK)?"ok":"problem",current_connections); | ||
257 | 192 | ||
258 | /* check % long term cache hits */ | 193 | asprintf (&output_message, |
259 | } else if (vars_to_check==CHECK_LTCH) { | 194 | _("Conns %s - %lu current connections"), |
195 | state_text(result), | ||
196 | current_connections); | ||
197 | |||
198 | /* check % long term cache hits */ | ||
199 | } else if (vars_to_check==LTCH) { | ||
260 | 200 | ||
261 | send_buffer = strscpy(send_buffer,"S1\r\n"); | 201 | send_buffer = strdup ("S1\r\n"); |
262 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); | 202 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); |
263 | if(result!=STATE_OK) | 203 | if (result!=STATE_OK) |
264 | return result; | 204 | return result; |
265 | cache_hits=atoi(recv_buffer); | 205 | cache_hits=atoi(recv_buffer); |
266 | 206 | ||
267 | if(check_critical_value==TRUE && cache_hits <= critical_value) | 207 | if (check_critical_value==TRUE && cache_hits <= critical_value) |
268 | result=STATE_CRITICAL; | 208 | result=STATE_CRITICAL; |
269 | else if(check_warning_value==TRUE && cache_hits <= warning_value) | 209 | else if (check_warning_value==TRUE && cache_hits <= warning_value) |
270 | result=STATE_WARNING; | 210 | result=STATE_WARNING; |
271 | asprintf(&output_message,"Long term cache hits = %d%%",cache_hits); | ||
272 | 211 | ||
273 | /* check cache buffers */ | 212 | asprintf (&output_message, |
274 | } else if (vars_to_check==CHECK_CBUFF) { | 213 | _("%s: Long term cache hits = %lu%%"), |
214 | state_text(result), | ||
215 | cache_hits); | ||
275 | 216 | ||
276 | send_buffer = strscpy(send_buffer,"S2\r\n"); | 217 | /* check cache buffers */ |
218 | } else if (vars_to_check==CBUFF) { | ||
219 | |||
220 | send_buffer = strdup ("S2\r\n"); | ||
277 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); | 221 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); |
278 | if(result!=STATE_OK) | 222 | if (result!=STATE_OK) |
279 | return result; | 223 | return result; |
280 | cache_buffers=strtoul(recv_buffer,NULL,10); | 224 | cache_buffers=strtoul(recv_buffer,NULL,10); |
281 | 225 | ||
282 | if(check_critical_value==TRUE && cache_buffers <= critical_value) | 226 | if (check_critical_value==TRUE && cache_buffers <= critical_value) |
283 | result=STATE_CRITICAL; | 227 | result=STATE_CRITICAL; |
284 | else if(check_warning_value==TRUE && cache_buffers <= warning_value) | 228 | else if (check_warning_value==TRUE && cache_buffers <= warning_value) |
285 | result=STATE_WARNING; | 229 | result=STATE_WARNING; |
286 | asprintf(&output_message,"Total cache buffers = %lu",cache_buffers); | ||
287 | 230 | ||
288 | /* check dirty cache buffers */ | 231 | asprintf (&output_message, |
289 | } else if (vars_to_check==CHECK_CDBUFF) { | 232 | _("%s: Total cache buffers = %lu"), |
233 | state_text(result), | ||
234 | cache_buffers); | ||
235 | |||
236 | /* check dirty cache buffers */ | ||
237 | } else if (vars_to_check==CDBUFF) { | ||
290 | 238 | ||
291 | send_buffer = strscpy(send_buffer,"S3\r\n"); | 239 | send_buffer = strdup ("S3\r\n"); |
292 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); | 240 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); |
293 | if(result!=STATE_OK) | 241 | if (result!=STATE_OK) |
294 | return result; | 242 | return result; |
295 | cache_buffers=strtoul(recv_buffer,NULL,10); | 243 | cache_buffers=strtoul(recv_buffer,NULL,10); |
296 | 244 | ||
297 | if(check_critical_value==TRUE && cache_buffers >= critical_value) | 245 | if (check_critical_value==TRUE && cache_buffers >= critical_value) |
298 | result=STATE_CRITICAL; | 246 | result=STATE_CRITICAL; |
299 | else if(check_warning_value==TRUE && cache_buffers >= warning_value) | 247 | else if (check_warning_value==TRUE && cache_buffers >= warning_value) |
300 | result=STATE_WARNING; | 248 | result=STATE_WARNING; |
301 | asprintf(&output_message,"Dirty cache buffers = %lu",cache_buffers); | ||
302 | 249 | ||
303 | /* check LRU sitting time in minutes */ | 250 | asprintf (&output_message, |
304 | } else if (vars_to_check==CHECK_LRUM) { | 251 | _("%s: Dirty cache buffers = %lu"), |
252 | state_text(result), | ||
253 | cache_buffers); | ||
254 | |||
255 | /* check LRU sitting time in minutes */ | ||
256 | } else if (vars_to_check==LRUM) { | ||
305 | 257 | ||
306 | send_buffer = strscpy(send_buffer,"S5\r\n"); | 258 | send_buffer = strdup ("S5\r\n"); |
307 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); | 259 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); |
308 | if(result!=STATE_OK) | 260 | if (result!=STATE_OK) |
309 | return result; | 261 | return result; |
310 | lru_time=strtoul(recv_buffer,NULL,10); | 262 | lru_time=strtoul(recv_buffer,NULL,10); |
311 | 263 | ||
312 | if(check_critical_value==TRUE && lru_time <= critical_value) | 264 | if (check_critical_value==TRUE && lru_time <= critical_value) |
313 | result=STATE_CRITICAL; | 265 | result=STATE_CRITICAL; |
314 | else if(check_warning_value==TRUE && lru_time <= warning_value) | 266 | else if (check_warning_value==TRUE && lru_time <= warning_value) |
315 | result=STATE_WARNING; | 267 | result=STATE_WARNING; |
316 | asprintf(&output_message,"LRU sitting time = %lu minutes",lru_time); | ||
317 | 268 | ||
269 | asprintf (&output_message, | ||
270 | _("%s: LRU sitting time = %lu minutes"), | ||
271 | state_text(result), | ||
272 | lru_time); | ||
318 | 273 | ||
319 | /* check KB free space on volume */ | ||
320 | } else if (vars_to_check==CHECK_VKF) { | ||
321 | 274 | ||
322 | asprintf(&send_buffer,"VKF%s\r\n",volume_name); | 275 | /* check KB free space on volume */ |
276 | } else if (vars_to_check==VKF) { | ||
277 | |||
278 | asprintf (&send_buffer,"VKF%s\r\n",volume_name); | ||
323 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); | 279 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); |
324 | if(result!=STATE_OK) | 280 | if (result!=STATE_OK) |
325 | return result; | 281 | return result; |
326 | 282 | ||
327 | if (!strcmp(recv_buffer,"-1\n")) { | 283 | if (!strcmp(recv_buffer,"-1\n")) { |
328 | asprintf(&output_message,"Error: Volume '%s' does not exist!",volume_name); | 284 | asprintf (&output_message,_("Error: Volume '%s' does not exist!"),volume_name); |
329 | result=STATE_CRITICAL; | 285 | result=STATE_CRITICAL; |
330 | } else { | 286 | } else { |
331 | free_disk_space=strtoul(recv_buffer,NULL,10); | 287 | free_disk_space=strtoul(recv_buffer,NULL,10); |
332 | if(check_critical_value==TRUE && free_disk_space <= critical_value) | 288 | if (check_critical_value==TRUE && free_disk_space <= critical_value) |
333 | result=STATE_CRITICAL; | 289 | result=STATE_CRITICAL; |
334 | else if(check_warning_value==TRUE && free_disk_space <= warning_value) | 290 | else if (check_warning_value==TRUE && free_disk_space <= warning_value) |
335 | result=STATE_WARNING; | 291 | result=STATE_WARNING; |
336 | asprintf(&output_message,"%s%lu KB free on volume %s",(result==STATE_OK)?"":"Only ",free_disk_space,volume_name); | 292 | asprintf (&output_message, |
293 | _("%s%lu KB free on volume %s"), | ||
294 | (result==STATE_OK)?"":_("Only "), | ||
295 | free_disk_space, | ||
296 | volume_name); | ||
337 | } | 297 | } |
338 | 298 | ||
339 | /* check % free space on volume */ | 299 | /* check % free space on volume */ |
340 | } else if (vars_to_check==CHECK_VPF) { | 300 | } else if (vars_to_check==VPF) { |
341 | 301 | ||
342 | asprintf(&send_buffer,"VKF%s\r\n",volume_name); | 302 | asprintf (&send_buffer,"VKF%s\r\n",volume_name); |
343 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); | 303 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); |
344 | if(result!=STATE_OK) | 304 | if (result!=STATE_OK) |
345 | return result; | 305 | return result; |
346 | 306 | ||
347 | if(!strcmp(recv_buffer,"-1\n")){ | 307 | if (!strcmp(recv_buffer,"-1\n")) { |
348 | 308 | ||
349 | asprintf(&output_message,"Error: Volume '%s' does not exist!",volume_name); | 309 | asprintf (&output_message,_("Error: Volume '%s' does not exist!"),volume_name); |
350 | result=STATE_CRITICAL; | 310 | result=STATE_CRITICAL; |
351 | 311 | ||
352 | } else { | 312 | } else { |
353 | 313 | ||
354 | free_disk_space=strtoul(recv_buffer,NULL,10); | 314 | free_disk_space=strtoul(recv_buffer,NULL,10); |
355 | 315 | ||
356 | asprintf(&send_buffer,"VKS%s\r\n",volume_name); | 316 | asprintf (&send_buffer,"VKS%s\r\n",volume_name); |
357 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); | 317 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); |
358 | if(result!=STATE_OK) | 318 | if (result!=STATE_OK) |
359 | return result; | 319 | return result; |
360 | total_disk_space=strtoul(recv_buffer,NULL,10); | 320 | total_disk_space=strtoul(recv_buffer,NULL,10); |
361 | 321 | ||
362 | percent_free_space=(int)(((double)free_disk_space/(double)total_disk_space)*100.0); | 322 | percent_free_space=(int)(((double)free_disk_space/(double)total_disk_space)*100.0); |
363 | 323 | ||
364 | if(check_critical_value==TRUE && percent_free_space <= critical_value) | 324 | if (check_critical_value==TRUE && percent_free_space <= critical_value) |
365 | result=STATE_CRITICAL; | 325 | result=STATE_CRITICAL; |
366 | else if(check_warning_value==TRUE && percent_free_space <= warning_value) | 326 | else if (check_warning_value==TRUE && percent_free_space <= warning_value) |
367 | result=STATE_WARNING; | 327 | result=STATE_WARNING; |
368 | free_disk_space/=1024; | 328 | free_disk_space/=1024; |
369 | asprintf(&output_message,"%lu MB (%d%%) free on volume %s",free_disk_space,percent_free_space,volume_name); | 329 | asprintf (&output_message,_("%lu MB (%lu%%) free on volume %s"),free_disk_space,percent_free_space,volume_name); |
370 | } | 330 | } |
371 | 331 | ||
372 | /* check to see if DS Database is open or closed */ | 332 | /* check to see if DS Database is open or closed */ |
373 | } else if(vars_to_check==CHECK_DSDB) { | 333 | } else if (vars_to_check==DSDB) { |
374 | 334 | ||
375 | send_buffer = strscpy(send_buffer,"S11\r\n"); | 335 | send_buffer = strdup ("S11\r\n"); |
376 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); | 336 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); |
377 | if(result!=STATE_OK) | 337 | if (result!=STATE_OK) |
378 | return result; | 338 | return result; |
379 | if(atoi(recv_buffer)==1) | 339 | if (atoi(recv_buffer)==1) |
380 | result=STATE_OK; | 340 | result=STATE_OK; |
381 | else | 341 | else |
382 | result=STATE_WARNING; | 342 | result=STATE_WARNING; |
383 | 343 | ||
384 | send_buffer = strscpy(send_buffer,"S13\r\n"); | 344 | send_buffer = strdup ("S13\r\n"); |
385 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); | 345 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); |
386 | temp_buffer=strtok(recv_buffer,"\r\n"); | 346 | temp_buffer=strtok(recv_buffer,"\r\n"); |
387 | 347 | ||
388 | asprintf(&output_message,"Directory Services Database is %s (DS version %s)",(result==STATE_OK)?"open":"closed",temp_buffer); | 348 | asprintf (&output_message,_("Directory Services Database is %s (DS version %s)"),(result==STATE_OK)?"open":"closed",temp_buffer); |
389 | 349 | ||
390 | /* check to see if logins are enabled */ | 350 | /* check to see if logins are enabled */ |
391 | } else if (vars_to_check==CHECK_LOGINS) { | 351 | } else if (vars_to_check==LOGINS) { |
392 | 352 | ||
393 | send_buffer = strscpy(send_buffer,"S12\r\n"); | 353 | send_buffer = strdup ("S12\r\n"); |
394 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); | 354 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); |
395 | if(result!=STATE_OK) | 355 | if (result!=STATE_OK) |
396 | return result; | 356 | return result; |
397 | if(atoi(recv_buffer)==1) | 357 | if (atoi(recv_buffer)==1) |
398 | result=STATE_OK; | 358 | result=STATE_OK; |
399 | else | 359 | else |
400 | result=STATE_WARNING; | 360 | result=STATE_WARNING; |
401 | 361 | ||
402 | asprintf(&output_message,"Logins are %s",(result==STATE_OK)?"enabled":"disabled"); | 362 | asprintf (&output_message,_("Logins are %s"),(result==STATE_OK)?_("enabled"):_("disabled")); |
403 | 363 | ||
404 | /* check packet receive buffers */ | 364 | /* check packet receive buffers */ |
405 | } else if (vars_to_check==CHECK_UPRB || vars_to_check==CHECK_PUPRB) { | 365 | } else if (vars_to_check==UPRB || vars_to_check==PUPRB) { |
406 | 366 | ||
407 | asprintf(&send_buffer,"S15\r\n",volume_name); | 367 | asprintf (&send_buffer,"S15\r\n"); |
408 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); | 368 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); |
409 | if(result!=STATE_OK) | 369 | if (result!=STATE_OK) |
410 | return result; | 370 | return result; |
411 | 371 | ||
412 | used_packet_receive_buffers=atoi(recv_buffer); | 372 | used_packet_receive_buffers=atoi(recv_buffer); |
413 | 373 | ||
414 | asprintf(&send_buffer,"S16\r\n",volume_name); | 374 | asprintf (&send_buffer,"S16\r\n"); |
415 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); | 375 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); |
416 | if(result!=STATE_OK) | 376 | if (result!=STATE_OK) |
417 | return result; | 377 | return result; |
418 | 378 | ||
419 | max_packet_receive_buffers=atoi(recv_buffer); | 379 | max_packet_receive_buffers=atoi(recv_buffer); |
420 | 380 | ||
421 | percent_used_packet_receive_buffers=(unsigned long)(((double)used_packet_receive_buffers/(double)max_packet_receive_buffers)*100.0); | 381 | percent_used_packet_receive_buffers=(unsigned long)(((double)used_packet_receive_buffers/(double)max_packet_receive_buffers)*100.0); |
422 | 382 | ||
423 | if(vars_to_check==CHECK_UPRB){ | 383 | if (vars_to_check==UPRB) { |
424 | if(check_critical_value==TRUE && used_packet_receive_buffers >= critical_value) | 384 | if (check_critical_value==TRUE && used_packet_receive_buffers >= critical_value) |
425 | result=STATE_CRITICAL; | 385 | result=STATE_CRITICAL; |
426 | else if(check_warning_value==TRUE && used_packet_receive_buffers >= warning_value) | 386 | else if (check_warning_value==TRUE && used_packet_receive_buffers >= warning_value) |
427 | result=STATE_WARNING; | 387 | result=STATE_WARNING; |
428 | } else { | 388 | } else { |
429 | if(check_critical_value==TRUE && percent_used_packet_receive_buffers >= critical_value) | 389 | if (check_critical_value==TRUE && percent_used_packet_receive_buffers >= critical_value) |
430 | result=STATE_CRITICAL; | 390 | result=STATE_CRITICAL; |
431 | else if(check_warning_value==TRUE && percent_used_packet_receive_buffers >= warning_value) | 391 | else if (check_warning_value==TRUE && percent_used_packet_receive_buffers >= warning_value) |
432 | result=STATE_WARNING; | 392 | result=STATE_WARNING; |
433 | } | 393 | } |
434 | 394 | ||
435 | asprintf(&output_message,"%d of %d (%lu%%) packet receive buffers used",used_packet_receive_buffers,max_packet_receive_buffers,percent_used_packet_receive_buffers); | 395 | asprintf (&output_message,_("%lu of %lu (%lu%%) packet receive buffers used"),used_packet_receive_buffers,max_packet_receive_buffers,percent_used_packet_receive_buffers); |
436 | 396 | ||
437 | /* check SAP table entries */ | 397 | /* check SAP table entries */ |
438 | } else if (vars_to_check==CHECK_SAPENTRIES) { | 398 | } else if (vars_to_check==SAPENTRIES) { |
439 | 399 | ||
440 | if(sap_number==-1) | 400 | if (sap_number==-1) |
441 | asprintf(&send_buffer,"S9\r\n"); | 401 | asprintf (&send_buffer,"S9\r\n"); |
442 | else | 402 | else |
443 | asprintf(&send_buffer,"S9.%d\r\n",sap_number); | 403 | asprintf (&send_buffer,"S9.%d\r\n",sap_number); |
444 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); | 404 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); |
445 | if(result!=STATE_OK) | 405 | if (result!=STATE_OK) |
446 | return result; | 406 | return result; |
447 | 407 | ||
448 | sap_entries=atoi(recv_buffer); | 408 | sap_entries=atoi(recv_buffer); |
449 | 409 | ||
450 | if(check_critical_value==TRUE && sap_entries >= critical_value) | 410 | if (check_critical_value==TRUE && sap_entries >= critical_value) |
451 | result=STATE_CRITICAL; | 411 | result=STATE_CRITICAL; |
452 | else if(check_warning_value==TRUE && sap_entries >= warning_value) | 412 | else if (check_warning_value==TRUE && sap_entries >= warning_value) |
453 | result=STATE_WARNING; | 413 | result=STATE_WARNING; |
454 | 414 | ||
455 | if(sap_number==-1) | 415 | if (sap_number==-1) |
456 | asprintf(&output_message,"%d entries in SAP table",sap_entries); | 416 | asprintf (&output_message,_("%lu entries in SAP table"),sap_entries); |
457 | else | 417 | else |
458 | asprintf(&output_message,"%d entries in SAP table for SAP type %d",sap_entries,sap_number); | 418 | asprintf (&output_message,_("%lu entries in SAP table for SAP type %d"),sap_entries,sap_number); |
459 | 419 | ||
460 | /* check KB purgeable space on volume */ | 420 | /* check KB purgeable space on volume */ |
461 | } else if (vars_to_check==CHECK_VKP) { | 421 | } else if (vars_to_check==VKP) { |
462 | 422 | ||
463 | asprintf(&send_buffer,"VKP%s\r\n",volume_name); | 423 | asprintf (&send_buffer,"VKP%s\r\n",volume_name); |
464 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); | 424 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); |
465 | if(result!=STATE_OK) | 425 | if (result!=STATE_OK) |
466 | return result; | 426 | return result; |
467 | 427 | ||
468 | if (!strcmp(recv_buffer,"-1\n")) { | 428 | if (!strcmp(recv_buffer,"-1\n")) { |
469 | asprintf(&output_message,"Error: Volume '%s' does not exist!",volume_name); | 429 | asprintf (&output_message,_("Error: Volume '%s' does not exist!"),volume_name); |
470 | result=STATE_CRITICAL; | 430 | result=STATE_CRITICAL; |
471 | } else { | 431 | } else { |
472 | purgeable_disk_space=strtoul(recv_buffer,NULL,10); | 432 | purgeable_disk_space=strtoul(recv_buffer,NULL,10); |
473 | if(check_critical_value==TRUE && purgeable_disk_space >= critical_value) | 433 | if (check_critical_value==TRUE && purgeable_disk_space >= critical_value) |
474 | result=STATE_CRITICAL; | 434 | result=STATE_CRITICAL; |
475 | else if(check_warning_value==TRUE && purgeable_disk_space >= warning_value) | 435 | else if (check_warning_value==TRUE && purgeable_disk_space >= warning_value) |
476 | result=STATE_WARNING; | 436 | result=STATE_WARNING; |
477 | asprintf(&output_message,"%s%lu KB purgeable on volume %s",(result==STATE_OK)?"":"Only ",purgeable_disk_space,volume_name); | 437 | asprintf (&output_message,_("%s%lu KB purgeable on volume %s"),(result==STATE_OK)?"":_("Only "),purgeable_disk_space,volume_name); |
478 | } | 438 | } |
479 | 439 | ||
480 | /* check % purgeable space on volume */ | 440 | /* check % purgeable space on volume */ |
481 | } else if (vars_to_check==CHECK_VPP) { | 441 | } else if (vars_to_check==VPP) { |
482 | 442 | ||
483 | asprintf(&send_buffer,"VKP%s\r\n",volume_name); | 443 | asprintf (&send_buffer,"VKP%s\r\n",volume_name); |
484 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); | 444 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); |
485 | if(result!=STATE_OK) | 445 | if (result!=STATE_OK) |
486 | return result; | 446 | return result; |
487 | 447 | ||
488 | if(!strcmp(recv_buffer,"-1\n")){ | 448 | if (!strcmp(recv_buffer,"-1\n")) { |
489 | 449 | ||
490 | asprintf(&output_message,"Error: Volume '%s' does not exist!",volume_name); | 450 | asprintf (&output_message,_("Error: Volume '%s' does not exist!"),volume_name); |
491 | result=STATE_CRITICAL; | 451 | result=STATE_CRITICAL; |
492 | 452 | ||
493 | } else { | 453 | } else { |
494 | 454 | ||
495 | purgeable_disk_space=strtoul(recv_buffer,NULL,10); | 455 | purgeable_disk_space=strtoul(recv_buffer,NULL,10); |
496 | 456 | ||
497 | asprintf(&send_buffer,"VKS%s\r\n",volume_name); | 457 | asprintf (&send_buffer,"VKS%s\r\n",volume_name); |
498 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); | 458 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); |
499 | if(result!=STATE_OK) | 459 | if (result!=STATE_OK) |
500 | return result; | 460 | return result; |
501 | total_disk_space=strtoul(recv_buffer,NULL,10); | 461 | total_disk_space=strtoul(recv_buffer,NULL,10); |
502 | 462 | ||
503 | percent_purgeable_space=(int)(((double)purgeable_disk_space/(double)total_disk_space)*100.0); | 463 | percent_purgeable_space=(int)(((double)purgeable_disk_space/(double)total_disk_space)*100.0); |
504 | 464 | ||
505 | if(check_critical_value==TRUE && percent_purgeable_space >= critical_value) | 465 | if (check_critical_value==TRUE && percent_purgeable_space >= critical_value) |
506 | result=STATE_CRITICAL; | 466 | result=STATE_CRITICAL; |
507 | else if(check_warning_value==TRUE && percent_purgeable_space >= warning_value) | 467 | else if (check_warning_value==TRUE && percent_purgeable_space >= warning_value) |
508 | result=STATE_WARNING; | 468 | result=STATE_WARNING; |
509 | purgeable_disk_space/=1024; | 469 | purgeable_disk_space/=1024; |
510 | asprintf(&output_message,"%lu MB (%d%%) purgeable on volume %s",purgeable_disk_space,percent_purgeable_space,volume_name); | 470 | asprintf (&output_message,_("%lu MB (%lu%%) purgeable on volume %s"),purgeable_disk_space,percent_purgeable_space,volume_name); |
511 | } | 471 | } |
512 | 472 | ||
513 | /* check KB not yet purgeable space on volume */ | 473 | /* check KB not yet purgeable space on volume */ |
514 | } else if (vars_to_check==CHECK_VKNP) { | 474 | } else if (vars_to_check==VKNP) { |
515 | 475 | ||
516 | asprintf(&send_buffer,"VKNP%s\r\n",volume_name); | 476 | asprintf (&send_buffer,"VKNP%s\r\n",volume_name); |
517 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); | 477 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); |
518 | if(result!=STATE_OK) | 478 | if (result!=STATE_OK) |
519 | return result; | 479 | return result; |
520 | 480 | ||
521 | if (!strcmp(recv_buffer,"-1\n")) { | 481 | if (!strcmp(recv_buffer,"-1\n")) { |
522 | asprintf(&output_message,"Error: Volume '%s' does not exist!",volume_name); | 482 | asprintf (&output_message,_("Error: Volume '%s' does not exist!"),volume_name); |
523 | result=STATE_CRITICAL; | 483 | result=STATE_CRITICAL; |
524 | } else { | 484 | } else { |
525 | non_purgeable_disk_space=strtoul(recv_buffer,NULL,10); | 485 | non_purgeable_disk_space=strtoul(recv_buffer,NULL,10); |
526 | if(check_critical_value==TRUE && non_purgeable_disk_space >= critical_value) | 486 | if (check_critical_value==TRUE && non_purgeable_disk_space >= critical_value) |
527 | result=STATE_CRITICAL; | 487 | result=STATE_CRITICAL; |
528 | else if(check_warning_value==TRUE && non_purgeable_disk_space >= warning_value) | 488 | else if (check_warning_value==TRUE && non_purgeable_disk_space >= warning_value) |
529 | result=STATE_WARNING; | 489 | result=STATE_WARNING; |
530 | asprintf(&output_message,"%s%lu KB not yet purgeable on volume %s",(result==STATE_OK)?"":"Only ",non_purgeable_disk_space,volume_name); | 490 | asprintf (&output_message,_("%s%lu KB not yet purgeable on volume %s"),(result==STATE_OK)?"":_("Only "),non_purgeable_disk_space,volume_name); |
531 | } | 491 | } |
532 | 492 | ||
533 | /* check % not yet purgeable space on volume */ | 493 | /* check % not yet purgeable space on volume */ |
534 | } else if (vars_to_check==CHECK_VPNP) { | 494 | } else if (vars_to_check==VPNP) { |
535 | 495 | ||
536 | asprintf(&send_buffer,"VKNP%s\r\n",volume_name); | 496 | asprintf (&send_buffer,"VKNP%s\r\n",volume_name); |
537 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); | 497 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); |
538 | if(result!=STATE_OK) | 498 | if (result!=STATE_OK) |
539 | return result; | 499 | return result; |
540 | 500 | ||
541 | if(!strcmp(recv_buffer,"-1\n")){ | 501 | if (!strcmp(recv_buffer,"-1\n")) { |
542 | 502 | ||
543 | asprintf(&output_message,"Error: Volume '%s' does not exist!",volume_name); | 503 | asprintf (&output_message,_("Error: Volume '%s' does not exist!"),volume_name); |
544 | result=STATE_CRITICAL; | 504 | result=STATE_CRITICAL; |
545 | 505 | ||
546 | } else { | 506 | } else { |
547 | 507 | ||
548 | non_purgeable_disk_space=strtoul(recv_buffer,NULL,10); | 508 | non_purgeable_disk_space=strtoul(recv_buffer,NULL,10); |
549 | 509 | ||
550 | asprintf(&send_buffer,"VKS%s\r\n",volume_name); | 510 | asprintf (&send_buffer,"VKS%s\r\n",volume_name); |
551 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); | 511 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); |
552 | if(result!=STATE_OK) | 512 | if (result!=STATE_OK) |
553 | return result; | 513 | return result; |
554 | total_disk_space=strtoul(recv_buffer,NULL,10); | 514 | total_disk_space=strtoul(recv_buffer,NULL,10); |
555 | 515 | ||
556 | percent_non_purgeable_space=(int)(((double)non_purgeable_disk_space/(double)total_disk_space)*100.0); | 516 | percent_non_purgeable_space=(int)(((double)non_purgeable_disk_space/(double)total_disk_space)*100.0); |
557 | 517 | ||
558 | if(check_critical_value==TRUE && percent_non_purgeable_space >= critical_value) | 518 | if (check_critical_value==TRUE && percent_non_purgeable_space >= critical_value) |
559 | result=STATE_CRITICAL; | 519 | result=STATE_CRITICAL; |
560 | else if(check_warning_value==TRUE && percent_non_purgeable_space >= warning_value) | 520 | else if (check_warning_value==TRUE && percent_non_purgeable_space >= warning_value) |
561 | result=STATE_WARNING; | 521 | result=STATE_WARNING; |
562 | purgeable_disk_space/=1024; | 522 | purgeable_disk_space/=1024; |
563 | asprintf(&output_message,"%lu MB (%d%%) not yet purgeable on volume %s",non_purgeable_disk_space,percent_non_purgeable_space,volume_name); | 523 | asprintf (&output_message,_("%lu MB (%lu%%) not yet purgeable on volume %s"),non_purgeable_disk_space,percent_non_purgeable_space,volume_name); |
564 | } | 524 | } |
565 | 525 | ||
566 | /* check # of open files */ | 526 | /* check # of open files */ |
567 | } else if (vars_to_check==CHECK_OFILES) { | 527 | } else if (vars_to_check==OFILES) { |
568 | 528 | ||
569 | asprintf(&send_buffer,"S18\r\n"); | 529 | asprintf (&send_buffer,"S18\r\n"); |
570 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); | 530 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); |
571 | if(result!=STATE_OK) | 531 | if (result!=STATE_OK) |
572 | return result; | 532 | return result; |
573 | 533 | ||
574 | open_files=atoi(recv_buffer); | 534 | open_files=atoi(recv_buffer); |
575 | 535 | ||
576 | if(check_critical_value==TRUE && open_files >= critical_value) | 536 | if (check_critical_value==TRUE && open_files >= critical_value) |
577 | result=STATE_CRITICAL; | 537 | result=STATE_CRITICAL; |
578 | else if(check_warning_value==TRUE && open_files >= warning_value) | 538 | else if (check_warning_value==TRUE && open_files >= warning_value) |
579 | result=STATE_WARNING; | 539 | result=STATE_WARNING; |
580 | 540 | ||
581 | asprintf(&output_message,"%d open files",open_files); | 541 | asprintf (&output_message,_("%lu open files"),open_files); |
582 | 542 | ||
583 | /* check # of abended threads (Netware 5.x only) */ | 543 | /* check # of abended threads (Netware 5.x only) */ |
584 | } else if (vars_to_check==CHECK_ABENDS) { | 544 | } else if (vars_to_check==ABENDS) { |
585 | 545 | ||
586 | asprintf(&send_buffer,"S17\r\n"); | 546 | asprintf (&send_buffer,"S17\r\n"); |
587 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); | 547 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); |
588 | if(result!=STATE_OK) | 548 | if (result!=STATE_OK) |
589 | return result; | 549 | return result; |
590 | 550 | ||
591 | abended_threads=atoi(recv_buffer); | 551 | abended_threads=atoi(recv_buffer); |
592 | 552 | ||
593 | if(check_critical_value==TRUE && abended_threads >= critical_value) | 553 | if (check_critical_value==TRUE && abended_threads >= critical_value) |
594 | result=STATE_CRITICAL; | 554 | result=STATE_CRITICAL; |
595 | else if(check_warning_value==TRUE && abended_threads >= warning_value) | 555 | else if (check_warning_value==TRUE && abended_threads >= warning_value) |
596 | result=STATE_WARNING; | 556 | result=STATE_WARNING; |
597 | 557 | ||
598 | asprintf(&output_message,"%d abended threads",abended_threads); | 558 | asprintf (&output_message,_("%lu abended threads"),abended_threads); |
599 | 559 | ||
600 | /* check # of current service processes (Netware 5.x only) */ | 560 | /* check # of current service processes (Netware 5.x only) */ |
601 | } else if (vars_to_check==CHECK_CSPROCS) { | 561 | } else if (vars_to_check==CSPROCS) { |
602 | 562 | ||
603 | asprintf(&send_buffer,"S20\r\n"); | 563 | asprintf (&send_buffer,"S20\r\n"); |
604 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); | 564 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); |
605 | if(result!=STATE_OK) | 565 | if (result!=STATE_OK) |
606 | return result; | 566 | return result; |
607 | 567 | ||
608 | max_service_processes=atoi(recv_buffer); | 568 | max_service_processes=atoi(recv_buffer); |
609 | 569 | ||
610 | asprintf(&send_buffer,"S21\r\n"); | 570 | asprintf (&send_buffer,"S21\r\n"); |
611 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); | 571 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); |
612 | if(result!=STATE_OK) | 572 | if (result!=STATE_OK) |
613 | return result; | 573 | return result; |
614 | 574 | ||
615 | current_service_processes=atoi(recv_buffer); | 575 | current_service_processes=atoi(recv_buffer); |
616 | 576 | ||
617 | if(check_critical_value==TRUE && current_service_processes >= critical_value) | 577 | if (check_critical_value==TRUE && current_service_processes >= critical_value) |
618 | result=STATE_CRITICAL; | 578 | result=STATE_CRITICAL; |
619 | else if(check_warning_value==TRUE && current_service_processes >= warning_value) | 579 | else if (check_warning_value==TRUE && current_service_processes >= warning_value) |
620 | result=STATE_WARNING; | 580 | result=STATE_WARNING; |
621 | 581 | ||
622 | asprintf(&output_message,"%d current service processes (%d max)",current_service_processes,max_service_processes); | 582 | asprintf (&output_message, |
583 | _("%lu current service processes (%lu max)"), | ||
584 | current_service_processes, | ||
585 | max_service_processes); | ||
623 | 586 | ||
624 | /* check # Timesync Status */ | 587 | /* check # Timesync Status */ |
625 | } else if (vars_to_check==CHECK_TSYNC) { | 588 | } else if (vars_to_check==TSYNC) { |
626 | 589 | ||
627 | asprintf(&send_buffer,"S22\r\n"); | 590 | asprintf (&send_buffer,"S22\r\n"); |
628 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); | 591 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); |
629 | if(result!=STATE_OK) | 592 | if (result!=STATE_OK) |
630 | return result; | 593 | return result; |
631 | 594 | ||
632 | time_sync_status=atoi(recv_buffer); | 595 | time_sync_status=atoi(recv_buffer); |
633 | 596 | ||
634 | if(time_sync_status==0) { | 597 | if (time_sync_status==0) { |
635 | result=STATE_CRITICAL; | 598 | result=STATE_CRITICAL; |
636 | asprintf(&output_message,"Critical: Time not in sync with network!"); | 599 | asprintf (&output_message,_("Critical: Time not in sync with network!")); |
637 | } | 600 | } |
638 | else { | 601 | else { |
639 | asprintf(&output_message,"OK! Time in sync with network!"); | 602 | asprintf (&output_message,_("OK! Time in sync with network!")); |
640 | } | 603 | } |
641 | 604 | ||
642 | /* check LRU sitting time in secondss */ | 605 | /* check LRU sitting time in secondss */ |
643 | } else if (vars_to_check==CHECK_LRUS) { | 606 | } else if (vars_to_check==LRUS) { |
644 | 607 | ||
645 | send_buffer = strscpy(send_buffer,"S4\r\n"); | 608 | send_buffer = strdup ("S4\r\n"); |
646 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); | 609 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); |
647 | if(result!=STATE_OK) | 610 | if (result!=STATE_OK) |
648 | return result; | 611 | return result; |
649 | lru_time=strtoul(recv_buffer,NULL,10); | 612 | lru_time=strtoul(recv_buffer,NULL,10); |
650 | 613 | ||
651 | if(check_critical_value==TRUE && lru_time <= critical_value) | 614 | if (check_critical_value==TRUE && lru_time <= critical_value) |
652 | result=STATE_CRITICAL; | 615 | result=STATE_CRITICAL; |
653 | else if(check_warning_value==TRUE && lru_time <= warning_value) | 616 | else if (check_warning_value==TRUE && lru_time <= warning_value) |
654 | result=STATE_WARNING; | 617 | result=STATE_WARNING; |
655 | asprintf(&output_message,"LRU sitting time = %lu seconds",lru_time); | 618 | asprintf (&output_message,_("LRU sitting time = %lu seconds"),lru_time); |
656 | 619 | ||
657 | 620 | ||
658 | /* check % dirty cache buffers as a percentage of the total*/ | 621 | /* check % dirty cacheobuffers as a percentage of the total*/ |
659 | } else if (vars_to_check==CHECK_DCB) { | 622 | } else if (vars_to_check==DCB) { |
660 | 623 | ||
661 | send_buffer = strscpy(send_buffer,"S6\r\n"); | 624 | send_buffer = strdup ("S6\r\n"); |
662 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); | 625 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); |
663 | if(result!=STATE_OK) | 626 | if (result!=STATE_OK) |
664 | return result; | 627 | return result; |
665 | dirty_cache_buffers=atoi(recv_buffer); | 628 | dirty_cache_buffers=atoi(recv_buffer); |
666 | 629 | ||
667 | if(check_critical_value==TRUE && dirty_cache_buffers <= critical_value) | 630 | if (check_critical_value==TRUE && dirty_cache_buffers <= critical_value) |
668 | result=STATE_CRITICAL; | 631 | result=STATE_CRITICAL; |
669 | else if(check_warning_value==TRUE && dirty_cache_buffers <= warning_value) | 632 | else if (check_warning_value==TRUE && dirty_cache_buffers <= warning_value) |
670 | result=STATE_WARNING; | 633 | result=STATE_WARNING; |
671 | asprintf(&output_message,"dirty cache buffers = %d%% of the total",dirty_cache_buffers); | 634 | asprintf (&output_message,_("dirty cache buffers = %lu%% of the total"),dirty_cache_buffers); |
672 | 635 | ||
673 | /* check % total cache buffers as a percentage of the original*/ | 636 | /* check % total cache buffers as a percentage of the original*/ |
674 | } else if (vars_to_check==CHECK_TCB) { | 637 | } else if (vars_to_check==TCB) { |
675 | 638 | ||
676 | send_buffer = strscpy(send_buffer,"S7\r\n"); | 639 | send_buffer = strdup ("S7\r\n"); |
677 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); | 640 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); |
678 | if(result!=STATE_OK) | 641 | if (result!=STATE_OK) |
679 | return result; | 642 | return result; |
680 | total_cache_buffers=atoi(recv_buffer); | 643 | total_cache_buffers=atoi(recv_buffer); |
681 | 644 | ||
682 | if(check_critical_value==TRUE && total_cache_buffers <= critical_value) | 645 | if (check_critical_value==TRUE && total_cache_buffers <= critical_value) |
683 | result=STATE_CRITICAL; | 646 | result=STATE_CRITICAL; |
684 | else if(check_warning_value==TRUE && total_cache_buffers <= warning_value) | 647 | else if (check_warning_value==TRUE && total_cache_buffers <= warning_value) |
685 | result=STATE_WARNING; | 648 | result=STATE_WARNING; |
686 | asprintf(&output_message,"total cache buffers = %d%% of the original",total_cache_buffers); | 649 | asprintf (&output_message,_("total cache buffers = %lu%% of the original"),total_cache_buffers); |
687 | 650 | ||
688 | } else if (vars_to_check==CHECK_DSVER) { | 651 | } else if (vars_to_check==DSVER) { |
689 | asprintf(&send_buffer,"S13\r\n"); | 652 | asprintf (&send_buffer,"S13\r\n"); |
690 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); | 653 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); |
691 | if(result!=STATE_OK) | 654 | if (result!=STATE_OK) |
692 | return result; | 655 | return result; |
693 | 656 | ||
694 | recv_buffer[strlen(recv_buffer)-1]=0; | 657 | recv_buffer[strlen(recv_buffer)-1]=0; |
695 | 658 | ||
696 | asprintf(&output_message,"NDS Version %s",recv_buffer); | 659 | asprintf (&output_message,_("NDS Version %s"),recv_buffer); |
697 | 660 | ||
698 | } else if (vars_to_check==CHECK_UPTIME) { | 661 | } else if (vars_to_check==UPTIME) { |
699 | asprintf(&send_buffer,"UPTIME\r\n"); | 662 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); |
700 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); | 663 | if (result!=STATE_OK) |
701 | if(result!=STATE_OK) | ||
702 | return result; | 664 | return result; |
703 | 665 | ||
704 | recv_buffer[strlen(recv_buffer)-1]=0; | 666 | recv_buffer[strlen(recv_buffer)-1]=0; |
705 | 667 | ||
706 | asprintf(&output_message,"Up %s",recv_buffer); | 668 | asprintf (&output_message,_("Up %s"),recv_buffer); |
707 | 669 | ||
708 | } else if (vars_to_check==CHECK_NLM) { | 670 | } else if (vars_to_check==NLM) { |
709 | asprintf(&send_buffer,"S24:%s\r\n",nlm_name); | 671 | asprintf (&send_buffer,"S24:%s\r\n",nlm_name); |
710 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); | 672 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); |
711 | if(result!=STATE_OK) | 673 | if (result!=STATE_OK) |
712 | return result; | 674 | return result; |
713 | 675 | ||
714 | recv_buffer[strlen(recv_buffer)-1]=0; | 676 | recv_buffer[strlen(recv_buffer)-1]=0; |
715 | if(strcmp(recv_buffer,"-1")) { | 677 | if (strcmp(recv_buffer,"-1")) { |
716 | asprintf(&output_message,"Module %s version %s is loaded",nlm_name,recv_buffer); | 678 | asprintf (&output_message,_("Module %s version %s is loaded"),nlm_name,recv_buffer); |
717 | } else { | 679 | } else { |
718 | result=STATE_CRITICAL; | 680 | result=STATE_CRITICAL; |
719 | asprintf(&output_message,"Module %s is not loaded",nlm_name); | 681 | asprintf (&output_message,_("Module %s is not loaded"),nlm_name); |
720 | } | 682 | } |
721 | 683 | ||
722 | } else { | 684 | } else { |
723 | 685 | ||
724 | output_message = strscpy(output_message,"Nothing to check!\n"); | 686 | output_message = strdup (_("Nothing to check!\n")); |
725 | result=STATE_UNKNOWN; | 687 | result=STATE_UNKNOWN; |
726 | 688 | ||
727 | } | 689 | } |
@@ -733,29 +695,28 @@ int main(int argc, char **argv){ | |||
733 | 695 | ||
734 | return result; | 696 | return result; |
735 | } | 697 | } |
736 | 698 | ||
737 | |||
738 | /* process command-line arguments */ | 699 | /* process command-line arguments */ |
739 | int process_arguments(int argc, char **argv){ | 700 | int process_arguments(int argc, char **argv) { |
740 | int c; | 701 | int c; |
741 | 702 | ||
742 | int option_index = 0; | 703 | int option_index = 0; |
743 | static struct option long_options[] = | 704 | static struct option long_options[] = |
744 | { | 705 | { |
745 | {"port", required_argument,0,'p'}, | 706 | {"port", required_argument,0,'p'}, |
746 | {"timeout", required_argument,0,'t'}, | 707 | {"timeout", required_argument,0,'t'}, |
747 | {"critical", required_argument,0,'c'}, | 708 | {"critical", required_argument,0,'c'}, |
748 | {"warning", required_argument,0,'w'}, | 709 | {"warning", required_argument,0,'w'}, |
749 | {"variable", required_argument,0,'v'}, | 710 | {"variable", required_argument,0,'v'}, |
750 | {"hostname", required_argument,0,'H'}, | 711 | {"hostname", required_argument,0,'H'}, |
751 | {"osversion",no_argument, 0,'o'}, | 712 | {"osversion",no_argument, 0,'o'}, |
752 | {"version", no_argument, 0,'V'}, | 713 | {"version", no_argument, 0,'V'}, |
753 | {"help", no_argument, 0,'h'}, | 714 | {"help", no_argument, 0,'h'}, |
754 | {0,0,0,0} | 715 | {0,0,0,0} |
755 | }; | 716 | }; |
756 | 717 | ||
757 | /* no options were supplied */ | 718 | /* no options were supplied */ |
758 | if(argc<2) return ERROR; | 719 | if (argc<2) return ERROR; |
759 | 720 | ||
760 | /* backwards compatibility */ | 721 | /* backwards compatibility */ |
761 | if (! is_option(argv[1])) { | 722 | if (! is_option(argv[1])) { |
@@ -766,7 +727,7 @@ int process_arguments(int argc, char **argv){ | |||
766 | } | 727 | } |
767 | 728 | ||
768 | for (c=1;c<argc;c++) { | 729 | for (c=1;c<argc;c++) { |
769 | if(strcmp("-to",argv[c])==0) | 730 | if (strcmp("-to",argv[c])==0) |
770 | strcpy(argv[c],"-t"); | 731 | strcpy(argv[c],"-t"); |
771 | else if (strcmp("-wv",argv[c])==0) | 732 | else if (strcmp("-wv",argv[c])==0) |
772 | strcpy(argv[c],"-w"); | 733 | strcpy(argv[c],"-w"); |
@@ -774,7 +735,7 @@ int process_arguments(int argc, char **argv){ | |||
774 | strcpy(argv[c],"-c"); | 735 | strcpy(argv[c],"-c"); |
775 | } | 736 | } |
776 | 737 | ||
777 | while (1){ | 738 | while (1) { |
778 | c = getopt_long(argc,argv,"+hoVH:t:c:w:p:v:",long_options,&option_index); | 739 | c = getopt_long(argc,argv,"+hoVH:t:c:w:p:v:",long_options,&option_index); |
779 | 740 | ||
780 | if (c==-1||c==EOF||c==1) | 741 | if (c==-1||c==EOF||c==1) |
@@ -790,7 +751,7 @@ int process_arguments(int argc, char **argv){ | |||
790 | print_help(); | 751 | print_help(); |
791 | exit(STATE_OK); | 752 | exit(STATE_OK); |
792 | case 'V': /* version */ | 753 | case 'V': /* version */ |
793 | print_revision(progname,"$Revision$"); | 754 | print_revision(progname, revision); |
794 | exit(STATE_OK); | 755 | exit(STATE_OK); |
795 | case 'H': /* hostname */ | 756 | case 'H': /* hostname */ |
796 | server_address=optarg; | 757 | server_address=optarg; |
@@ -802,100 +763,100 @@ int process_arguments(int argc, char **argv){ | |||
802 | if (is_intnonneg(optarg)) | 763 | if (is_intnonneg(optarg)) |
803 | server_port=atoi(optarg); | 764 | server_port=atoi(optarg); |
804 | else | 765 | else |
805 | terminate(STATE_UNKNOWN,"Server port an integer (seconds)\nType '%s -h' for additional help\n",progname); | 766 | terminate(STATE_UNKNOWN,_("Server port an integer (seconds)\nType '%s -h' for additional help\n"),progname); |
806 | break; | 767 | break; |
807 | case 'v': | 768 | case 'v': |
808 | if(strlen(optarg)<3) | 769 | if (strlen(optarg)<3) |
809 | return ERROR; | 770 | return ERROR; |
810 | if(!strcmp(optarg,"LOAD1")) | 771 | if (!strcmp(optarg,"LOAD1")) |
811 | vars_to_check=CHECK_LOAD1; | 772 | vars_to_check=LOAD1; |
812 | else if(!strcmp(optarg,"LOAD5")) | 773 | else if (!strcmp(optarg,"LOAD5")) |
813 | vars_to_check=CHECK_LOAD5; | 774 | vars_to_check=LOAD5; |
814 | else if(!strcmp(optarg,"LOAD15")) | 775 | else if (!strcmp(optarg,"LOAD15")) |
815 | vars_to_check=CHECK_LOAD15; | 776 | vars_to_check=LOAD15; |
816 | else if(!strcmp(optarg,"CONNS")) | 777 | else if (!strcmp(optarg,"CONNS")) |
817 | vars_to_check=CHECK_CONNS; | 778 | vars_to_check=CONNS; |
818 | else if(!strcmp(optarg,"LTCH")) | 779 | else if (!strcmp(optarg,"LTCH")) |
819 | vars_to_check=CHECK_LTCH; | 780 | vars_to_check=LTCH; |
820 | else if(!strcmp(optarg,"DCB")) | 781 | else if (!strcmp(optarg,"DCB")) |
821 | vars_to_check=CHECK_DCB; | 782 | vars_to_check=DCB; |
822 | else if(!strcmp(optarg,"TCB")) | 783 | else if (!strcmp(optarg,"TCB")) |
823 | vars_to_check=CHECK_TCB; | 784 | vars_to_check=TCB; |
824 | else if(!strcmp(optarg,"CBUFF")) | 785 | else if (!strcmp(optarg,"CBUFF")) |
825 | vars_to_check=CHECK_CBUFF; | 786 | vars_to_check=CBUFF; |
826 | else if(!strcmp(optarg,"CDBUFF")) | 787 | else if (!strcmp(optarg,"CDBUFF")) |
827 | vars_to_check=CHECK_CDBUFF; | 788 | vars_to_check=CDBUFF; |
828 | else if(!strcmp(optarg,"LRUM")) | 789 | else if (!strcmp(optarg,"LRUM")) |
829 | vars_to_check=CHECK_LRUM; | 790 | vars_to_check=LRUM; |
830 | else if(!strcmp(optarg,"LRUS")) | 791 | else if (!strcmp(optarg,"LRUS")) |
831 | vars_to_check=CHECK_LRUS; | 792 | vars_to_check=LRUS; |
832 | else if(strncmp(optarg,"VPF",3)==0){ | 793 | else if (strncmp(optarg,"VPF",3)==0) { |
833 | vars_to_check=CHECK_VPF; | 794 | vars_to_check=VPF; |
834 | volume_name = strscpy(volume_name,optarg+3); | 795 | volume_name = strdup (optarg+3); |
835 | if(!strcmp(volume_name,"")) | 796 | if (!strcmp(volume_name,"")) |
836 | volume_name = strscpy(volume_name,"SYS"); | 797 | volume_name = strdup ("SYS"); |
837 | } | 798 | } |
838 | else if(strncmp(optarg,"VKF",3)==0){ | 799 | else if (strncmp(optarg,"VKF",3)==0) { |
839 | vars_to_check=CHECK_VKF; | 800 | vars_to_check=VKF; |
840 | volume_name = strscpy(volume_name,optarg+3); | 801 | volume_name = strdup (optarg+3); |
841 | if(!strcmp(volume_name,"")) | 802 | if (!strcmp(volume_name,"")) |
842 | volume_name = strscpy(volume_name,"SYS"); | 803 | volume_name = strdup ("SYS"); |
843 | } | 804 | } |
844 | else if(!strcmp(optarg,"DSDB")) | 805 | else if (!strcmp(optarg,"DSDB")) |
845 | vars_to_check=CHECK_DSDB; | 806 | vars_to_check=DSDB; |
846 | else if(!strcmp(optarg,"LOGINS")) | 807 | else if (!strcmp(optarg,"LOGINS")) |
847 | vars_to_check=CHECK_LOGINS; | 808 | vars_to_check=LOGINS; |
848 | else if(!strcmp(optarg,"UPRB")) | 809 | else if (!strcmp(optarg,"UPRB")) |
849 | vars_to_check=CHECK_UPRB; | 810 | vars_to_check=UPRB; |
850 | else if(!strcmp(optarg,"PUPRB")) | 811 | else if (!strcmp(optarg,"PUPRB")) |
851 | vars_to_check=CHECK_PUPRB; | 812 | vars_to_check=PUPRB; |
852 | else if(!strncmp(optarg,"SAPENTRIES",10)){ | 813 | else if (!strncmp(optarg,"SAPENTRIES",10)) { |
853 | vars_to_check=CHECK_SAPENTRIES; | 814 | vars_to_check=SAPENTRIES; |
854 | if(strlen(optarg)>10) | 815 | if (strlen(optarg)>10) |
855 | sap_number=atoi(optarg+10); | 816 | sap_number=atoi(optarg+10); |
856 | else | 817 | else |
857 | sap_number=-1; | 818 | sap_number=-1; |
858 | } | 819 | } |
859 | else if(!strcmp(optarg,"OFILES")) | 820 | else if (!strcmp(optarg,"OFILES")) |
860 | vars_to_check=CHECK_OFILES; | 821 | vars_to_check=OFILES; |
861 | else if(strncmp(optarg,"VKP",3)==0){ | 822 | else if (strncmp(optarg,"VKP",3)==0) { |
862 | vars_to_check=CHECK_VKP; | 823 | vars_to_check=VKP; |
863 | volume_name = strscpy(volume_name,optarg+3); | 824 | volume_name = strdup (optarg+3); |
864 | if(!strcmp(volume_name,"")) | 825 | if (!strcmp(volume_name,"")) |
865 | volume_name = strscpy(volume_name,"SYS"); | 826 | volume_name = strdup ("SYS"); |
866 | } | 827 | } |
867 | else if(strncmp(optarg,"VPP",3)==0){ | 828 | else if (strncmp(optarg,"VPP",3)==0) { |
868 | vars_to_check=CHECK_VPP; | 829 | vars_to_check=VPP; |
869 | volume_name = strscpy(volume_name,optarg+3); | 830 | volume_name = strdup (optarg+3); |
870 | if(!strcmp(volume_name,"")) | 831 | if (!strcmp(volume_name,"")) |
871 | volume_name = strscpy(volume_name,"SYS"); | 832 | volume_name = strdup ("SYS"); |
872 | } | 833 | } |
873 | else if(strncmp(optarg,"VKNP",4)==0){ | 834 | else if (strncmp(optarg,"VKNP",4)==0) { |
874 | vars_to_check=CHECK_VKNP; | 835 | vars_to_check=VKNP; |
875 | volume_name = strscpy(volume_name,optarg+4); | 836 | volume_name = strdup (optarg+4); |
876 | if(!strcmp(volume_name,"")) | 837 | if (!strcmp(volume_name,"")) |
877 | volume_name = strscpy(volume_name,"SYS"); | 838 | volume_name = strdup ("SYS"); |
878 | } | 839 | } |
879 | else if(strncmp(optarg,"VPNP",4)==0){ | 840 | else if (strncmp(optarg,"VPNP",4)==0) { |
880 | vars_to_check=CHECK_VPNP; | 841 | vars_to_check=VPNP; |
881 | volume_name = strscpy(volume_name,optarg+4); | 842 | volume_name = strdup (optarg+4); |
882 | if(!strcmp(volume_name,"")) | 843 | if (!strcmp(volume_name,"")) |
883 | volume_name = strscpy(volume_name,"SYS"); | 844 | volume_name = strdup("SYS"); |
845 | } | ||
846 | else if (!strcmp(optarg,"ABENDS")) | ||
847 | vars_to_check=ABENDS; | ||
848 | else if (!strcmp(optarg,"CSPROCS")) | ||
849 | vars_to_check=CSPROCS; | ||
850 | else if (!strcmp(optarg,"TSYNC")) | ||
851 | vars_to_check=TSYNC; | ||
852 | else if (!strcmp(optarg,"DSVER")) | ||
853 | vars_to_check=DSVER; | ||
854 | else if (!strcmp(optarg,"UPTIME")) | ||
855 | vars_to_check=UPTIME; | ||
856 | else if (strncmp(optarg,"NLM:",4)==0) { | ||
857 | vars_to_check=NLM; | ||
858 | nlm_name=strdup (optarg+4); | ||
884 | } | 859 | } |
885 | else if(!strcmp(optarg,"ABENDS")) | ||
886 | vars_to_check=CHECK_ABENDS; | ||
887 | else if(!strcmp(optarg,"CSPROCS")) | ||
888 | vars_to_check=CHECK_CSPROCS; | ||
889 | else if(!strcmp(optarg,"TSYNC")) | ||
890 | vars_to_check=CHECK_TSYNC; | ||
891 | else if(!strcmp(optarg,"DSVER")) | ||
892 | vars_to_check=CHECK_DSVER; | ||
893 | else if(!strcmp(optarg,"UPTIME")) | ||
894 | vars_to_check=CHECK_UPTIME; | ||
895 | else if(strncmp(optarg,"NLM:",4)==0) { | ||
896 | vars_to_check=CHECK_NLM; | ||
897 | nlm_name=strscpy(nlm_name,optarg+4); | ||
898 | } | ||
899 | else | 860 | else |
900 | return ERROR; | 861 | return ERROR; |
901 | break; | 862 | break; |
@@ -909,7 +870,7 @@ int process_arguments(int argc, char **argv){ | |||
909 | break; | 870 | break; |
910 | case 't': /* timeout */ | 871 | case 't': /* timeout */ |
911 | socket_timeout=atoi(optarg); | 872 | socket_timeout=atoi(optarg); |
912 | if(socket_timeout<=0) | 873 | if (socket_timeout<=0) |
913 | return ERROR; | 874 | return ERROR; |
914 | } | 875 | } |
915 | 876 | ||
@@ -917,25 +878,97 @@ int process_arguments(int argc, char **argv){ | |||
917 | 878 | ||
918 | return OK; | 879 | return OK; |
919 | } | 880 | } |
920 | 881 | ||
921 | |||
922 | void print_usage(void) | 882 | void print_usage(void) |
923 | { | 883 | { |
924 | printf | 884 | printf (_("\ |
925 | ("Usage:\n" | 885 | Usage: %s -H host [-p port] [-v variable] [-w warning] [-c critical]\n\ |
926 | " %s %s\n" | 886 | [-t timeout].\n"), progname); |
927 | " %s (-h | --help) for detailed help\n" | 887 | printf (_(UT_HLP_VRS), progname, progname); |
928 | " %s (-V | --version) for version information\n", | ||
929 | progname, OPTIONS, progname, progname); | ||
930 | } | 888 | } |
931 | 889 | ||
932 | void print_help(void) | 890 | void print_help(void) |
933 | { | 891 | { |
934 | print_revision (progname, REVISION); | 892 | char *myport; |
935 | printf ("%s\n\n%s\n", COPYRIGHT, SUMMARY); | 893 | asprintf (&myport, "%d", PORT); |
894 | |||
895 | print_revision (progname, revision); | ||
896 | |||
897 | printf (_("Copyright (c) 1999-2001 Ethan Galstad <nagios@nagios.org>\n")); | ||
898 | printf (_(COPYRIGHT), copyright, email); | ||
899 | |||
900 | printf (_("\ | ||
901 | Usage: %s This plugin attempts to contact the MRTGEXT NLM running\n\ | ||
902 | on a Novell server to gather the requested system information.\n\n"), | ||
903 | progname); | ||
904 | |||
936 | print_usage(); | 905 | print_usage(); |
937 | printf | 906 | |
938 | ("\nOptions:\n" LONGOPTIONS "\n" DESCRIPTION "\n", | 907 | printf (_(UT_HELP_VRSN)); |
939 | PORT, DEFAULT_SOCKET_TIMEOUT); | 908 | |
940 | support (); | 909 | printf (_(UT_HOST_PORT), 'p', myport); |
910 | |||
911 | printf (_("\ | ||
912 | -v, --variable=STRING\n\ | ||
913 | Variable to check. Valid variables include:\n\ | ||
914 | LOAD1 = 1 minute average CPU load\n\ | ||
915 | LOAD5 = 5 minute average CPU load\n\ | ||
916 | LOAD15 = 15 minute average CPU load\n\ | ||
917 | CSPROCS = number of current service processes (NW 5.x only)\n\ | ||
918 | ABENDS = number of abended threads (NW 5.x only)\n\ | ||
919 | UPTIME = server uptime\n")); | ||
920 | |||
921 | printf (_("\ | ||
922 | LTCH = percent long term cache hits\n\ | ||
923 | CBUFF = current number of cache buffers\n\ | ||
924 | CDBUFF = current number of dirty cache buffers\n\ | ||
925 | DCB = dirty cache buffers as a percentage of the total\n\ | ||
926 | TCB = dirty cache buffers as a percentage of the original\n")); | ||
927 | |||
928 | printf (_("\ | ||
929 | OFILES = number of open files\n\ | ||
930 | VPF<vol> = percent free space on volume <vol>\n\ | ||
931 | VKF<vol> = KB of free space on volume <vol>\n\ | ||
932 | VPP<vol> = percent purgeable space on volume <vol>\n\ | ||
933 | VKP<vol> = KB of purgeable space on volume <vol>\n\ | ||
934 | VPNP<vol> = percent not yet purgeable space on volume <vol>\n\ | ||
935 | VKNP<vol> = KB of not yet purgeable space on volume <vol>\n")); | ||
936 | |||
937 | printf (_("\ | ||
938 | LRUM = LRU sitting time in minutes\n\ | ||
939 | LRUS = LRU sitting time in seconds\n\ | ||
940 | DSDB = check to see if DS Database is open\n\ | ||
941 | DSVER = NDS version\n\ | ||
942 | UPRB = used packet receive buffers\n\ | ||
943 | PUPRB = percent (of max) used packet receive buffers\n\ | ||
944 | SAPENTRIES = number of entries in the SAP table\n\ | ||
945 | SAPENTRIES<n> = number of entries in the SAP table for SAP type <n>\n")); | ||
946 | |||
947 | printf (_("\ | ||
948 | TSYNC = timesync status \n\ | ||
949 | LOGINS = check to see if logins are enabled\n\ | ||
950 | CONNS = number of currently licensed connections\n\ | ||
951 | NLM:<nlm> = check if NLM is loaded and report version\n\ | ||
952 | (e.g. \"NLM:TSANDS.NLM\")\n")); | ||
953 | |||
954 | printf (_("\ | ||
955 | -w, --warning=INTEGER\n\ | ||
956 | Threshold which will result in a warning status\n\ | ||
957 | -c, --critical=INTEGER\n\ | ||
958 | Threshold which will result in a critical status\n\ | ||
959 | -o, --osversion\n\ | ||
960 | Include server version string in results\n")); | ||
961 | |||
962 | printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT); | ||
963 | |||
964 | printf (_("\n\ | ||
965 | Notes:\n\ | ||
966 | - This plugin requres that the MRTGEXT.NLM file from James Drews' MRTG\n\ | ||
967 | extension for NetWare be loaded on the Novell servers you wish to check.\n\ | ||
968 | (available from http://www.engr.wisc.edu/~drews/mrtg/)\n\ | ||
969 | - Values for critical thresholds should be lower than warning thresholds\n\ | ||
970 | when the following variables are checked: VPF, VKF, LTCH, CBUFF, DCB, \n\ | ||
971 | TCB, LRUS and LRUM.\n")); | ||
972 | |||
973 | printf (_(UT_SUPPORT)); | ||
941 | } | 974 | } |