首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Monit对mongo http主机检查产生假阴性。

Monit对mongo http主机检查产生假阴性。
EN

Server Fault用户
提问于 2019-03-01 08:16:58
回答 1查看 513关注 0票数 0

我正在尝试创建一个monit配置文件来监视mongodb是否正在运行。

这是我的配置文件。

代码语言:javascript
复制
check process mongod with pidfile /var/run/mongodb/mongod.pid
   group mongodb
   start program = "/sbin/start mongod"
   stop  program = "/sbin/stop mongod"
   if failed host 127.0.0.1 port 27017 protocol http
     and request "/" with timeout 10 seconds then restart
代码语言:javascript
复制
  port response time           FAILED to [localhost]:27017 type TCP/IP protocol HTTP

我检查并验证了mongodb的运行情况。事件尝试使用curl连接到mongodb。下面是我执行的用于验证到mongo的http连接的命令。

代码语言:javascript
复制
curl -v localhost:27017

这是我得到的输出。

代码语言:javascript
复制
* Rebuilt URL to: localhost:27017/
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 27017 (#0)
> GET / HTTP/1.1
> Host: localhost:27017
> User-Agent: curl/7.58.0
> Accept: */*
>
* HTTP 1.0, assume close after body
< HTTP/1.0 200 OK
< Connection: close
< Content-Type: text/plain
< Content-Length: 85
<
It looks like you are trying to access MongoDB over HTTP on the native driver port.
* Closing connection 0

不知道我做错了什么。

相同的配置文件在ubuntu14.4上工作,但它不能运行ubuntu18.4。

EN

回答 1

Server Fault用户

发布于 2019-05-04 02:42:52

由于某种原因,我对MongoDB在CentOS 6.10上的反应是错误的。

用新协议检查修正,在Monit中实现

代码语言:javascript
复制
  if failed host 127.0.0.1 port 27017 protocol mongodb
     then restart

注意新协议名mongodb

这样做很好

票数 0
EN
页面原文内容由Server Fault提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://serverfault.com/questions/956284

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档