summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/check_nwstat.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/plugins/check_nwstat.c b/plugins/check_nwstat.c
index 723cf33..5dbde9c 100644
--- a/plugins/check_nwstat.c
+++ b/plugins/check_nwstat.c
@@ -69,6 +69,7 @@ to gather the requested system information.\n"
69 DCB = dirty cache buffers as a percentage of the total\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\ 70 TCB = dirty cache buffers as a percentage of the original\n\
71 UPTIME = server uptime\n\ 71 UPTIME = server uptime\n\
72 NLM:<nlm> = check if NLM is loaded and report version (e.g. \"NLM:TSANDS.NLM\")\n\
72-w, --warning=INTEGER\n\ 73-w, --warning=INTEGER\n\
73 Threshold which will result in a warning status\n\ 74 Threshold which will result in a warning status\n\
74-c, --critical=INTEGER\n\ 75-c, --critical=INTEGER\n\
@@ -127,11 +128,13 @@ Notes:\n\
127#define CHECK_TCB 26 /* check total cache buffers as a percentage of the original */ 128#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_DSVER 27 /* check NDS version */
129#define CHECK_UPTIME 28 /* check server uptime */ 130#define CHECK_UPTIME 28 /* check server uptime */
131#define CHECK_NLM 29 /* check NLM loaded */
130 132
131#define PORT 9999 133#define PORT 9999
132 134
133char *server_address=NULL; 135char *server_address=NULL;
134char *volume_name=NULL; 136char *volume_name=NULL;
137char *nlm_name=NULL;
135int server_port=PORT; 138int server_port=PORT;
136unsigned long warning_value=0L; 139unsigned long warning_value=0L;
137unsigned long critical_value=0L; 140unsigned long critical_value=0L;
@@ -702,6 +705,20 @@ int main(int argc, char **argv){
702 705
703 asprintf(&output_message,"Up %s",recv_buffer); 706 asprintf(&output_message,"Up %s",recv_buffer);
704 707
708 } else if (vars_to_check==CHECK_NLM) {
709 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));
711 if(result!=STATE_OK)
712 return result;
713
714 recv_buffer[strlen(recv_buffer)-1]=0;
715 if(strcmp(recv_buffer,"-1")) {
716 asprintf(&output_message,"Module %s version %s is loaded",nlm_name,recv_buffer);
717 } else {
718 result=STATE_CRITICAL;
719 asprintf(&output_message,"Module %s is not loaded",nlm_name);
720 }
721
705 } else { 722 } else {
706 723
707 output_message = strscpy(output_message,"Nothing to check!\n"); 724 output_message = strscpy(output_message,"Nothing to check!\n");
@@ -875,6 +892,10 @@ int process_arguments(int argc, char **argv){
875 vars_to_check=CHECK_DSVER; 892 vars_to_check=CHECK_DSVER;
876 else if(!strcmp(optarg,"UPTIME")) 893 else if(!strcmp(optarg,"UPTIME"))
877 vars_to_check=CHECK_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 }
878 else 899 else
879 return ERROR; 900 return ERROR;
880 break; 901 break;