【问题标题】:Prometheus Monitoring End-Point SOAP APIPrometheus 监控端点 SOAP API
【发布时间】:2020-11-08 01:01:36
【问题描述】:

我正在尝试使用 prometheus 进行探索,而无需在目标服务器中安装导出器(在 Prometheus 服务器之外)

所以这个想法是 Prometheus 将监视某个应用程序的 SOAP API,其中需要在请求参数中传递一些有效负载。

据我了解,prometheus 抓取以下细节如下

promhttp_metric_handler_requests_total{code="200"} 7096
promhttp_metric_handler_requests_total{code="500"} 0
promhttp_metric_handler_requests_total{code="503"} 0

我有什么方法可以监控该特定 API 的运行状况。 我希望监控来自 API 的响应代码及其延迟。

寻找想法和建议

【问题讨论】:

    标签: prometheus prometheus-blackbox-exporter


    【解决方案1】:

    Prometheus 本身只理解它的自定义展示格式。

    如果您使用的是 Java,则可以添加一个 JAX-RS 过滤器,该过滤器将跟踪所有公开的端点并以特定格式将指标返回给 Prometheus。

    这将需要更改代码,但它相当小,不需要额外的导出器。

    这是一个示例库:https://github.com/ClearPointNZ/connect-java/tree/master/libraries/prometheus-jersey-filter

    其他语言可能会有类似的解决方案。

    但 Prometheus 无法直接调用您的端点并对其进行监控。

    【讨论】:

    • 不改代码有什么努力吗?我正在考虑利用 Go Lang 来监控 API 并让 prometheus 从服务中抓取
    • 我不知道。您可以创建一个探测服务,它会不断地访问您的服务并以 Prometheus 可以理解的格式公开指标。所以 Prometheus --> Prober --> API。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-02-02
    • 1970-01-01
    • 1970-01-01
    • 2017-10-29
    • 2016-05-29
    • 2020-08-09
    • 1970-01-01
    相关资源
    最近更新 更多