summaryrefslogtreecommitdiffstats
path: root/plugins/check_nwstat.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/check_nwstat.c')
-rw-r--r--plugins/check_nwstat.c92
1 files changed, 91 insertions, 1 deletions
diff --git a/plugins/check_nwstat.c b/plugins/check_nwstat.c
index 9f17a7d..6465dae 100644
--- a/plugins/check_nwstat.c
+++ b/plugins/check_nwstat.c
@@ -164,6 +164,9 @@ main(int argc, char **argv) {
164 break; 164 break;
165 } 165 }
166 166
167 close(sd);
168 my_tcp_connect (server_address, server_port, &sd);
169
167 asprintf (&send_buffer,"UTIL%s\r\n",temp_buffer); 170 asprintf (&send_buffer,"UTIL%s\r\n",temp_buffer);
168 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); 171 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
169 if (result!=STATE_OK) 172 if (result!=STATE_OK)
@@ -195,6 +198,9 @@ main(int argc, char **argv) {
195 /* check number of user connections */ 198 /* check number of user connections */
196 } else if (vars_to_check==CONNS) { 199 } else if (vars_to_check==CONNS) {
197 200
201 close(sd);
202 my_tcp_connect (server_address, server_port, &sd);
203
198 send_buffer = strdup ("CONNECT\r\n"); 204 send_buffer = strdup ("CONNECT\r\n");
199 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); 205 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
200 if (result!=STATE_OK) 206 if (result!=STATE_OK)
@@ -214,6 +220,9 @@ main(int argc, char **argv) {
214 /* check % long term cache hits */ 220 /* check % long term cache hits */
215 } else if (vars_to_check==LTCH) { 221 } else if (vars_to_check==LTCH) {
216 222
223 close(sd);
224 my_tcp_connect (server_address, server_port, &sd);
225
217 send_buffer = strdup ("S1\r\n"); 226 send_buffer = strdup ("S1\r\n");
218 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); 227 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
219 if (result!=STATE_OK) 228 if (result!=STATE_OK)
@@ -233,6 +242,9 @@ main(int argc, char **argv) {
233 /* check cache buffers */ 242 /* check cache buffers */
234 } else if (vars_to_check==CBUFF) { 243 } else if (vars_to_check==CBUFF) {
235 244
245 close(sd);
246 my_tcp_connect (server_address, server_port, &sd);
247
236 send_buffer = strdup ("S2\r\n"); 248 send_buffer = strdup ("S2\r\n");
237 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); 249 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
238 if (result!=STATE_OK) 250 if (result!=STATE_OK)
@@ -252,6 +264,9 @@ main(int argc, char **argv) {
252 /* check dirty cache buffers */ 264 /* check dirty cache buffers */
253 } else if (vars_to_check==CDBUFF) { 265 } else if (vars_to_check==CDBUFF) {
254 266
267 close(sd);
268 my_tcp_connect (server_address, server_port, &sd);
269
255 send_buffer = strdup ("S3\r\n"); 270 send_buffer = strdup ("S3\r\n");
256 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); 271 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
257 if (result!=STATE_OK) 272 if (result!=STATE_OK)
@@ -271,6 +286,9 @@ main(int argc, char **argv) {
271 /* check LRU sitting time in minutes */ 286 /* check LRU sitting time in minutes */
272 } else if (vars_to_check==LRUM) { 287 } else if (vars_to_check==LRUM) {
273 288
289 close(sd);
290 my_tcp_connect (server_address, server_port, &sd);
291
274 send_buffer = strdup ("S5\r\n"); 292 send_buffer = strdup ("S5\r\n");
275 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); 293 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
276 if (result!=STATE_OK) 294 if (result!=STATE_OK)
@@ -291,6 +309,9 @@ main(int argc, char **argv) {
291 /* check KB free space on volume */ 309 /* check KB free space on volume */
292 } else if (vars_to_check==VKF) { 310 } else if (vars_to_check==VKF) {
293 311
312 close(sd);
313 my_tcp_connect (server_address, server_port, &sd);
314
294 asprintf (&send_buffer,"VKF%s\r\n",volume_name); 315 asprintf (&send_buffer,"VKF%s\r\n",volume_name);
295 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); 316 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
296 if (result!=STATE_OK) 317 if (result!=STATE_OK)
@@ -315,6 +336,9 @@ main(int argc, char **argv) {
315 /* check % free space on volume */ 336 /* check % free space on volume */
316 } else if (vars_to_check==VPF) { 337 } else if (vars_to_check==VPF) {
317 338
339 close(sd);
340 my_tcp_connect (server_address, server_port, &sd);
341
318 asprintf (&send_buffer,"VKF%s\r\n",volume_name); 342 asprintf (&send_buffer,"VKF%s\r\n",volume_name);
319 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); 343 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
320 if (result!=STATE_OK) 344 if (result!=STATE_OK)
@@ -352,6 +376,9 @@ main(int argc, char **argv) {
352 /* check to see if DS Database is open or closed */ 376 /* check to see if DS Database is open or closed */
353 } else if (vars_to_check==DSDB) { 377 } else if (vars_to_check==DSDB) {
354 378
379 close(sd);
380 my_tcp_connect (server_address, server_port, &sd);
381
355 send_buffer = strdup ("S11\r\n"); 382 send_buffer = strdup ("S11\r\n");
356 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); 383 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
357 if (result!=STATE_OK) 384 if (result!=STATE_OK)
@@ -373,6 +400,9 @@ main(int argc, char **argv) {
373 /* check to see if logins are enabled */ 400 /* check to see if logins are enabled */
374 } else if (vars_to_check==LOGINS) { 401 } else if (vars_to_check==LOGINS) {
375 402
403 close(sd);
404 my_tcp_connect (server_address, server_port, &sd);
405
376 send_buffer = strdup ("S12\r\n"); 406 send_buffer = strdup ("S12\r\n");
377 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); 407 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
378 if (result!=STATE_OK) 408 if (result!=STATE_OK)
@@ -386,7 +416,10 @@ main(int argc, char **argv) {
386 416
387 /* check packet receive buffers */ 417 /* check packet receive buffers */
388 } else if (vars_to_check==UPRB || vars_to_check==PUPRB) { 418 } else if (vars_to_check==UPRB || vars_to_check==PUPRB) {
389 419
420 close(sd);
421 my_tcp_connect (server_address, server_port, &sd);
422
390 asprintf (&send_buffer,"S15\r\n"); 423 asprintf (&send_buffer,"S15\r\n");
391 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); 424 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
392 if (result!=STATE_OK) 425 if (result!=STATE_OK)
@@ -394,6 +427,9 @@ main(int argc, char **argv) {
394 427
395 used_packet_receive_buffers=atoi(recv_buffer); 428 used_packet_receive_buffers=atoi(recv_buffer);
396 429
430 close(sd);
431 my_tcp_connect (server_address, server_port, &sd);
432
397 asprintf (&send_buffer,"S16\r\n"); 433 asprintf (&send_buffer,"S16\r\n");
398 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); 434 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
399 if (result!=STATE_OK) 435 if (result!=STATE_OK)
@@ -420,6 +456,9 @@ main(int argc, char **argv) {
420 /* check SAP table entries */ 456 /* check SAP table entries */
421 } else if (vars_to_check==SAPENTRIES) { 457 } else if (vars_to_check==SAPENTRIES) {
422 458
459 close(sd);
460 my_tcp_connect (server_address, server_port, &sd);
461
423 if (sap_number==-1) 462 if (sap_number==-1)
424 asprintf (&send_buffer,"S9\r\n"); 463 asprintf (&send_buffer,"S9\r\n");
425 else 464 else
@@ -443,6 +482,9 @@ main(int argc, char **argv) {
443 /* check KB purgeable space on volume */ 482 /* check KB purgeable space on volume */
444 } else if (vars_to_check==VKP) { 483 } else if (vars_to_check==VKP) {
445 484
485 close(sd);
486 my_tcp_connect (server_address, server_port, &sd);
487
446 asprintf (&send_buffer,"VKP%s\r\n",volume_name); 488 asprintf (&send_buffer,"VKP%s\r\n",volume_name);
447 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); 489 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
448 if (result!=STATE_OK) 490 if (result!=STATE_OK)
@@ -463,6 +505,9 @@ main(int argc, char **argv) {
463 /* check % purgeable space on volume */ 505 /* check % purgeable space on volume */
464 } else if (vars_to_check==VPP) { 506 } else if (vars_to_check==VPP) {
465 507
508 close(sd);
509 my_tcp_connect (server_address, server_port, &sd);
510
466 asprintf (&send_buffer,"VKP%s\r\n",volume_name); 511 asprintf (&send_buffer,"VKP%s\r\n",volume_name);
467 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); 512 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
468 if (result!=STATE_OK) 513 if (result!=STATE_OK)
@@ -477,6 +522,9 @@ main(int argc, char **argv) {
477 522
478 purgeable_disk_space=strtoul(recv_buffer,NULL,10); 523 purgeable_disk_space=strtoul(recv_buffer,NULL,10);
479 524
525 close(sd);
526 my_tcp_connect (server_address, server_port, &sd);
527
480 asprintf (&send_buffer,"VKS%s\r\n",volume_name); 528 asprintf (&send_buffer,"VKS%s\r\n",volume_name);
481 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); 529 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
482 if (result!=STATE_OK) 530 if (result!=STATE_OK)
@@ -496,6 +544,9 @@ main(int argc, char **argv) {
496 /* check KB not yet purgeable space on volume */ 544 /* check KB not yet purgeable space on volume */
497 } else if (vars_to_check==VKNP) { 545 } else if (vars_to_check==VKNP) {
498 546
547 close(sd);
548 my_tcp_connect (server_address, server_port, &sd);
549
499 asprintf (&send_buffer,"VKNP%s\r\n",volume_name); 550 asprintf (&send_buffer,"VKNP%s\r\n",volume_name);
500 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); 551 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
501 if (result!=STATE_OK) 552 if (result!=STATE_OK)
@@ -516,6 +567,9 @@ main(int argc, char **argv) {
516 /* check % not yet purgeable space on volume */ 567 /* check % not yet purgeable space on volume */
517 } else if (vars_to_check==VPNP) { 568 } else if (vars_to_check==VPNP) {
518 569
570 close(sd);
571 my_tcp_connect (server_address, server_port, &sd);
572
519 asprintf (&send_buffer,"VKNP%s\r\n",volume_name); 573 asprintf (&send_buffer,"VKNP%s\r\n",volume_name);
520 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); 574 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
521 if (result!=STATE_OK) 575 if (result!=STATE_OK)
@@ -530,6 +584,9 @@ main(int argc, char **argv) {
530 584
531 non_purgeable_disk_space=strtoul(recv_buffer,NULL,10); 585 non_purgeable_disk_space=strtoul(recv_buffer,NULL,10);
532 586
587 close(sd);
588 my_tcp_connect (server_address, server_port, &sd);
589
533 asprintf (&send_buffer,"VKS%s\r\n",volume_name); 590 asprintf (&send_buffer,"VKS%s\r\n",volume_name);
534 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); 591 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
535 if (result!=STATE_OK) 592 if (result!=STATE_OK)
@@ -549,6 +606,9 @@ main(int argc, char **argv) {
549 /* check # of open files */ 606 /* check # of open files */
550 } else if (vars_to_check==OFILES) { 607 } else if (vars_to_check==OFILES) {
551 608
609 close(sd);
610 my_tcp_connect (server_address, server_port, &sd);
611
552 asprintf (&send_buffer,"S18\r\n"); 612 asprintf (&send_buffer,"S18\r\n");
553 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); 613 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
554 if (result!=STATE_OK) 614 if (result!=STATE_OK)
@@ -566,6 +626,9 @@ main(int argc, char **argv) {
566 /* check # of abended threads (Netware 5.x only) */ 626 /* check # of abended threads (Netware 5.x only) */
567 } else if (vars_to_check==ABENDS) { 627 } else if (vars_to_check==ABENDS) {
568 628
629 close(sd);
630 my_tcp_connect (server_address, server_port, &sd);
631
569 asprintf (&send_buffer,"S17\r\n"); 632 asprintf (&send_buffer,"S17\r\n");
570 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); 633 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
571 if (result!=STATE_OK) 634 if (result!=STATE_OK)
@@ -583,6 +646,9 @@ main(int argc, char **argv) {
583 /* check # of current service processes (Netware 5.x only) */ 646 /* check # of current service processes (Netware 5.x only) */
584 } else if (vars_to_check==CSPROCS) { 647 } else if (vars_to_check==CSPROCS) {
585 648
649 close(sd);
650 my_tcp_connect (server_address, server_port, &sd);
651
586 asprintf (&send_buffer,"S20\r\n"); 652 asprintf (&send_buffer,"S20\r\n");
587 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); 653 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
588 if (result!=STATE_OK) 654 if (result!=STATE_OK)
@@ -613,6 +679,9 @@ main(int argc, char **argv) {
613 /* check # Timesync Status */ 679 /* check # Timesync Status */
614 } else if (vars_to_check==TSYNC) { 680 } else if (vars_to_check==TSYNC) {
615 681
682 close(sd);
683 my_tcp_connect (server_address, server_port, &sd);
684
616 asprintf (&send_buffer,"S22\r\n"); 685 asprintf (&send_buffer,"S22\r\n");
617 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); 686 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
618 if (result!=STATE_OK) 687 if (result!=STATE_OK)
@@ -631,6 +700,9 @@ main(int argc, char **argv) {
631 /* check LRU sitting time in secondss */ 700 /* check LRU sitting time in secondss */
632 } else if (vars_to_check==LRUS) { 701 } else if (vars_to_check==LRUS) {
633 702
703 close(sd);
704 my_tcp_connect (server_address, server_port, &sd);
705
634 send_buffer = strdup ("S4\r\n"); 706 send_buffer = strdup ("S4\r\n");
635 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); 707 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
636 if (result!=STATE_OK) 708 if (result!=STATE_OK)
@@ -647,6 +719,9 @@ main(int argc, char **argv) {
647 /* check % dirty cacheobuffers as a percentage of the total*/ 719 /* check % dirty cacheobuffers as a percentage of the total*/
648 } else if (vars_to_check==DCB) { 720 } else if (vars_to_check==DCB) {
649 721
722 close(sd);
723 my_tcp_connect (server_address, server_port, &sd);
724
650 send_buffer = strdup ("S6\r\n"); 725 send_buffer = strdup ("S6\r\n");
651 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); 726 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
652 if (result!=STATE_OK) 727 if (result!=STATE_OK)
@@ -662,6 +737,9 @@ main(int argc, char **argv) {
662 /* check % total cache buffers as a percentage of the original*/ 737 /* check % total cache buffers as a percentage of the original*/
663 } else if (vars_to_check==TCB) { 738 } else if (vars_to_check==TCB) {
664 739
740 close(sd);
741 my_tcp_connect (server_address, server_port, &sd);
742
665 send_buffer = strdup ("S7\r\n"); 743 send_buffer = strdup ("S7\r\n");
666 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); 744 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
667 if (result!=STATE_OK) 745 if (result!=STATE_OK)
@@ -675,6 +753,10 @@ main(int argc, char **argv) {
675 asprintf (&output_message,_("Total cache buffers = %lu%% of the original"),total_cache_buffers); 753 asprintf (&output_message,_("Total cache buffers = %lu%% of the original"),total_cache_buffers);
676 754
677 } else if (vars_to_check==DSVER) { 755 } else if (vars_to_check==DSVER) {
756
757 close(sd);
758 my_tcp_connect (server_address, server_port, &sd);
759
678 asprintf (&send_buffer,"S13\r\n"); 760 asprintf (&send_buffer,"S13\r\n");
679 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); 761 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
680 if (result!=STATE_OK) 762 if (result!=STATE_OK)
@@ -685,6 +767,10 @@ main(int argc, char **argv) {
685 asprintf (&output_message,_("NDS Version %s"),recv_buffer); 767 asprintf (&output_message,_("NDS Version %s"),recv_buffer);
686 768
687 } else if (vars_to_check==UPTIME) { 769 } else if (vars_to_check==UPTIME) {
770
771 close(sd);
772 my_tcp_connect (server_address, server_port, &sd);
773
688 asprintf (&send_buffer,"UPTIME\r\n"); 774 asprintf (&send_buffer,"UPTIME\r\n");
689 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); 775 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
690 if (result!=STATE_OK) 776 if (result!=STATE_OK)
@@ -697,6 +783,10 @@ main(int argc, char **argv) {
697 asprintf (&output_message,_("Up %s"),recv_buffer); 783 asprintf (&output_message,_("Up %s"),recv_buffer);
698 784
699 } else if (vars_to_check==NLM) { 785 } else if (vars_to_check==NLM) {
786
787 close(sd);
788 my_tcp_connect (server_address, server_port, &sd);
789
700 asprintf (&send_buffer,"S24:%s\r\n",nlm_name); 790 asprintf (&send_buffer,"S24:%s\r\n",nlm_name);
701 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); 791 result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
702 if (result!=STATE_OK) 792 if (result!=STATE_OK)