官术网_书友最值得收藏!

Time for action – adding a legend

  1. The graph is still missing the Legend, so click on the Add link of the Graph Template Items again.
  2. Select Comment as the Graph Item Type.
  3. Enter Running Processes into the Text Format field.
  4. Click on the Create button.
  5. Let's add some more statistical information to your Legend. Click on the Add link.
  6. Select Legend as the Graph Item Type.
  7. Click on the Create button.
    Time for action – adding a legend

What just happened?

You have added a comment describing the statistical information relating to the graph. The Legend command adds three GPRINT statements to the graph. The first GPRINT statement prints the last polled value, the second statement prints the average value of the displayed graph and the last one prints the maximum value polled.

You can now assign this graph template to a device. After you have added the graph template to a device, you need to wait for three polls to pass. The first poll actually creates the necessary RRD file. The other two polls are needed for the RRDtool as it will start graphing values only when it has at least two data values within the RRD file. Once that time has passed, go to Graph Management within the Management section and look for the graph there:

What just happened?

Tip

Turn on graph debugging mode

After turning on the graph debugging option, the graph management page will display the rrdtool graph command used to create the graph. Any errors, such as a missing RRD file, will be displayed here. This debugging information is useful for troubleshooting the graph generation.

Back to basics—rrdtool graph command

Let's look at the rrdtool graph command which Cacti uses to create the preceding graph.

/usr/bin/rrdtool graph -
--imgformat=PNG
--start=-86400
--end=-300
--title='Localhost - Running Processes'
--base=1000
--height=120
--width=500
--alt-autoscale-max
--lower-limit=0
--vertical-label='processes'
--slope-mode
--font TITLE:12:
--font AXIS:8:
--font LEGEND:10:
--font UNIT:8:
DEF:a="/var/www/html/cacti-0.8.7g/rra/localhost_runprocesses_11.rrd":runProcesses:AVERAGE
CDEF:cdefc=a,45,50,LIMIT
CDEF:cdefd=a,0,44,LIMIT
HRULE:50#C0C0C0FF:"Threshold ( 50 )\n"
AREA:a#FF0000FF:"Over Threshold"
AREA:cdefc#F5F800FF:"Near Threshold"
AREA:cdefd#7EE600FF:"Under Threshold\n"
COMMENT:"Running Processes"
GPRINT:a:LAST:"Current\:%8.2lf %s"
GPRINT:a:AVERAGE:"Average\:%8.2lf %s"
GPRINT:a:MAX:"Maximum\:%8.2lf %s\n" 

Doesn't this one look familiar? It's roughly the same command which you hopefully came up with in the "Have a go hero" challenge in Chapter 2. Here you can see the tight integration of the rrdtool with the Cacti web interface.

主站蜘蛛池模板: 繁昌县| 三江| 孟州市| 淮北市| 蚌埠市| 金沙县| 甘泉县| 五寨县| 稷山县| 晋江市| 辛集市| 龙里县| 寿宁县| 区。| 桂东县| 安阳市| 聂荣县| 纳雍县| 革吉县| 平谷区| 恩平市| 佛教| 宝山区| 临朐县| 武宣县| 辉南县| 香港| 体育| 叶城县| 云林县| 毕节市| 临安市| 陇川县| 济宁市| 昌平区| 洮南市| 宝应县| 甘洛县| 鄂托克前旗| 中西区| 杭锦后旗|