上QQ阅读APP看书,第一时间看更新
Have a go hero - create your own visual warnings
Let's assume the green and red areas are not granular enough, you also want to have a yellow area, where you can immediately see that the threshold is about to be breached. This yellow warning area should be displayed between the values 45 and 50.
Have a look at the following image:
What would you need to change in the above RRDtool command line to get this image?
Solution: You need to add one additional CDEF and another AREA for this to work. You also need to change the isGreen CDEF. The following command line will create and display the yellow warning area and the appropriate legend:
rrdtool graph -w 500 data_image.png --start 1488153600 --end
1488218400 \ --vertical-label bps --title "Interface Speed" \ DEF:intspeed=test.rrd:data:AVERAGE \ VDEF:maximum=intspeed,MAXIMUM \ CDEF:isGreen=intspeed,0,44,LIMIT \ CDEF:isYellow=intspeed,45,50,LIMIT \ HRULE:50#C0C0C0FF:"Threshold ( 50 )\n" \ HRULE:maximum#202020FF:"Maximum of this period\n" \ AREA:intspeed#FF0000:"Over Threshold" \ AREA:isYellow#FFFF00:"Warning" \ AREA:isGreen#00FF00:"Good\n" \ COMMENT:"Interface eth0" \ GPRINT:intspeed:LAST:"Current\:%8.0lf" \ GPRINT:intspeed:AVERAGE:"Average\:%8.0lf" \ GPRINT:intspeed:MAX:"Maximum\:%8.0lf\n"
Note that we use a COMMENT item to add the Interface eth0 text at the beginning of the graph legend.