Skip to content

Commit 2dcd58b

Browse files
xmacanTheWitness
authored andcommitted
fix CSV export - missing first row and wrong start time (Cacti#5586)
1 parent dbecaa0 commit 2dcd58b

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

graph_xport.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@
247247

248248
if (isset($xport_array['data']) && is_array($xport_array['data'])) {
249249
if (!$html) {
250-
$j = 1;
250+
$j = 0;
251251

252252
foreach ($xport_array['data'] as $row) {
253253
$data = '"' . date('Y-m-d H:i:s', (isset($row['timestamp']) ? $row['timestamp'] : $xport_array['meta']['start'] + $j * $xport_array['meta']['step'])) . '"';
@@ -264,7 +264,7 @@
264264
print "\xEF\xBB\xBF";
265265
print $output;
266266
} else {
267-
$j = 1;
267+
$j = 0;
268268

269269
foreach ($xport_array['data'] as $row) {
270270
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>';

lib/rrd.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1624,7 +1624,7 @@ function rrdtool_function_graph($local_graph_id, $rra_id, $graph_data_array, $rr
16241624
} else {
16251625
/* basic export options */
16261626
$graph_opts =
1627-
'--start=' . cacti_escapeshellarg($graph_start) . RRD_NL .
1627+
'--start=' . cacti_escapeshellarg($graph_start-1) . RRD_NL .
16281628
'--end=' . cacti_escapeshellarg($graph_end) . RRD_NL .
16291629
'--maxrows=10000' . RRD_NL;
16301630
}

0 commit comments

Comments
 (0)