Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-26019

Error in template "HashiCorp Vault by HTTP"

XMLWordPrintable

    • Icon: Problem report Problem report
    • Resolution: Unresolved
    • Icon: Trivial Trivial
    • None
    • None
    • Templates (T)
    • None
    • Support backlog

      Hello,
      Looks like there is error in Vault template,
      In default template from git.zabbix.com, item "Get metrics" does have this URL:

      {$VAULT.API.SCHEME}://\{$VAULT.HOST}:\{$VAULT.API.PORT}/v1/sys/metrics?format=prometheus
      

      Due to that, item gets example value like this one:

      # HELP vault_seal_decrypt_time vault_seal_decrypt_time
      # TYPE vault_seal_decrypt_time summary
      vault_seal_decrypt_time\{seal_wrapper_name="shamir",quantile="0.5"} NaN
      vault_seal_decrypt_time\{seal_wrapper_name="shamir",quantile="0.9"} NaN
      vault_seal_decrypt_time\{seal_wrapper_name="shamir",quantile="0.99"} NaN
      vault_seal_decrypt_time_sum\{seal_wrapper_name="shamir"} 0.03411500155925751
      vault_seal_decrypt_time_count\{seal_wrapper_name="shamir"} 1
      # HELP vault_token_lookup vault_token_lookup
      # TYPE vault_token_lookup summary
      vault_token_lookup\{quantile="0.5"} 0.13425299525260925
      vault_token_lookup\{quantile="0.9"} 0.15281400084495544
      vault_token_lookup\{quantile="0.99"} 0.15281400084495544
      vault_token_lookup_sum 1.9230029806494713
      vault_token_lookup_count 15
      

      So as we can see, it's prometheus output, not JSON,
      If we would delete part "?format=prometheus" from URL, we would get JSON:

      {"Timestamp":"2025-02-07 08:02:20 +0000 UTC","Gauges":[\{"Name":"vault.core.active","Value":1,"Labels":{"cluster":"vault-cluster-7a2b46b0"}},\{"Name":"vault.core.in_flight_requests","Value":0,"Labels":{"cluster":"vault-cluster-7a2b46b0"}},\{"Name":"vault.core.mount_table.num_entries","Value":1,"Labels":{"cluster":"vault-cluster-7a2b46b0","local":"false","type":"auth"}},\{"Name":"vault.core.mount_table.num_entries","Value":2,"Labels":{"cluster":"vault-cluster-7a2b46b0","local":"false","type":"logical"}},\{"Name":"vault.core.mount_table.num_entries","Value":1,"Labels":{"cluster":"vault-cluster-7a2b46b0","local":"true","type":"logical"}},\{"Name":"vault.core.mount_table.size","Value":250,"Labels":{"cluster":"vault-cluster-7a2b46b0","local":"false","type":"auth"}},\{"Name":"vault.core.mount_table.size","Value":449,"Labels":{"cluster":"vault-cluster-7a2b46b0","local":"false","type":"logical"}},\{"Name":"vault.core.mount_table.size","Value":301,"Labels":{"cluster":"vault-cluster-7a2b46b0","local":"true","type":"logical"}},\{"Name":"vault.core.performance_standby","Value":0,"Labels":{"cluster":"vault-cluster-7a2b46b0"}},\{"Name":"vault.core.replication.build_progress","Value":0,"Labels":{"cluster":"vault-cluster-7a2b46b0"}},\{"Name":"vault.core.replication.build_total","Value":0,"Labels":{"cluster":"vault-cluster-7a2b46b0"}},\{"Name":"vault.core.replication.dr.primary","Value":0,"Labels":{"cluster":"vault-cluster-7a2b46b0"}},\{"Name":"vault.core.replication.dr.secondary","Value":0,"Labels":{"cluster":"vault-cluster-7a2b46b0"}},
      

      https://developer.hashicorp.com/vault/api-docs/system/metrics

      It's important due to dependent items,
      This is then later used by dependent item "Clear metrics"
      This item have this preprocessing set:

      "Check for error in JSON" with parameter "$.errors",
      [https://git.zabbix.com/projects/ZBX/repos/zabbix/browse/templates/app/vault_http/template_app_vault_http.yaml?at=refs%2Fheads%2Frelease%2F7.2#160]
      

      By default, Vault template gets prometheus value, in a result this dependent item will never work - it would start working if master item will get JSON, not prometheus,

            drasikhov Denis Rasikhov
            tgrzechulski Tomasz Grzechulski
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: