【发布时间】:2023-04-03 06:58:01
【问题描述】:
我正在尝试将 MongoDB 的插件添加到 munin。我按照这个来安装插件:
sudo apt-get install git munin-node
git clone git://github.com/erh/mongo-munin.git /home/ubuntu/mongo-munin
sudo ln -sf /home/ubuntu/mongo-munin/mongo_btree /etc/munin/plugins/mongo_btree
sudo ln -sf /home/ubuntu/mongo-munin/mongo_conn /etc/munin/plugins/mongo_conn
sudo ln -sf /home/ubuntu/mongo-munin/mongo_lock /etc/munin/plugins/mongo_lock
sudo ln -sf /home/ubuntu/mongo-munin/mongo_mem /etc/munin/plugins/mongo_mem
sudo ln -sf /home/ubuntu/mongo-munin/mongo_ops /etc/munin/plugins/mongo_ops
sudo service munin-node restart
(来自https://ivan-site.com/2013/06/monitoring-mongodb-in-munin-on-ubuntu-1304)
但是没有任何东西发送到 munin 的服务器(仅适用于 Mongo,来自服务器的所有其他日期在 Munin 上都可以)。
然后我发现运行插件时出现错误:
# sudo -u munin python /usr/share/munin/plugins/mongo_ops
Traceback (most recent call last):
File "/usr/share/munin/plugins/mongo_ops", line 56, in <module>
doData()
File "/usr/share/munin/plugins/mongo_ops", line 33, in doData
ss = getServerStatus()
File "/usr/share/munin/plugins/mongo_ops", line 28, in getServerStatus
raw = urllib2.urlopen(req).read()
File "/usr/lib/python2.7/urllib2.py", line 126, in urlopen
return _opener.open(url, data, timeout)
File "/usr/lib/python2.7/urllib2.py", line 400, in open
response = self._open(req, data)
File "/usr/lib/python2.7/urllib2.py", line 418, in _open
'_open', req)
File "/usr/lib/python2.7/urllib2.py", line 378, in _call_chain
result = func(*args)
File "/usr/lib/python2.7/urllib2.py", line 1207, in http_open
return self.do_open(httplib.HTTPConnection, req)
File "/usr/lib/python2.7/urllib2.py", line 1177, in do_open
raise URLError(err)
urllib2.URLError: <urlopen error [Errno 111] Connection refused>
我已经检查了这个问题:Munin Mongodb Plugin Not Showing. . .? 但问题不一样,我正在运行 pyhton 2,如上面的输出所示:
File "/usr/lib/python2.7/urllib2.py", line 126, in urlopen
因此,插件处于活动状态:
# munin-node-configure | grep "mongo"
mongo_btree | yes |
mongo_conn | yes |
mongo_lock | yes |
mongo_mem | yes |
mongo_ops | yes |
这是 Mongo 的许可吗?也许我需要为 Munin 设置一个用户?你知道如何解决这个问题吗?
【问题讨论】:
-
您是否将插件复制到
/usr/share/munin/plugins并从那里符号链接到/etc/munin/plugins? -
是的,插件在
/usr/share/munin/plugins和/etc/munin/plugins的simlink:mongo_btree -> /usr/share/munin/plugins/mongo_btreemongo_conn -> /usr/share/munin/plugins/mongo_connmongo_lock -> /usr/share/munin/plugins/mongo_lockmongo_mem -> /usr/share/munin/plugins/mongo_memmongo_ops -> /usr/share/munin/plugins/mongo_ops -
我现在编辑了我的问题,插件处于活动状态,但 python 错误仍然存在。
-
据我所知,不是mongo连接导致了问题。您不应该直接运行插件,但它们是通过 munin-node 调用的。启动那个,通过 telnet 从 localhost 连接到它,并显示
listcommand 的输出。 -
感谢您的回答,但如果我运行 munin 的插件:
$ munin-run mongo_conn我会收到完全相同的错误消息。
标签: python mongodb monitoring munin