【问题标题】:Can monit test for a response from a node API call?可以监控节点 API 调用的响应吗?
【发布时间】:2018-10-04 15:48:11
【问题描述】:

我有一个node API 存在无法修复的严重代码质量问题——因为管理人员——所以请求经常停止回答但节点进程仍在运行

我使用upstart 将节点作为服务运行,monit 使其保持运行。我很简单的monitrc 只是在寻找正在运行的节点进程的PID,所以它没有检测到这个需要重新启动的“僵尸”节点进程。我的好主意是编写一个简单的 API 方法来响应“OK”,并在查找节点 PID 的同时监控该请求。这可能吗?有没有更好的办法?

“monit”和“node`”的 Google-ing 组合让我看到了关于远程性能监控节点应用程序的冗长博客文章。

【问题讨论】:

    标签: node.js api monit


    【解决方案1】:

    您可以简单地触发GET 请求并使用connection tests 检查其答案:

        if failed
            host 127.0.0.1
            port 80
            protocol http
            request "/"
            content = "foobar"
        then restart
    

    或其状态

        if failed
            host 127.0.0.1
            port 80
            protocol http
            request "/fooBarApi"
            status = 200
        then restart
    

    我真的推荐阅读the manual - monit 有一些你可能没想到的很棒的功能;)

    【讨论】:

      猜你喜欢
      • 2017-04-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-01-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多