Ad Widget

Collapse

Querying metrics exposed in the Prometheus

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Birl
    Junior Member
    • Jan 2021
    • 6

    #1

    Querying metrics exposed in the Prometheus

    Reading https://www.zabbix.com/documentation/5.2/manual/config/items/itemtypes/prometheus.

    I create the "HTTP agent item". I use the wizard to create a dependent item.
    Click image for larger version  Name:	prometheus_problem_01.png Views:	16 Size:	17.2 KB ID:	418026

    After choosing the "preprocessing" sub-tab, I pick "Prometheus pattern" and add a parameter.

    Click image for larger version  Name:	prometheus_problem_02.png Views:	10 Size:	11.1 KB ID:	418027

    The documentation seems to suggest that I can put in a pattern that would exist from Prometheus' /metrics page. I picked promhttp_metric_handler_requests_total{code=".*"} because there's 3 of them:

    # TYPE promhttp_metric_handler_requests_total counter
    promhttp_metric_handler_requests_total{code="200"} 1128
    promhttp_metric_handler_requests_total{code="500"} 0
    promhttp_metric_handler_requests_total{code="503"} 0
    However, trying to add it fails:

    Click image for larger version  Name:	prometheus_problem_03.png Views:	11 Size:	27.6 KB ID:	418028

    That error message is rather confusing: Where's "name" and "key"
    are they 2nd and 3rd fields I filled in here?
    Or is promhttp_metric_handler_requests_total the key and the name {code=".*"}?
    Or is code the key and ".*" the name?
    And then, what defines "empty"?

    Last edited by Birl; 05-02-2021, 15:56. Reason: added tags
  • Birl
    Junior Member
    • Jan 2021
    • 6

    #2
    The answer:

    Click image for larger version

Name:	prometheus_solution_01.png
Views:	518
Size:	13.1 KB
ID:	418454

    I was not aware that the required fields under the "Item" sub-tab still needed to be filled in. I, incorrectly, assumed that "Preprocessing" sub-tab took care (or negated) the "Item" fields.

    Comment

    Working...