Skip to content

Commit

Permalink
(status > monitoring) use last updated date instead for graph timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
jdillard committed Jun 7, 2016
1 parent a93f57d commit aaf5e5c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,14 @@
$left_pieces = explode("-", $left);
$right_pieces = explode("-", $right);

$rrd_info_array = rrd_info($rrd_location . $left . ".rrd");
$left_last_updated = $rrd_info_array['last_update'];

$rrd_info_array = rrd_info($rrd_location . $right . ".rrd");
$right_last_updated = $rrd_info_array['last_update'];

$last_updated = max($left_last_updated, $right_last_updated);

if ($timePeriod === "custom") {

//dates validation
Expand Down Expand Up @@ -269,6 +277,7 @@

$obj[$ds_key_left_adjusted]['key'] = $ds;
$obj[$ds_key_left_adjusted]['step'] = $step;
$obj[$ds_key_left_adjusted]['last_updated'] = $last_updated*1000;
$obj[$ds_key_left_adjusted]['type'] = $graph_type;
$obj[$ds_key_left_adjusted]['format'] = $format;
$obj[$ds_key_left_adjusted]['yAxis'] = 1;
Expand Down Expand Up @@ -496,6 +505,7 @@

$obj[$ds_key_right_adjusted]['key'] = $ds;
$obj[$ds_key_right_adjusted]['step'] = $step;
$obj[$ds_key_right_adjusted]['last_updated'] = $last_updated*1000;
$obj[$ds_key_right_adjusted]['type'] = $graph_type;
$obj[$ds_key_right_adjusted]['format'] = $format;
$obj[$ds_key_right_adjusted]['yAxis'] = 2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1189,8 +1189,8 @@ function draw_graph(options) {
.attr("id", "resolution")
.text("Resolution: " + stepLookup[data[0].step]);

//add current date
var currentDate = d3.time.format('%a %b %d %H:%M:%S %Y GMT%Z')(new Date());
//add last updated date
var currentDate = d3.time.format('%a %b %d %H:%M:%S %Y')(new Date(data[0].last_updated));
d3.select('#chart svg')
.append("text")
.attr("x", 755)
Expand Down

0 comments on commit aaf5e5c

Please sign in to comment.