用cacti画多个设备的总流量图(Aggregating traffic of multi devices into one graph)
最近有需求,要了解业务线所用的流量
于是想到用cacti画一张业务线所有机器所用流量和的总流量图
本来cacti已经有每一台设备的流量图(数据)了
现在所要做的就是把需要的数据加起来,画在一张图上
我只知道这个东西做起来应该不难
但由于大家以前都习惯用mrtg,cacti这个东东的中文资料不多
所以我最后在cacti的官方论坛forum.cacti.net 上翻出了这么一篇类似的解决方案
http://forums.cacti.net/post-42426.html
下面这是原文:
1. Create a new CDEF - Management/Graph Management/CDEFs:
- Click 'Add'
- Create as per the 2nd image above
2. Create a new Graph - Management/Graph Management:
- Click 'Turn Off Graph Debug Mode'
- Click 'Add'
- Leave 'Selected Graph Template' and 'Host' as 'None'
- Click 'create'
- Give your graph a destinctive title and click 'create'
- Add the first data source by clicking 'Add' beside 'Graph Items'
- select your first data source
- select your colour
- in 'Graph Item Type' select 'Area'
- in 'CDEF Function' select 'Bytes into bits'
- give the data source a title
- Click 'create'
- Click 'add' again and create a legend (all values the same as above, except 'Graph Item Type' is 'Legend')
- Add your second data source exactly at the first except 'Graph Item Type' is 'Stack'
- add legend for second data source as above
- Continue adding sources in the same fashion until you are done.
To get the total on the graph, add another Graph Item:
- use the same data source as your last data source
- select your colour
- in 'Graph Item Type' select 'Line 3' (use Line 2 or Line 1 for smaller lines)
- in 'CDEF Function' select 'Total All Data Sources and Bytes into Bits' (the one you created at the start)
- In Text Format, call it 'Total'.
- Click 'create'
- Click 'add' again and create a legend (all values the same as above, except 'Graph Item Type' is 'Legend')
Now you should have a graph with the output from different data sources, plus a total at the bottom.
这里作者应用的建CDEF的图我没有贴出来
其实就是新建一个名字叫“Total All Data Sources and Bytes into Bits”的CDEF,其
cdef=SIMILAR_DATA_SOURCES_NODUPS,8,*
这里的意思我想是把流量(bytes为单位)变成以bites为单位的流量
然后再建一张新的图
在新图的"graph items"里把要统计的数据(这里是网络设备的流量)"Add"进来
最后再添加一个"graph item"
用来画总流量曲线
他的Data Source就用上面最后一个graph item的Data Source
CDEF function选开始建的"Total All Data Sources and Bytes into Bits"
(前面的graph item的CDEF function都选"Turn Bytes into Bits",他的cdef值是
cdef=CURRENT_DATA_SOURCE,8,*
)
Graph Item Type选Line1(Line2和Line3都行,就是线条的粗细不一样)
(前面的graph item除了第一个选area外,都选stack)
同样
还有个需要注意的:
就是每添加上面所讲的一个“graph item”
还需要接着添加一个跟其匹配的"graph item"
这个"graph item"除了Graph Item Type选"legend"外其他都跟其匹配的"graph item"相同





Discussion Area - Leave a Comment