Cacti是我常用的监控网络软件,有时候我拿来监控我的硬盘I/O ,来看看具体是怎么做的!
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,这样就可以正常监控硬盘使用率了。
通过阅读完整的文章,想必大家都学会了Cacti监控硬盘I/O的方法了吧!祝你们成功!
【编辑推荐】