Skip to content

Commit

Permalink
backport several rrd utility functions from svn main and provide data…
Browse files Browse the repository at this point in the history
… source debug info
  • Loading branch information
cigamit committed Mar 29, 2016
1 parent 9b08c15 commit cff1d7f
Show file tree
Hide file tree
Showing 4 changed files with 929 additions and 6 deletions.
33 changes: 33 additions & 0 deletions data_sources.php
Original file line number Diff line number Diff line change
Expand Up @@ -713,6 +713,15 @@ function ds_edit() {
}
}

/* handle debug mode */
if (isset_request_var('info')) {
if (get_nfilter_request_var('info') == '0') {
kill_session_var('ds_info_mode');
}elseif (get_nfilter_request_var('info') == '1') {
$_SESSION['ds_info_mode'] = true;
}
}

top_header();

if (!isempty_request_var('id')) {
Expand All @@ -724,6 +733,7 @@ function ds_edit() {
</td>
<td class='textInfo right' valign='top'>
<span class='linkMarker'>*<a class='hyperLink' href='<?php print htmlspecialchars('data_sources.php?action=ds_edit&id=' . (isset_request_var('id') ? get_request_var('id') : '0') . '&debug=' . (isset($_SESSION['ds_debug_mode']) ? '0' : '1'));?>'>Turn <?php print (isset($_SESSION['ds_debug_mode']) ? 'Off' : 'On');?> Data Source Debug Mode.</a><br>
<span class='linkMarker'>*<a class='hyperLink' href='<?php print htmlspecialchars('data_sources.php?action=ds_edit&id=' . (isset_request_var('id') ? get_request_var('id') : '0') . '&info=' . (isset($_SESSION['ds_info_mode']) ? '0' : '1'));?>'>Turn <?php print (isset($_SESSION['ds_info_mode']) ? 'Off' : 'On');?> Data Source Info Mode.</a><br>
<?php
if (!empty($data_template['id'])) {
?><span class='linkMarker'>*<a class='hyperLink' href='<?php print htmlspecialchars('data_templates.php?action=template_edit&id=' . (isset($data_template['id']) ? $data_template['id'] : '0'));?>'>Edit Data Template.</a><br><?php
Expand Down Expand Up @@ -952,6 +962,29 @@ function ds_edit() {
<?php
}

/* display the debug mode box if the user wants it */
if ((isset($_SESSION['ds_info_mode'])) && (isset_request_var('id'))) {
?>
<table style='width:100%'>
<tr>
<td><?php
$rrd_info = rrdtool_function_info(get_request_var('id'));

if (sizeof($rrd_info['rra'])) {
$diff = rrdtool_cacti_compare(get_request_var('id'), $rrd_info);
rrdtool_info2html($rrd_info, $diff);
if (sizeof($diff)) {
html_start_box('RRDtool Tune Info', '100%', '', '3', 'center', '');
rrdtool_tune($rrd_info['filename'], $diff, true);
html_end_box();
}
}
?></td>
</tr>
</table>
<?php
}

if ((isset_request_var('id')) || (isset_request_var('new'))) {
form_hidden_box('save_component_data_source','1','');
}else{
Expand Down
3 changes: 2 additions & 1 deletion include/global_arrays.php
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,8 @@
'GAUGE',
'COUNTER',
'DERIVE',
'ABSOLUTE'
'ABSOLUTE',
'COMPUTE'
);

$rrd_font_render_modes = array(
Expand Down
3 changes: 3 additions & 0 deletions include/global_constants.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@
define('RRD_LEGEND_DIR_TOPDOWN', 'topdown');
define('RRD_LEGEND_DIR_BOTTOMUP', 'bottomup');

define('RRD_FILE_VERSION1', '0001');
define('RRD_FILE_VERSION3', '0003');

define('DATA_QUERY_AUTOINDEX_NONE', 0);
define('DATA_QUERY_AUTOINDEX_BACKWARDS_UPTIME', 1);
define('DATA_QUERY_AUTOINDEX_INDEX_NUM_CHANGE', 2);
Expand Down
Loading

0 comments on commit cff1d7f

Please sign in to comment.