[Nagios-devel] HTML output from avail.cgi when producing CSV reports
Posted: Wed Nov 17, 2004 5:08 am
This is a multi-part message in MIME format.
--------------040402000405070108000707
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
There is a bug in avail.c, causing avail.cgi to produce HTML output in
CSV host reports.
The "Average" line, which is only available when doing html reports, is
printed at the very bottom with html tags included.
Attached is a patch against latest CVS to take care of the problem.
Apply with patch -p1 ",bgclass,bgclass);
host_report_url(temp_subject->host_name,temp_subject->host_name);
printf("%2.3f%% (%2.3f%%)%2.3f%% (%2.3f%%)%2.3f%% (%2.3f%%)%2.3f%%\n",percent_time_up,percent_time_up_known,percent_time_down,percent_time_down_known,percent_time_unreachable,percent_time_unreachable_known,bgclass,percent_time_indeterminate);
@@ -4230,22 +4231,23 @@
get_running_average(&average_percent_time_indeterminate,percent_time_indeterminate,current_subject);
}
- /* average statistics */
- if(odd){
- odd=0;
- bgclass="Odd";
- }
- else{
- odd=1;
- bgclass="Even";
- }
- printf("Average%2.3f%% (%2.3f%%)%2.3f%% (%2.3f%%)%2.3f%% (%2.3f%%)%2.3f%%",bgclass,bgclass,average_percent_time_up,average_percent_time_up_known,average_percent_time_down,average_percent_time_down_known,average_percent_time_unreachable,average_percent_time_unreachable_known,bgclass,average_percent_time_indeterminate);
-
if(output_format==HTML_OUTPUT){
- printf("\n");
- printf("\n");
+
+ /* average statistics */
+ if(odd){
+ odd=0;
+ bgclass="Odd";
+ }
+ else{
+ odd=1;
+ bgclass="Even";
+ }
+ printf("Average%2.3f%% (%2.3f%%)%2.3f%% (%2.3f%%)%2.3f%% (%2.3f%%)%2.3f%%",bgclass,bgclass,average_percent_time_up,average_percent_time_up_known,average_percent_time_down,average_percent_time_down_known,average_percent_time_unreachable,average_percent_time_unreachable_known,bgclass,average_percent_time_indeterminate);
+
+ printf("\n");
+ printf("\n");
+ }
}
- }
return;
}
@@ -4605,16 +4607,17 @@
}
}
- if(odd){
- odd=0;
- bgclass="Odd";
- }
- else{
- odd=1;
- bgclass="Even";
- }
-
if(output_format==HTML_OUTPUT){
+
+ if(odd){
+ odd=0;
+ bgclass="Odd";
+ }
+ else{
+ odd=1;
+ bgclass="Even";
+ }
+
printf("",bgclass,bgclass);
if(strcmp(temp_subject->host_name,last_host))
host_report_url(temp_subject->host_name,temp_subject->host_name);
--------------040402000405070108000707--
This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]
--------------040402000405070108000707
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
There is a bug in avail.c, causing avail.cgi to produce HTML output in
CSV host reports.
The "Average" line, which is only available when doing html reports, is
printed at the very bottom with html tags included.
Attached is a patch against latest CVS to take care of the problem.
Apply with patch -p1 ",bgclass,bgclass);
host_report_url(temp_subject->host_name,temp_subject->host_name);
printf("%2.3f%% (%2.3f%%)%2.3f%% (%2.3f%%)%2.3f%% (%2.3f%%)%2.3f%%\n",percent_time_up,percent_time_up_known,percent_time_down,percent_time_down_known,percent_time_unreachable,percent_time_unreachable_known,bgclass,percent_time_indeterminate);
@@ -4230,22 +4231,23 @@
get_running_average(&average_percent_time_indeterminate,percent_time_indeterminate,current_subject);
}
- /* average statistics */
- if(odd){
- odd=0;
- bgclass="Odd";
- }
- else{
- odd=1;
- bgclass="Even";
- }
- printf("Average%2.3f%% (%2.3f%%)%2.3f%% (%2.3f%%)%2.3f%% (%2.3f%%)%2.3f%%",bgclass,bgclass,average_percent_time_up,average_percent_time_up_known,average_percent_time_down,average_percent_time_down_known,average_percent_time_unreachable,average_percent_time_unreachable_known,bgclass,average_percent_time_indeterminate);
-
if(output_format==HTML_OUTPUT){
- printf("\n");
- printf("\n");
+
+ /* average statistics */
+ if(odd){
+ odd=0;
+ bgclass="Odd";
+ }
+ else{
+ odd=1;
+ bgclass="Even";
+ }
+ printf("Average%2.3f%% (%2.3f%%)%2.3f%% (%2.3f%%)%2.3f%% (%2.3f%%)%2.3f%%",bgclass,bgclass,average_percent_time_up,average_percent_time_up_known,average_percent_time_down,average_percent_time_down_known,average_percent_time_unreachable,average_percent_time_unreachable_known,bgclass,average_percent_time_indeterminate);
+
+ printf("\n");
+ printf("\n");
+ }
}
- }
return;
}
@@ -4605,16 +4607,17 @@
}
}
- if(odd){
- odd=0;
- bgclass="Odd";
- }
- else{
- odd=1;
- bgclass="Even";
- }
-
if(output_format==HTML_OUTPUT){
+
+ if(odd){
+ odd=0;
+ bgclass="Odd";
+ }
+ else{
+ odd=1;
+ bgclass="Even";
+ }
+
printf("",bgclass,bgclass);
if(strcmp(temp_subject->host_name,last_host))
host_report_url(temp_subject->host_name,temp_subject->host_name);
--------------040402000405070108000707--
This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]