Php
3天后的pnp4nagios圖
親愛的,
我的 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\" "; ?
事實上,我通過將“最後一個”更改為“平均”解決了這個問題,並且不問為什麼平均有效而最後一個無效,因為這真的很奇怪和出乎意料。
我不相信這是由模板決定的。查看文件中的時間範圍,似乎這是在您訪問 pnp4nagios 的 URL 中設置的。
範例(注意
start=
):
pnp4nagios/graph?host=<hostname>&srv=<servicedesc>&start=-1week