From: Ben C. <Be...@cl...> - 2004-10-06 14:40:22
|
Hi Clif, Sorry but I haven't been involved with this. If nobody else on this list gives you a reply, you may try the mailing list 'nagiosplug-help' where I have noticed postings about this plugins. I do hope you get an answer so that you can replace APAN with PP :) Regards, Ben. Clif J. Smith wrote: > First of all, thanks again for PerfParse. I'm hoping once I get my > ducks in a row with which plugins to use, etc., I'll replace APAN with it. > > I tried the check_nt plugin with what I assume is the latest build, but > it didn't provide performance data. I then tried to patch check_nt with > the patch on your site, but receive the following: > nagios-plugins-r1_3_0-200410041647]# patch plugins/check_nt.c > check_nt.c.patch > patching file plugins/check_nt.c > Hunk #2 FAILED at 81. > Hunk #3 FAILED at 140. > Hunk #4 FAILED at 164. > Hunk #5 FAILED at 202. > Hunk #6 FAILED at 223. > Hunk #7 FAILED at 255. > Hunk #8 FAILED at 291. > Hunk #9 succeeded at 406 (offset 54 lines). > Hunk #10 FAILED at 599. > Hunk #11 FAILED at 626. > Hunk #12 FAILED at 636. > Hunk #13 FAILED at 646. > Hunk #14 FAILED at 666. > 12 out of 14 hunks FAILED -- saving rejects to file plugins/check_nt.c.rej > > Here's the contents reject file: > *************** > *** 78,89 **** > int return_code = STATE_UNKNOWN; > char *send_buffer=NULL; > char *output_message=NULL; > char *temp_string=NULL; > char *description=NULL; > > double total_disk_space=0; > double free_disk_space=0; > double percent_used_space=0; > double mem_commitLimit=0; > double mem_commitByte=0; > unsigned long utilization; > --- 81,96 ---- > int return_code = STATE_UNKNOWN; > char *send_buffer=NULL; > char *output_message=NULL; > + char *perfdata=NULL; // Added for perfdata - GWC - 20040810 > char *temp_string=NULL; > + char *temp_string_perf=NULL; // Added for perfdata - GWC - 20040810 > char *description=NULL; > > double total_disk_space=0; > double free_disk_space=0; > double percent_used_space=0; > + double warning_used_space=0; //Added for perfdata - GWC - 20040811 > + double critical_used_space=0; //Added for perfdata - GWC - 20040811 > double mem_commitLimit=0; > double mem_commitByte=0; > unsigned long utilization; > *************** > *** 133,138 **** > /* -l parameters is present with only integers */ > return_code=STATE_OK; > temp_string = strdup (_("CPU Load")); > /* loop until one of the parameters is wrong or not > present */ > while (lvalue_list[0+offset]> (unsigned long)0 && > > lvalue_list[0+offset]<=(unsigned long)17280 && > --- 140,147 ---- > /* -l parameters is present with only integers */ > return_code=STATE_OK; > temp_string = strdup (_("CPU Load")); > + temp_string_perf = strdup (_(" ")); // Added for perfdata - > 20040810 - GWC > + > /* loop until one of the parameters is wrong or not > present */ > while (lvalue_list[0+offset]> (unsigned long)0 && > > lvalue_list[0+offset]<=(unsigned long)17280 && > *************** > *** 155,164 **** > > asprintf(&output_message,_(" %lu%% (%lu min > average)"), utilization, lvalue_list[0+offset]); > > asprintf(&temp_string,"%s%s",temp_string,output_message); > offset+=3; /* move across the array */ > } > if (strlen(temp_string)>10) /* we had at least one > loop */ > - output_message = strdup (temp_string); > else > output_message = strdup (_("not enough > values for -l parameters")); > } > --- 164,178 ---- > > asprintf(&output_message,_(" %lu%% (%lu min > average)"), utilization, lvalue_list[0+offset]); > > asprintf(&temp_string,"%s%s",temp_string,output_message); > + asprintf(&perfdata,_(" '%lu min avg Load'=%lu%%;%lu;%lu;0;100"), > lvalue_list[0+offset], utilization, > + lvalue_list[1+offset], lvalue_list[2+offset]); // Added > for perfdata - GWC - 20040810 > + asprintf(&temp_string_perf,"%s%s",temp_string_perf,perfdata); // > Added for perfdata - GWC - 20040810 > offset+=3; /* move across the array */ > } > + > if (strlen(temp_string)>10) /* we had at least one > loop */ > + output_message = strdup (temp_string), > + perfdata = temp_string_perf; // Added for perfdata - GWC - > 20040810 > else > output_message = strdup (_("not enough > values for -l parameters")); > } > *************** > *** 188,199 **** > free_disk_space=atof(strtok(recv_buffer,"&")); > total_disk_space=atof(strtok(NULL,"&")); > percent_used_space = ((total_disk_space - > free_disk_space) / total_disk_space) * 100; > > if (free_disk_space>=0) { > asprintf(&temp_string,_("%s:\\ - total: > %.2f Gb - used: %.2f Gb (%.0f%%) - free %.2f Gb (%.0f%%)"), > - > value_list, total_disk_space / 1073741824, (total_disk_space - > free_disk_space) / 1073741824, percent_used_space, > - > free_disk_space / 1073741824, (free_disk_space / total_disk_space)*100); > - > > if(check_critical_value==TRUE && > percent_used_space >= critical_value) > return_code=STATE_CRITICAL; > --- 202,219 ---- > free_disk_space=atof(strtok(recv_buffer,"&")); > total_disk_space=atof(strtok(NULL,"&")); > percent_used_space = ((total_disk_space - > free_disk_space) / total_disk_space) * 100; > + warning_used_space = ((float)warning_value / 100) * > total_disk_space; // Added for perfdata - 20040816 - GWC > + critical_used_space = ((float)critical_value / 100) * > total_disk_space; // Added for perfdata - 20040816 - GWC > + //warning_used_space = warning_value; // Added for perfdata - > 20040811 - GWC > + //critical_used_space = critical_value; // Added for perfdata - > 20040811 - GWC > > if (free_disk_space>=0) { > asprintf(&temp_string,_("%s:\\ - total: > %.2f Gb - used: %.2f Gb (%.0f%%) - free %.2f Gb (%.0f%%)"), > + value_list, total_disk_space / 1073741824, > (total_disk_space - free_disk_space) / 1073741824, > + percent_used_space, free_disk_space / 1073741824, > (free_disk_space / total_disk_space)*100); > + asprintf(&temp_string_perf,_("'%s:\\ Used > Space'=%.2fGb;%.2f;%.2f;0.00;%.2f"), value_list, > + (total_disk_space - free_disk_space) / 1073741824, > warning_used_space / 1073741824, > + critical_used_space / 1073741824, total_disk_space / > 1073741824); // Added for perfdata - GWC - 20040811 > > if(check_critical_value==TRUE && > percent_used_space >= critical_value) > return_code=STATE_CRITICAL; > *************** > *** 203,208 **** > return_code=STATE_OK; > > output_message = strdup (temp_string); > } > else { > output_message = strdup (_("Free disk space > : Invalid drive ")); > --- 223,229 ---- > return_code=STATE_OK; > > output_message = strdup (temp_string); > + perfdata = temp_string_perf; // Added for perfdata - GWC - 20040810 > } > else { > output_message = strdup (_("Free disk space > : Invalid drive ")); > *************** > *** 234,242 **** > mem_commitLimit=atof(strtok(recv_buffer,"&")); > mem_commitByte=atof(strtok(NULL,"&")); > percent_used_space = (mem_commitByte / mem_commitLimit) * 100; > asprintf(&output_message,_("Memory usage: total:%.2f Mb - > used: %.2f Mb (%.0f%%) - free: %.2f Mb (%.0f%%)"), > - mem_commitLimit / 1048576, mem_commitByte / > 1048567, percent_used_space, > - (mem_commitLimit - mem_commitByte) / 1048576, > (mem_commitLimit - mem_commitByte) / mem_commitLimit * 100); > > return_code=STATE_OK; > if(check_critical_value==TRUE && percent_used_space >= > critical_value) > --- 255,271 ---- > mem_commitLimit=atof(strtok(recv_buffer,"&")); > mem_commitByte=atof(strtok(NULL,"&")); > percent_used_space = (mem_commitByte / mem_commitLimit) * 100; > + warning_used_space = ((float)warning_value / 100) * > mem_commitLimit; // Fixed for perfdata - 20040816 - GWC > + critical_used_space = ((float)critical_value / 100) * > mem_commitLimit; // Fixed for perfdata - 20040816 - GWC > + //warning_used_space = warning_value; // Added for perfdata - > 20040811 - GWC > + //critical_used_space = critical_value; // Added for perfdata - > 20040811 - GWC > + // Changed divisor in following line from 1048567 to 3044515 to > accurately reflect memory size > asprintf(&output_message,_("Memory usage: total:%.2f Mb - > used: %.2f Mb (%.0f%%) - free: %.2f Mb (%.0f%%)"), > + mem_commitLimit / 3044515, mem_commitByte / 3044515, > percent_used_space, > + (mem_commitLimit - mem_commitByte) / 3044515, > (mem_commitLimit - mem_commitByte) / mem_commitLimit * 100); > + asprintf(&perfdata,_("'Memory usage'=%.2fMb;%.2f;%.2f;0.00;%.2f"), > mem_commitByte / 3044515, > + warning_used_space / 3044515, critical_used_space / > 3044515, mem_commitLimit / 3044515); > + // Added for perfdata - 20040811 - GWC > > return_code=STATE_OK; > if(check_critical_value==TRUE && percent_used_space >= > critical_value) > *************** > *** 262,267 **** > asprintf(&output_message, "%.f", > counter_value); > else > asprintf(&output_message,"%s = %.f", > description, counter_value); > > if (critical_value > warning_value) { /* > Normal thresholds */ > if(check_critical_value==TRUE && > counter_value >= critical_value) > --- 291,297 ---- > asprintf(&output_message, "%.f", > counter_value); > else > asprintf(&output_message,"%s = %.f", > description, counter_value); > + asprintf(&perfdata,"'%s'=%.f", description, counter_value); // > Added for perfdata - 20040811 - GWC > > if (critical_value > warning_value) { /* > Normal thresholds */ > if(check_critical_value==TRUE && > counter_value >= critical_value) > *************** > *** 567,574 **** > print_revision(progname,"$Revision: 1.21 $"); > printf (_("\ > Copyright (c) 2000 Yves Rubin (ru...@ya...)\n\n\ > This plugin collects data from the NSClient service running on a\n\ > - Windows NT/2000/XP server.\n\n")); > print_usage(); > printf (_("\nOptions:\n\ > -H, --hostname=HOST\n\ > --- 599,608 ---- > print_revision(progname,"$Revision: 1.21 $"); > printf (_("\ > Copyright (c) 2000 Yves Rubin (ru...@ya...)\n\n\ > + 20040811 - Edited to add Performance data output\n\ > + Garry W. Cook (na...@co...)\n\n\ > This plugin collects data from the NSClient service running on a\n\ > + Windows NT/2000/XP server.\n\\n")); > print_usage(); > printf (_("\nOptions:\n\ > -H, --hostname=HOST\n\ > *************** > *** 592,599 **** > -v, --variable=STRING\n\ > Variable to check. Valid variables are:\n")); > printf (_("\ > - CLIENTVERSION = Get the NSClient version\n\ > - If -l <version> is specified, will return warning if versions > differ.\n")); > printf (_("\ > CPULOAD = Average CPU load on last x minutes.\n\ > Request a -l parameter with the following syntax:\n\ > --- 626,633 ---- > -v, --variable=STRING\n\ > Variable to check. Valid variables are:\n")); > printf (_("\ > + CLIENTVERSION * = Get the NSClient version\n\ > + If -l <version> is specified, will return warning if versions > differ.\n")); // Edited for perfdata - GWC - 20040811 > printf (_("\ > CPULOAD = Average CPU load on last x minutes.\n\ > Request a -l parameter with the following syntax:\n\ > *************** > *** 602,609 **** > Thresholds are percentage and up to 10 requests can be done in one > shot.\n\ > ie: -l 60,90,95,120,90,95\n")); > printf (_("\ > - UPTIME = Get the uptime of the machine.\n\ > - No specific parameters. No warning or critical threshold\n")); > printf (_("\ > USEDDISKSPACE = Size and percentage of disk use.\n\ > Request a -l parameter containing the drive letter only.\n\ > --- 636,643 ---- > Thresholds are percentage and up to 10 requests can be done in one > shot.\n\ > ie: -l 60,90,95,120,90,95\n")); > printf (_("\ > + UPTIME * = Get the uptime of the machine.\n\ > + No specific parameters. No warning or critical threshold\n")); // > Edited for perfdata - GWC - 20040811 > printf (_("\ > USEDDISKSPACE = Size and percentage of disk use.\n\ > Request a -l parameter containing the drive letter only.\n\ > *************** > *** 612,627 **** > MEMUSE = Memory use.\n\ > Warning and critical thresholds can be specified with -w and -c.\n")); > printf (_("\ > - SERVICESTATE = Check the state of one or several services.\n\ > Request a -l parameters with the following syntax:\n\ > -l <service1>,<service2>,<service3>,...\n\ > You can specify -d SHOWALL in case you want to see working services\n\ > - in the returned string.\n")); > printf (_("\ > - PROCSTATE = Check if one or several process are running.\n\ > - Same syntax as SERVICESTATE.\n")); > printf (_("\ > - COUNTER = Check any performance counter of Windows NT/2000.\n\ > Request a -l parameters with the following syntax:\n\ > -l \"\\\\<performance object>\\\\counter\",\"<description>\n\ > The <description> parameter is optional and \n\ > --- 646,661 ---- > MEMUSE = Memory use.\n\ > Warning and critical thresholds can be specified with -w and -c.\n")); > printf (_("\ > + SERVICESTATE * = Check the state of one or several services.\n\ > Request a -l parameters with the following syntax:\n\ > -l <service1>,<service2>,<service3>,...\n\ > You can specify -d SHOWALL in case you want to see working services\n\ > + in the returned string.\n")); // Edited for perfdata - > GWC - 20040811 > printf (_("\ > + PROCSTATE * = Check if one or several process are running.\n\ > + Same syntax as SERVICESTATE.\n")); // Edited for perfdata - GWC - > 20040811 > printf (_("\ > + COUNTER ** = Check any performance counter of Windows NT/2000.\n\ > Request a -l parameters with the following syntax:\n\ > -l \"\\\\<performance object>\\\\counter\",\"<description>\n\ > The <description> parameter is optional and \n\ > *************** > *** 632,638 **** > printf (_("Notes:\n\ > - The NSClient service should be running on the server to get any > information\n\ > (http://nsclient.ready2run.nl).\n\ > - - Critical thresholds should be lower than warning thresholds\n")); > } > > > --- 666,674 ---- > printf (_("Notes:\n\ > - The NSClient service should be running on the server to get any > information\n\ > (http://nsclient.ready2run.nl).\n\ > + - Critical thresholds should be lower than warning thresholds\n\ > + - * Denotes check variables that do not return Performance Data\n\ > + - ** A <description> is required to generate Performance Data > output\n")); // Edited for perfdata - GWC - 20040811 > } > > > ------------------------------------------------------- > This SF.net email is sponsored by: IT Product Guide on ITManagersJournal > Use IT products in your business? Tell us what you think of them. Give us > Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more > http://productguide.itmanagersjournal.com/guidepromo.tmpl > _______________________________________________ > Perfparse-users mailing list > Per...@li... > https://lists.sourceforge.net/lists/listinfo/perfparse-users > |