summaryrefslogtreecommitdiffstats
path: root/plugins/check_nwstat.c
diff options
context:
space:
mode:
authorTon Voon <tonvoon@users.sourceforge.net>2003-05-14 21:51:10 (GMT)
committerTon Voon <tonvoon@users.sourceforge.net>2003-05-14 21:51:10 (GMT)
commitfa062777af44f473d314b0064de7ace9abffe040 (patch)
treeb1307e7e685bfa935617e8e4bba0693a547922fd /plugins/check_nwstat.c
parentd84e5226245e08badcdf8787cdacfe5f0ef66e60 (diff)
downloadmonitoring-plugins-fa062777af44f473d314b0064de7ace9abffe040.tar.gz
Added DSVER and UPTIME checks (Phil Randal - 737617)
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@512 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins/check_nwstat.c')
-rw-r--r--plugins/check_nwstat.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/plugins/check_nwstat.c b/plugins/check_nwstat.c
index 17459f8..723cf33 100644
--- a/plugins/check_nwstat.c
+++ b/plugins/check_nwstat.c
@@ -51,6 +51,7 @@ to gather the requested system information.\n"
51 CDBUFF = current number of dirty cache buffers\n\ 51 CDBUFF = current number of dirty cache buffers\n\
52 LRUM = LRU sitting time in minutes\n\ 52 LRUM = LRU sitting time in minutes\n\
53 DSDB = check to see if DS Database is open\n\ 53 DSDB = check to see if DS Database is open\n\
54 DSVER = NDS version\n\
54 LOGINS = check to see if logins are enabled\n\ 55 LOGINS = check to see if logins are enabled\n\
55 UPRB = used packet receive buffers\n\ 56 UPRB = used packet receive buffers\n\
56 PUPRB = percent (of max) used packet receive buffers\n\ 57 PUPRB = percent (of max) used packet receive buffers\n\
@@ -67,6 +68,7 @@ to gather the requested system information.\n"
67 LRUS = LRU sitting time in seconds\n\ 68 LRUS = LRU sitting time in seconds\n\
68 DCB = dirty cache buffers as a percentage of the total\n\ 69 DCB = dirty cache buffers as a percentage of the total\n\
69 TCB = dirty cache buffers as a percentage of the original\n\ 70 TCB = dirty cache buffers as a percentage of the original\n\
71 UPTIME = server uptime\n\
70-w, --warning=INTEGER\n\ 72-w, --warning=INTEGER\n\
71 Threshold which will result in a warning status\n\ 73 Threshold which will result in a warning status\n\
72-c, --critical=INTEGER\n\ 74-c, --critical=INTEGER\n\
@@ -123,6 +125,8 @@ Notes:\n\
123#define CHECK_LRUS 24 /* check LRU sitting time in seconds */ 125#define CHECK_LRUS 24 /* check LRU sitting time in seconds */
124#define CHECK_DCB 25 /* check dirty cache buffers as a percentage of the total */ 126#define CHECK_DCB 25 /* check dirty cache buffers as a percentage of the total */
125#define CHECK_TCB 26 /* check total cache buffers as a percentage of the original */ 127#define CHECK_TCB 26 /* check total cache buffers as a percentage of the original */
128#define CHECK_DSVER 27 /* check NDS version */
129#define CHECK_UPTIME 28 /* check server uptime */
126 130
127#define PORT 9999 131#define PORT 9999
128 132
@@ -664,7 +668,7 @@ int main(int argc, char **argv){
664 asprintf(&output_message,"dirty cache buffers = %d%% of the total",dirty_cache_buffers); 668 asprintf(&output_message,"dirty cache buffers = %d%% of the total",dirty_cache_buffers);
665 669
666 /* check % total cache buffers as a percentage of the original*/ 670 /* check % total cache buffers as a percentage of the original*/
667 } else if (vars_to_check==CHECK_TCB) { 671 } else if (vars_to_check==CHECK_TCB) {
668 672
669 send_buffer = strscpy(send_buffer,"S7\r\n"); 673 send_buffer = strscpy(send_buffer,"S7\r\n");
670 result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); 674 result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer));
@@ -678,6 +682,26 @@ int main(int argc, char **argv){
678 result=STATE_WARNING; 682 result=STATE_WARNING;
679 asprintf(&output_message,"total cache buffers = %d%% of the original",total_cache_buffers); 683 asprintf(&output_message,"total cache buffers = %d%% of the original",total_cache_buffers);
680 684
685 } else if (vars_to_check==CHECK_DSVER) {
686 asprintf(&send_buffer,"S13\r\n");
687 result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer));
688 if(result!=STATE_OK)
689 return result;
690
691 recv_buffer[strlen(recv_buffer)-1]=0;
692
693 asprintf(&output_message,"NDS Version %s",recv_buffer);
694
695 } else if (vars_to_check==CHECK_UPTIME) {
696 asprintf(&send_buffer,"UPTIME\r\n");
697 result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer));
698 if(result!=STATE_OK)
699 return result;
700
701 recv_buffer[strlen(recv_buffer)-1]=0;
702
703 asprintf(&output_message,"Up %s",recv_buffer);
704
681 } else { 705 } else {
682 706
683 output_message = strscpy(output_message,"Nothing to check!\n"); 707 output_message = strscpy(output_message,"Nothing to check!\n");
@@ -847,6 +871,10 @@ int process_arguments(int argc, char **argv){
847 vars_to_check=CHECK_CSPROCS; 871 vars_to_check=CHECK_CSPROCS;
848 else if(!strcmp(optarg,"TSYNC")) 872 else if(!strcmp(optarg,"TSYNC"))
849 vars_to_check=CHECK_TSYNC; 873 vars_to_check=CHECK_TSYNC;
874 else if(!strcmp(optarg,"DSVER"))
875 vars_to_check=CHECK_DSVER;
876 else if(!strcmp(optarg,"UPTIME"))
877 vars_to_check=CHECK_UPTIME;
850 else 878 else
851 return ERROR; 879 return ERROR;
852 break; 880 break;