munin 监控 mongodb

张映 发表于 2015-01-19

分类目录: 服务器相关

标签:, ,

1,下载munin的mongodb插件

https://github.com/erh/mongo-munin

2,安装munin mongodb的依赖

# yum install pymongo

这个插件是python写的,如果不装的话,会报以下错误:

# munin-run mongo_mem
Traceback (most recent call last):
File "/etc/munin/plugins/mongo_mem", line 8, in <module>
import pymongo
ImportError: No module named pymongo

3,安装配置munin mongodb插件

# tar zxvf comerford-mongo-munin-8980f32.tar.gz
# cd comerford-mongo-munin-8980f32
# ln -sf /路径/mongo_* /etc/munin/plugins/
# chmod +x /路径/mongo_*
# ./build.sh

# vim /etc/munin/plugin-conf.d/mongodb  //创建文件
[mongo_*]
user root     //要用root,不然会报错

Can't exec "/etc/munin/plugins/pmongo_mem": Permission denied

4,测试并重启

# munin-run mongo_btree
missRatio.value 0
resets.value 0
hits.value 2
misses.value 0
accesses.value 2

# munin-run mongo_conn
connections.value 2

# munin-run mongo_docs
deleted.value 0
updated.value 0
inserted.value 3
returned.value 0

# munin-run mongo_lock
locked.value 0

# munin-run mongo_mem
resident.value 39845888
virtual.value 623902720
mapped.value 167772160

# munin-run mongo_ops
getmore.value 0
insert.value 3
update.value 0
command.value 43194
query.value 3978
delete.value 0

如果上面都有数据的话,就说明插件安装成功

# /etc/init.d/munin-node restart


转载请注明
作者:海底苍鹰
地址:http://blog.51yip.com/server/1696.html