亲爱的,
我的 pnp4nagios 出现了一个奇怪的问题,
事实上我有一个 nagios 服务器和许多使用 pnp4nagios 的图表,但是,我只遇到单个图表的问题。
问题是它只绘制过去 3 天的图表。
下面的代码是我为图表编写的 php 代码。
<?php
$ds_name[1] = "Total";
$opt[1] = "-l 0 --vertical-label \"Numbers\" --title \"$hostname / $servicedesc\" ";
$opt[1] .= '--slope-mode ';
# QUEUE
$def[1] = "DEF:queue=$RRDFILE[1]:$DS[1]:LAST " ;
# Total
$def[1] .= "DEF:total=$RRDFILE[1]:$DS[2]:LAST " ;
# Available
$def[1] .= "DEF:available=$RRDFILE[1]:$DS[3]:LAST " ;
# Busy
$def[1] .= "DEF:busy=$RRDFILE[1]:$DS[4]:LAST " ;
# OnCall
$def[1] .= "DEF:oncall=$RRDFILE[1]:$DS[5]:LAST " ;
#Available
$def[1] .= rrd::cdef("available_temp", "available,busy,+,oncall,+");
$def[1] .= rrd::gradient("available_temp", "08870a", "04cc07", "Available", 20);
$def[1] .= "GPRINT:available:LAST:\"%.0lf LAST \" ";
$def[1] .= "GPRINT:available:MAX:\"%.0lf MAX \" ";
$def[1] .= "GPRINT:available:AVERAGE:\"%.0lf AVERAGE \\n\" ";
#Busy
$def[1] .= rrd::cdef("busy_temp", "busy,oncall,+");
$def[1] .= rrd::gradient("busy_temp", "ffbf00", "ff8000", "Busy ", 20);
$def[1] .= "GPRINT:busy:LAST:\"%.0lf LAST \" ";
$def[1] .= "GPRINT:busy:MAX:\"%.0lf MAX \" ";
$def[1] .= "GPRINT:busy:AVERAGE:\"%.0lf AVERAGE \\n\" ";
#OnCall
$def[1] .= rrd::gradient("oncall", "4000ff", "0040ff", "On Call ", 20);
$def[1] .= "GPRINT:oncall:LAST:\"%.0lf LAST \" ";
$def[1] .= "GPRINT:oncall:MAX:\"%.0lf MAX \" ";
$def[1] .= "GPRINT:oncall:AVERAGE:\"%.0lf AVERAGE \\n\" ";
$def[1] .= rrd::cdef("queue_temp", "queue,-1,*");
$def[1] .= rrd::gradient("queue_temp", "ff00ff", "bf00ff", "Queue ", 20);
$def[1] .= "GPRINT:queue:LAST:\"%.0lf LAST \" ";
$def[1] .= "GPRINT:queue:MAX:\"%.0lf MAX \" ";
$def[1] .= "GPRINT:queue:AVERAGE:\"%.0lf AVERAGE \\n\" ";
#Total ( The Red Line)
$def[1] .= rrd::line2("total", "#ff0000", "Total ");
$def[1] .= "GPRINT:total:LAST:\"%.0lf LAST \" ";
$def[1] .= "GPRINT:total:MAX:\"%.0lf MAX \" ";
$def[1] .= "GPRINT:total:AVERAGE:\"%.0lf AVERAGE \\n\" ";
?
>
答案1
我不认为这是由模板决定的。看看时间范围在文档中,这似乎是在您访问 pnp4nagios 的 URL 中设置的。
示例(通知start=
):
pnp4nagios/graph?host=<hostname>&srv=<servicedesc>&start=-1week
答案2
事实上,我通过将“最后”改为“平均”解决了这个问题,并且不问为什么平均值有效而最后无效,因为这真的很奇怪和出乎意料。