summaryrefslogtreecommitdiffstats
path: root/plugins/check_nwstat.c
diff options
context:
space:
mode:
authorTon Voon <tonvoon@users.sourceforge.net>2003-06-29 02:18:28 +0000
committerTon Voon <tonvoon@users.sourceforge.net>2003-06-29 02:18:28 +0000
commitcb448eb1d57259641e10494e8d74d885e44c215d (patch)
treefbcf6ab1dd488787f5d3541c6376c21db6d2e587 /plugins/check_nwstat.c
parent12cf5ee9f6204be272aef2b0f58b76fc43d5f394 (diff)
downloadmonitoring-plugins-cb448eb1d57259641e10494e8d74d885e44c215d.tar.gz
Added NLM test (Phil Randal)
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@567 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins/check_nwstat.c')
-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 723cf33b..5dbde9ce 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;