-
-
Notifications
You must be signed in to change notification settings - Fork 427
Description
Version: Cacti 1.2.10
OS: CentOS 7
When export graph data to html page, It is always base on base_value 1024,not 1000 or any other user defined in graph template. So, when the data is traffic, caculating are not accurate. as below:

In fact,the traffic data were above 7.5G in peak time.
Explore :
I explore code of graph_xport.php , line 214:
print "<td class='right'>" . trim(number_format_i18n(round($row['col' . $i],3))) . '</td>';
the function number_format_i18n() is defined in include/global_languages.php, line 688:
function number_format_i18n($number, $decimals = 0, $baseu = 1024) {
Obivious it has default base_value =1024, but in graph_xport.php ,the base_value parameter is ignored and always defaut to 1024.
How to fix:
juse modify the code of graph_xport.php, line 214 , as below:
diff --git a/usr/local/github/cacti/graph_xport.php b/graph_xport.php
index 0435ba6..fdd325a 100644
--- a/usr/local/github/cacti/graph_xport.php
+++ b/graph_xport.php
@@ -211,7 +211,7 @@ if (isset($xport_array['data']) && is_array($xport_array['data'])) {
print "<tr><td class='left'>" . date('Y-m-d H:i:s', (isset($row['timestamp']) ? $row['timestamp'] : $xport_array['meta']['start'] + $j*$xport_array['meta']['step'])) . "</td>";
for ($i = 1; $i <= $xport_array['meta']['columns']; $i++) {
if ($row['col' . $i] > 1) {
- print "<td class='right'>" . trim(number_format_i18n(round($row['col' . $i],3))) . '</td>';
+ print "<td class='right'>" . trim(number_format_i18n(round($row['col' . $i],3),2,$graph_info['base_value'])) . '</td>';
} elseif($row['col' . $i] == 0) {
print "<td class='right'>-</td>";
} else {

