0

我正在使用RRDTool在一个图表中绘制数据和预测趋势 (LSL)。
因此我正在调整相应的模板。
目前我这样设置结束时间:

--end start+7d

通过网站查看生成的图表时,我可以在右侧选择不同的时间范围:
自定义时间范围、概览、4 小时、25 小时、一周、一个月一年

我想要什么:
如果我选择 4 小时的时间范围,7 天的预测毫无意义。我想根据所选时间范围计算结束时间。例如,我希望将来显示的时间段与所选时间范围的大小完全相同。
基本上我想像这样定义我的结束时间:

--end start+(end-start)

这是不可能的,因为结束时间不能自行定义。

有没有办法在手动定义结束之前提取选定的时间范围?我可以start+(end-start)在我的 PHP 模板中计算并在定义结束时间时插入它。

每一个帮助表示赞赏。

编辑:我忘了提,我正在通过PNP4Nagios使用 RRDTool 。当谈到网站时,我指的是 PNP4Nagios 标准 Web 外观。通过包安装 PNP4Nagios 时默认提供此功能。

4

1 回答 1

1

With PNP4Nagios, your custom template can be used to define all the graph definition -- with the exception of the time window, which is added to the parameter lists in $opt[] and $def[]. So, you cannot easily override the time window 'end' as it is already defined as 'now' by PNP4Nagios (and the 'start' is already defined relative to the end, based on the time range you selected in the web interface). In fact, RRDTool is fairly robust, so if it sees a start/end being redefined the last such definition usually takes precedence... but this doesn't solve your issue.

I think what you're trying to do is have the 1day graph (which normally starts at 'end-1day' and ends at 'now') to go from 'now-1day' to 'now+1day' so that your prediction line could fill the second part. This would need to be done by editing the PNP4Nagios code, which is a bit out of scope of this answer.

PNP4Nagios allows definition of the standard timeranges in the config.php; you can also define new timeranges when you call the graph. This means you can achieve the required time window like this:

pnp4nagios/graph?host=<hostname>&srv=<servicedesc>&start=-1day&end=+1day

... although this is just a one-off and does not override the defaults.

The current view config in PNP4Nagios does not allow the default views to specify an end offset, only a start offset.

于 2015-03-07T01:54:37.303 回答