diff options
| author | Ton Voon <tonvoon@users.sourceforge.net> | 2003-04-08 20:49:03 +0000 |
|---|---|---|
| committer | Ton Voon <tonvoon@users.sourceforge.net> | 2003-04-08 20:49:03 +0000 |
| commit | a4d8fd9bf597262e1e734c10b2f3222532704d85 (patch) | |
| tree | dba13f62ff544364565ac7e24408e86016dd3073 | |
| parent | e7793eb31b7e81c05618a1b6648cad036bfde453 (diff) | |
| download | monitoring-plugins-a4d8fd9bf597262e1e734c10b2f3222532704d85.tar.gz | |
Changed // to /* */ comments as some compilers do not like them
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/branches/release-1.3.0@480 f882894a-f735-0410-b71e-b25c423dba1c
| -rw-r--r-- | plugins/check_hpjd.c | 4 | ||||
| -rw-r--r-- | plugins/check_nt.c | 33 |
2 files changed, 18 insertions, 19 deletions
diff --git a/plugins/check_hpjd.c b/plugins/check_hpjd.c index 267de2e0..291a1f17 100644 --- a/plugins/check_hpjd.c +++ b/plugins/check_hpjd.c | |||
| @@ -525,10 +525,10 @@ print_usage (void) | |||
| 525 | return STATE_UNKNOWN; | 525 | return STATE_UNKNOWN; |
| 526 | } | 526 | } |
| 527 | 527 | ||
| 528 | // get the IP address of the JetDirect device | 528 | /* get the IP address of the JetDirect device */ |
| 529 | strcpy(address,argv[1]); | 529 | strcpy(address,argv[1]); |
| 530 | 530 | ||
| 531 | // get the community name to use for SNMP communication | 531 | /* get the community name to use for SNMP communication */ |
| 532 | if(argc>=3) | 532 | if(argc>=3) |
| 533 | strcpy(community,argv[2]); | 533 | strcpy(community,argv[2]); |
| 534 | else | 534 | else |
diff --git a/plugins/check_nt.c b/plugins/check_nt.c index a2885a62..cc529298 100644 --- a/plugins/check_nt.c +++ b/plugins/check_nt.c | |||
| @@ -28,7 +28,6 @@ | |||
| 28 | * | 28 | * |
| 29 | *****************************************************************************/ | 29 | *****************************************************************************/ |
| 30 | 30 | ||
| 31 | //#include "stdlib.h" | ||
| 32 | #include "config.h" | 31 | #include "config.h" |
| 33 | #include "common.h" | 32 | #include "common.h" |
| 34 | #include "netutils.h" | 33 | #include "netutils.h" |
| @@ -121,15 +120,15 @@ int main(int argc, char **argv){ | |||
| 121 | 120 | ||
| 122 | if (check_value_list==TRUE) { | 121 | if (check_value_list==TRUE) { |
| 123 | if (strtolarray(&lvalue_list,value_list,",")==TRUE) { | 122 | if (strtolarray(&lvalue_list,value_list,",")==TRUE) { |
| 124 | // -l parameters is present with only integers | 123 | /* -l parameters is present with only integers */ |
| 125 | return_code=STATE_OK; | 124 | return_code=STATE_OK; |
| 126 | asprintf(&temp_string,"CPU Load"); | 125 | asprintf(&temp_string,"CPU Load"); |
| 127 | while (lvalue_list[0+offset]>0 && lvalue_list[0+offset]<=17280 && | 126 | while (lvalue_list[0+offset]>0 && lvalue_list[0+offset]<=17280 && |
| 128 | lvalue_list[1+offset]>=0 && lvalue_list[1+offset]<=100 && | 127 | lvalue_list[1+offset]>=0 && lvalue_list[1+offset]<=100 && |
| 129 | lvalue_list[2+offset]>=0 && lvalue_list[2+offset]<=100) { | 128 | lvalue_list[2+offset]>=0 && lvalue_list[2+offset]<=100) { |
| 130 | // loop until one of the parameters is wrong or not present | 129 | /* loop until one of the parameters is wrong or not present */ |
| 131 | 130 | ||
| 132 | // Send request and retrieve data | 131 | /* Send request and retrieve data */ |
| 133 | asprintf(&send_buffer,"%s&2&%lu",req_password,lvalue_list[0+offset]); | 132 | asprintf(&send_buffer,"%s&2&%lu",req_password,lvalue_list[0+offset]); |
| 134 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); | 133 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); |
| 135 | if(result!=STATE_OK) | 134 | if(result!=STATE_OK) |
| @@ -142,7 +141,7 @@ int main(int argc, char **argv){ | |||
| 142 | 141 | ||
| 143 | utilization=strtoul(recv_buffer,NULL,10); | 142 | utilization=strtoul(recv_buffer,NULL,10); |
| 144 | 143 | ||
| 145 | // Check if any of the request is in a warning or critical state | 144 | /* Check if any of the request is in a warning or critical state */ |
| 146 | if(utilization >= lvalue_list[2+offset]) | 145 | if(utilization >= lvalue_list[2+offset]) |
| 147 | return_code=STATE_CRITICAL; | 146 | return_code=STATE_CRITICAL; |
| 148 | else if(utilization >= lvalue_list[1+offset] && return_code<STATE_WARNING) | 147 | else if(utilization >= lvalue_list[1+offset] && return_code<STATE_WARNING) |
| @@ -150,10 +149,10 @@ int main(int argc, char **argv){ | |||
| 150 | 149 | ||
| 151 | asprintf(&output_message," %lu%% (%lu min average)", utilization, lvalue_list[0+offset]); | 150 | asprintf(&output_message," %lu%% (%lu min average)", utilization, lvalue_list[0+offset]); |
| 152 | asprintf(&temp_string,"%s%s",temp_string,output_message); | 151 | asprintf(&temp_string,"%s%s",temp_string,output_message); |
| 153 | offset+=3; //move across the array | 152 | offset+=3; /* move across the array */ |
| 154 | } | 153 | } |
| 155 | if (strlen(temp_string)>10) { | 154 | if (strlen(temp_string)>10) { |
| 156 | // we had at least on loop | 155 | /* we had at least on loop */ |
| 157 | asprintf(&output_message,"%s",temp_string); | 156 | asprintf(&output_message,"%s",temp_string); |
| 158 | } | 157 | } |
| 159 | else | 158 | else |
| @@ -236,7 +235,7 @@ int main(int argc, char **argv){ | |||
| 236 | else if(vars_to_check==CHECK_SERVICESTATE || vars_to_check==CHECK_PROCSTATE){ | 235 | else if(vars_to_check==CHECK_SERVICESTATE || vars_to_check==CHECK_PROCSTATE){ |
| 237 | 236 | ||
| 238 | if (check_value_list==TRUE) { | 237 | if (check_value_list==TRUE) { |
| 239 | preparelist(value_list); // replace , between services with & to send the request | 238 | preparelist(value_list); /* replace , between services with & to send the request */ |
| 240 | asprintf(&send_buffer,"%s&%u&%s&%s", req_password,(vars_to_check==CHECK_SERVICESTATE)?5:6, | 239 | asprintf(&send_buffer,"%s&%u&%s&%s", req_password,(vars_to_check==CHECK_SERVICESTATE)?5:6, |
| 241 | (show_all==TRUE)?"ShowAll":"ShowFail",value_list); | 240 | (show_all==TRUE)?"ShowAll":"ShowFail",value_list); |
| 242 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); | 241 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); |
| @@ -286,7 +285,7 @@ int main(int argc, char **argv){ | |||
| 286 | else if(vars_to_check==CHECK_COUNTER) { | 285 | else if(vars_to_check==CHECK_COUNTER) { |
| 287 | 286 | ||
| 288 | if (check_value_list==TRUE) { | 287 | if (check_value_list==TRUE) { |
| 289 | preparelist(value_list); // replace , between services with & to send the request | 288 | preparelist(value_list); /* replace , between services with & to send the request */ |
| 290 | asprintf(&send_buffer,"%s&8&%s", req_password,value_list); | 289 | asprintf(&send_buffer,"%s&8&%s", req_password,value_list); |
| 291 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); | 290 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); |
| 292 | if (result!=STATE_OK) | 291 | if (result!=STATE_OK) |
| @@ -297,7 +296,7 @@ int main(int argc, char **argv){ | |||
| 297 | exit(STATE_UNKNOWN); | 296 | exit(STATE_UNKNOWN); |
| 298 | } | 297 | } |
| 299 | 298 | ||
| 300 | strtok(value_list,"&"); // burn the first parameters | 299 | strtok(value_list,"&"); /* burn the first parameters */ |
| 301 | description = strtok(NULL,"&"); | 300 | description = strtok(NULL,"&"); |
| 302 | counter_value = atof(recv_buffer); | 301 | counter_value = atof(recv_buffer); |
| 303 | if (description == NULL) | 302 | if (description == NULL) |
| @@ -306,7 +305,7 @@ int main(int argc, char **argv){ | |||
| 306 | asprintf(&output_message, description, counter_value); | 305 | asprintf(&output_message, description, counter_value); |
| 307 | 306 | ||
| 308 | if (critical_value > warning_value) { | 307 | if (critical_value > warning_value) { |
| 309 | // Normal thresholds | 308 | /* Normal thresholds */ |
| 310 | if(check_critical_value==TRUE && counter_value >= critical_value) | 309 | if(check_critical_value==TRUE && counter_value >= critical_value) |
| 311 | return_code=STATE_CRITICAL; | 310 | return_code=STATE_CRITICAL; |
| 312 | else if (check_warning_value==TRUE && counter_value >= warning_value) | 311 | else if (check_warning_value==TRUE && counter_value >= warning_value) |
| @@ -315,7 +314,7 @@ int main(int argc, char **argv){ | |||
| 315 | return_code=STATE_OK; | 314 | return_code=STATE_OK; |
| 316 | } | 315 | } |
| 317 | else { | 316 | else { |
| 318 | // inverse thresholds | 317 | /* inverse thresholds */ |
| 319 | if(check_critical_value==TRUE && counter_value <= critical_value) | 318 | if(check_critical_value==TRUE && counter_value <= critical_value) |
| 320 | return_code=STATE_CRITICAL; | 319 | return_code=STATE_CRITICAL; |
| 321 | else if (check_warning_value==TRUE && counter_value <= warning_value) | 320 | else if (check_warning_value==TRUE && counter_value <= warning_value) |
| @@ -333,7 +332,7 @@ int main(int argc, char **argv){ | |||
| 333 | else if(vars_to_check==CHECK_FILEAGE) { | 332 | else if(vars_to_check==CHECK_FILEAGE) { |
| 334 | 333 | ||
| 335 | if (check_value_list==TRUE) { | 334 | if (check_value_list==TRUE) { |
| 336 | preparelist(value_list); // replace , between services with & to send the request | 335 | preparelist(value_list); /* replace , between services with & to send the request */ |
| 337 | asprintf(&send_buffer,"%s&9&%s", req_password,value_list); | 336 | asprintf(&send_buffer,"%s&9&%s", req_password,value_list); |
| 338 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); | 337 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); |
| 339 | if (result!=STATE_OK) | 338 | if (result!=STATE_OK) |
| @@ -349,7 +348,7 @@ int main(int argc, char **argv){ | |||
| 349 | asprintf(&output_message, description); | 348 | asprintf(&output_message, description); |
| 350 | 349 | ||
| 351 | if (critical_value > warning_value) { | 350 | if (critical_value > warning_value) { |
| 352 | // Normal thresholds | 351 | /* Normal thresholds */ |
| 353 | if(check_critical_value==TRUE && age_in_minutes >= critical_value) | 352 | if(check_critical_value==TRUE && age_in_minutes >= critical_value) |
| 354 | return_code=STATE_CRITICAL; | 353 | return_code=STATE_CRITICAL; |
| 355 | else if (check_warning_value==TRUE && age_in_minutes >= warning_value) | 354 | else if (check_warning_value==TRUE && age_in_minutes >= warning_value) |
| @@ -358,7 +357,7 @@ int main(int argc, char **argv){ | |||
| 358 | return_code=STATE_OK; | 357 | return_code=STATE_OK; |
| 359 | } | 358 | } |
| 360 | else { | 359 | else { |
| 361 | // inverse thresholds | 360 | /* inverse thresholds */ |
| 362 | if(check_critical_value==TRUE && age_in_minutes <= critical_value) | 361 | if(check_critical_value==TRUE && age_in_minutes <= critical_value) |
| 363 | return_code=STATE_CRITICAL; | 362 | return_code=STATE_CRITICAL; |
| 364 | else if (check_warning_value==TRUE && age_in_minutes <= warning_value) | 363 | else if (check_warning_value==TRUE && age_in_minutes <= warning_value) |
| @@ -569,7 +568,7 @@ void print_help(void) | |||
| 569 | } | 568 | } |
| 570 | 569 | ||
| 571 | int strtolarray(unsigned long *array, char *string, char *delim) { | 570 | int strtolarray(unsigned long *array, char *string, char *delim) { |
| 572 | // split a <delim> delimited string into a long array | 571 | /* split a <delim> delimited string into a long array */ |
| 573 | int idx=0; | 572 | int idx=0; |
| 574 | char *t1; | 573 | char *t1; |
| 575 | 574 | ||
| @@ -588,7 +587,7 @@ int strtolarray(unsigned long *array, char *string, char *delim) { | |||
| 588 | } | 587 | } |
| 589 | 588 | ||
| 590 | void preparelist(char *string) { | 589 | void preparelist(char *string) { |
| 591 | // Replace all , with & which is the delimiter for the request | 590 | /* Replace all , with & which is the delimiter for the request */ |
| 592 | int i; | 591 | int i; |
| 593 | 592 | ||
| 594 | for (i = 0; i < strlen(string); i++) | 593 | for (i = 0; i < strlen(string); i++) |
