Cacti 百分比监控算法具体方法如下!
cacti本身的模板只可以监控硬盘的使用大小,而不能监控使用非分率,所以我们要自定义cdef来监控硬盘使用率,并借助thold插件实现报警功能。网上找的资料都是在cacti.0.8.6版上实现的,而我用的是cacti.0.8.7版。因此,根据实际情况做如下改动:
在cacti目录下,vi global_arrays.php
搜索custom_data_source_types,修改这一段如下:
- $custom_data_source_types = array(
- "CURRENT_DATA_SOURCE" => "Current Graph Item Data Source",
- "ALL_DATA_SOURCES_NODUPS" => "All Data Sources (Don't Include Duplicates)",
- "ALL_DATA_SOURCES_DUPS" => "All Data Sources (Include Duplicates)",
- "SIMILAR_DATA_SOURCES_NODUPS" => "All Similar Data Sources (Don't Include Duplicates)",
- "SIMILAR_DATA_SOURCES_DUPS" => "All Similar Data Sources (Include Duplicates)",
- "CURRENT_DS_MINIMUM_VALUE" => "Current Data Source Item: Minimum Value",
- "CURRENT_DS_MAXIMUM_VALUE" => "Current Data Source Item: Maximum Value",
- "CURRENT_GRAPH_MINIMUM_VALUE" => "Graph: Lower Limit",
- "CURRENT_GRAPH_MAXIMUM_VALUE" => "Graph: Upper Limit",
- "VALUE_OF_HDD_TOTAL" => "Value of hdd_total data source");
在cacti界面的Graph Management-cdefs新建cdef模块,名字自己起,添加字段如下:
- Item #1 Special Data Source: CURRENT_DATA_SOURCE
- Item #2 Custom String: 100
- Item #3 Operator: *
- Item #4 Special Data Source: VALUE_OF_HDD_TOTAL
- Item #5 Operator: /
也就是说
cdef=CURRENT_DATA_SOURCE,100,*,VALUE_OF_HDD_TOTAL,/
这样就可以在Threshold Templates里面添加监控硬盘的模块了,我添加的是Host MIB - Hard Drive Space ,***在Threshold CDEF里面选择刚自定义的cdef,这样就可以正常监控硬盘使用率了。
通过上面代码的说明,我们知道了Cacti 百分比监控算法!很好用,大家可以试试!
【编辑推荐】