6、cacti监控硬盘I/O的方法:
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");
//中文版汉化为:
"CURRENT_GRAPH_MAXIMUM_VALUE" => "图像: 上限",
"VALUE_OF_HDD_TOTAL" => "所有硬盘数据的值");
在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,这样就可以正常监控硬盘使用率了。
官方论坛上有介绍,地址:
下面把使用方法摘录如下:
1. Copy net-snmp_devio.xml to /resource/snmp_queries/net-snmp_devio.xml
2. Import all *_templ.xml via Cacti "Import Templates" interface - These templates should include all their dependancies
3. Add "ucd/net - Get Device I/O" Data Query to your SNMP Enabled host using the "Index Count Changed" Re-index Method.
4. Create Graphs for your desired Disk and/or Memory devices.