親愛的,
我的 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
事實上,我通過將“最後一個”更改為“平均”來解決了這個問題,並且不問為什麼平均值有效而最後一個無效,因為這真的很奇怪且出乎意料。