1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
|
--- check_nwstat.c 2005-07-11 23:15:58.000000000 +0100
+++ /home/sully/check_nwstat.c 2005-09-21 11:55:09.000000000 +0100
@@ -163,6 +163,9 @@
temp_buffer = strdup ("15");
break;
}
+
+ close(sd);
+ my_tcp_connect (server_address, server_port, &sd);
asprintf (&send_buffer,"UTIL%s\r\n",temp_buffer);
result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
@@ -195,6 +198,9 @@
/* check number of user connections */
} else if (vars_to_check==CONNS) {
+ close(sd);
+ my_tcp_connect (server_address, server_port, &sd);
+
send_buffer = strdup ("CONNECT\r\n");
result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
if (result!=STATE_OK)
@@ -214,6 +220,9 @@
/* check % long term cache hits */
} else if (vars_to_check==LTCH) {
+ close(sd);
+ my_tcp_connect (server_address, server_port, &sd);
+
send_buffer = strdup ("S1\r\n");
result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
if (result!=STATE_OK)
@@ -233,6 +242,9 @@
/* check cache buffers */
} else if (vars_to_check==CBUFF) {
+ close(sd);
+ my_tcp_connect (server_address, server_port, &sd);
+
send_buffer = strdup ("S2\r\n");
result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
if (result!=STATE_OK)
@@ -252,6 +264,9 @@
/* check dirty cache buffers */
} else if (vars_to_check==CDBUFF) {
+ close(sd);
+ my_tcp_connect (server_address, server_port, &sd);
+
send_buffer = strdup ("S3\r\n");
result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
if (result!=STATE_OK)
@@ -271,6 +286,9 @@
/* check LRU sitting time in minutes */
} else if (vars_to_check==LRUM) {
+ close(sd);
+ my_tcp_connect (server_address, server_port, &sd);
+
send_buffer = strdup ("S5\r\n");
result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
if (result!=STATE_OK)
@@ -291,6 +309,9 @@
/* check KB free space on volume */
} else if (vars_to_check==VKF) {
+ close(sd);
+ my_tcp_connect (server_address, server_port, &sd);
+
asprintf (&send_buffer,"VKF%s\r\n",volume_name);
result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
if (result!=STATE_OK)
@@ -315,6 +336,9 @@
/* check % free space on volume */
} else if (vars_to_check==VPF) {
+ close(sd);
+ my_tcp_connect (server_address, server_port, &sd);
+
asprintf (&send_buffer,"VKF%s\r\n",volume_name);
result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
if (result!=STATE_OK)
@@ -331,7 +355,7 @@
close(sd);
my_tcp_connect (server_address, server_port, &sd);
-
+
asprintf (&send_buffer,"VKS%s\r\n",volume_name);
result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
if (result!=STATE_OK)
@@ -352,6 +376,9 @@
/* check to see if DS Database is open or closed */
} else if (vars_to_check==DSDB) {
+ close(sd);
+ my_tcp_connect (server_address, server_port, &sd);
+
send_buffer = strdup ("S11\r\n");
result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
if (result!=STATE_OK)
@@ -373,6 +400,9 @@
/* check to see if logins are enabled */
} else if (vars_to_check==LOGINS) {
+ close(sd);
+ my_tcp_connect (server_address, server_port, &sd);
+
send_buffer = strdup ("S12\r\n");
result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
if (result!=STATE_OK)
@@ -386,7 +416,10 @@
/* check packet receive buffers */
} else if (vars_to_check==UPRB || vars_to_check==PUPRB) {
-
+
+ close(sd);
+ my_tcp_connect (server_address, server_port, &sd);
+
asprintf (&send_buffer,"S15\r\n");
result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
if (result!=STATE_OK)
@@ -394,6 +427,9 @@
used_packet_receive_buffers=atoi(recv_buffer);
+ close(sd);
+ my_tcp_connect (server_address, server_port, &sd);
+
asprintf (&send_buffer,"S16\r\n");
result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
if (result!=STATE_OK)
@@ -420,6 +456,9 @@
/* check SAP table entries */
} else if (vars_to_check==SAPENTRIES) {
+ close(sd);
+ my_tcp_connect (server_address, server_port, &sd);
+
if (sap_number==-1)
asprintf (&send_buffer,"S9\r\n");
else
@@ -443,6 +482,9 @@
/* check KB purgeable space on volume */
} else if (vars_to_check==VKP) {
+ close(sd);
+ my_tcp_connect (server_address, server_port, &sd);
+
asprintf (&send_buffer,"VKP%s\r\n",volume_name);
result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
if (result!=STATE_OK)
@@ -463,6 +505,9 @@
/* check % purgeable space on volume */
} else if (vars_to_check==VPP) {
+ close(sd);
+ my_tcp_connect (server_address, server_port, &sd);
+
asprintf (&send_buffer,"VKP%s\r\n",volume_name);
result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
if (result!=STATE_OK)
@@ -477,6 +522,9 @@
purgeable_disk_space=strtoul(recv_buffer,NULL,10);
+ close(sd);
+ my_tcp_connect (server_address, server_port, &sd);
+
asprintf (&send_buffer,"VKS%s\r\n",volume_name);
result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
if (result!=STATE_OK)
@@ -496,6 +544,9 @@
/* check KB not yet purgeable space on volume */
} else if (vars_to_check==VKNP) {
+ close(sd);
+ my_tcp_connect (server_address, server_port, &sd);
+
asprintf (&send_buffer,"VKNP%s\r\n",volume_name);
result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
if (result!=STATE_OK)
@@ -516,6 +567,9 @@
/* check % not yet purgeable space on volume */
} else if (vars_to_check==VPNP) {
+ close(sd);
+ my_tcp_connect (server_address, server_port, &sd);
+
asprintf (&send_buffer,"VKNP%s\r\n",volume_name);
result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
if (result!=STATE_OK)
@@ -530,6 +584,9 @@
non_purgeable_disk_space=strtoul(recv_buffer,NULL,10);
+ close(sd);
+ my_tcp_connect (server_address, server_port, &sd);
+
asprintf (&send_buffer,"VKS%s\r\n",volume_name);
result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
if (result!=STATE_OK)
@@ -549,6 +606,9 @@
/* check # of open files */
} else if (vars_to_check==OFILES) {
+ close(sd);
+ my_tcp_connect (server_address, server_port, &sd);
+
asprintf (&send_buffer,"S18\r\n");
result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
if (result!=STATE_OK)
@@ -566,6 +626,9 @@
/* check # of abended threads (Netware 5.x only) */
} else if (vars_to_check==ABENDS) {
+ close(sd);
+ my_tcp_connect (server_address, server_port, &sd);
+
asprintf (&send_buffer,"S17\r\n");
result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
if (result!=STATE_OK)
@@ -583,6 +646,9 @@
/* check # of current service processes (Netware 5.x only) */
} else if (vars_to_check==CSPROCS) {
+ close(sd);
+ my_tcp_connect (server_address, server_port, &sd);
+
asprintf (&send_buffer,"S20\r\n");
result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
if (result!=STATE_OK)
@@ -613,6 +679,9 @@
/* check # Timesync Status */
} else if (vars_to_check==TSYNC) {
+ close(sd);
+ my_tcp_connect (server_address, server_port, &sd);
+
asprintf (&send_buffer,"S22\r\n");
result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
if (result!=STATE_OK)
@@ -631,6 +700,9 @@
/* check LRU sitting time in secondss */
} else if (vars_to_check==LRUS) {
+ close(sd);
+ my_tcp_connect (server_address, server_port, &sd);
+
send_buffer = strdup ("S4\r\n");
result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
if (result!=STATE_OK)
@@ -647,6 +719,9 @@
/* check % dirty cacheobuffers as a percentage of the total*/
} else if (vars_to_check==DCB) {
+ close(sd);
+ my_tcp_connect (server_address, server_port, &sd);
+
send_buffer = strdup ("S6\r\n");
result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
if (result!=STATE_OK)
@@ -662,6 +737,9 @@
/* check % total cache buffers as a percentage of the original*/
} else if (vars_to_check==TCB) {
+ close(sd);
+ my_tcp_connect (server_address, server_port, &sd);
+
send_buffer = strdup ("S7\r\n");
result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
if (result!=STATE_OK)
@@ -675,6 +753,10 @@
asprintf (&output_message,_("Total cache buffers = %lu%% of the original"),total_cache_buffers);
} else if (vars_to_check==DSVER) {
+
+ close(sd);
+ my_tcp_connect (server_address, server_port, &sd);
+
asprintf (&send_buffer,"S13\r\n");
result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
if (result!=STATE_OK)
@@ -685,6 +767,10 @@
asprintf (&output_message,_("NDS Version %s"),recv_buffer);
} else if (vars_to_check==UPTIME) {
+
+ close(sd);
+ my_tcp_connect (server_address, server_port, &sd);
+
asprintf (&send_buffer,"UPTIME\r\n");
result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
if (result!=STATE_OK)
@@ -697,6 +783,10 @@
asprintf (&output_message,_("Up %s"),recv_buffer);
} else if (vars_to_check==NLM) {
+
+ close(sd);
+ my_tcp_connect (server_address, server_port, &sd);
+
asprintf (&send_buffer,"S24:%s\r\n",nlm_name);
result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
if (result!=STATE_OK)
|