github peekjef72/httpapi_exporter v0.4.1
0.4.1 / 2025-06-04

3 months ago
  • added: new contrib apache_exporter configuration. a good example to introduce javascript code to build metrics.

2025-05-25 - not release

  • added: support for env vars in target_config see issue #1 :

e.g.:

targets:
  - name: my_target
    scheme: https
    host: $env:MY_HOST_ENV_VAR_NAME
    port: 443

2025-05-16 - not release

  • changed: internal "scope" directive: add error and debug msg.
  • added: new parameter 'collector' to '/metrics' entry point. Collect only the specified collector(s). May be use to collect specific metrics in a particular prometheus job.

2025-05-07 - not release

BREAKING CHANGE

  • renamed: variable results_code to status_code
    => update all config profiles !
  • changed: in log line renamed 'collid' to 'coll' and use collector name instead of a sequential number.

2025-05-06 - not release

  • added: support for javascript code in each field, as an alternative to gotemplate. This part is still in development (see examples)

  • added: new metric named "query_status" (prefixed by metric_prefix) and labeled by url query stage. The goal is to provide a always generated value for each queried url with the http status code as value. The generation is conditionned by the status attribute from each query action and the default value is false.

  - name: check api url
    query:
      url: /api/health
      method: GET
      status: true
      trace: true

will provide:

# HELP xxx_query_status query http status label by phase(url): http return code
# TYPE xxx_query_status gauge
xxx_query_status{phase="/api/health"} 200
# HELP xxx_query_perf_seconds query stage duration in seconds
# TYPE xxx_query_perf_seconds gauge
xxx_query_perf_seconds{page="/status",stage="conn_time"} 0.004550086
xxx_query_perf_seconds{page="/status",stage="dns_lookup"} 4.3538e-05
xxx_query_perf_seconds{page="/status",stage="response_time"} 4.5354e-05
xxx_query_perf_seconds{page="/status",stage="server_time"} 0.000361965
xxx_query_perf_seconds{page="/status",stage="tcp_con_time"} 0.000111871
xxx_query_perf_seconds{page="/status",stage="tls_handshake"} 0.004329272
xxx_query_perf_seconds{page="/status",stage="total_time"} 0.004912388

If the request timeouts, the status code is 504.
If the request is not perfomed (target is down), the status code is 0.

2025-03-26 - not release

  • added: global config parameter tls_version that allows to add old tls ciphers, because of golang change since 1.22: see config; update the netscaler default config file to use tls_version: all
  • code refactored to use cast for type conversion in internal functions.
  • added: scripting language evolution to allow named var into expr : $var_name.${another_varname[.attr1]}[.attr2]
  • changed: loglevel trace from warn to debug for metrics not found:

e.g.:

  - metric_name: system_nodes_total
    help: total nodes in system
    type: gauge
    values:
      _: $totalNodes

If $totalNodes is not found, now won't be logged at warn level.

The same behavior is implemented for variables used in loop or with_items action.

BREAKING CHANGE

  • remove feature that allows to set a single text not preceded by $ sign as value for key_labels or values:
    - name: collect disks
      scope: results
      metrics:

        - metric_name: disk_status
          help: "physical disk status: 0: normal - 1: degraded - 2: New - 4: Failed - 99: Unknown"
          type: gauge
          key_labels:
            model: _
            serial: serialNumber # NOW FORBIDDEN
            position: cage-{{ .position.cage | default "undef" }}/Port-{{ .position.slot | default "undef" }}/diskPos-{{ .position.diskPos | default "undef" }}
            capacity: mfgCapacityGB # NOW FORBIDDEN
          values:
            _ : state # NOW FORBIDDEN
          loop: members # NOW FORBIDDEN

and is replaced by:

- name: collect disks
  scope: results
  metrics:
    - metric_name: disk_status
      help: "physical disk status: 0: normal - 1: degraded - 2: New - 4: Failed - 99: Unknown"
      type: gauge
      key_labels:
        model: _
        serial: $serialNumber
        position: cage-{{ .position.cage | default "undef" }}/Port-{{ .position.slot | default "undef" }}/diskPos-{{ .position.diskPos | default "undef" }}
        capacity: $mfgCapacityGB
      values:
        _ : $state
      loop: $members

2025-03-23 - not release

  • add trace infos for queries: the query action can now be set to enable traces collecting (disable by default), so that metrics can be created using that infos.

e.g.:

scripts:
  check_status:
    - name: get status page
      query:
        url: /status
        var_name: results
        # debug: true
        parser: text-lines
        trace: true

    # $results content
    # => text/plain
    #   STATUS:OK
    - name: debug virtualbrowser_status
      # get fist line, converted to string, regexpExtract group 1
      # {{ exporterRegexExtract "^STATUS:\\s*(.+)$" (toString (index .results 0)) }}
      set_fact:
        status: >
          {{- index (exporterRegexExtract "^STATUS:\\s*(.+)$" (toString (index .results 0) ) ) 1 -}}

    - name: proceed elements
      scope: none
      metrics:
        - metric_name: access_status
          help: "status value returned by /status url: 1:OK - 0: KO"
          type: gauge
          values:
            _: '{{ if EQ .status "OK" }}1{{ else }}0{{ end }}'
        - metric_name: query_perf_seconds
          help: "query stage duration in seconds"
          type: gauge
          key_labels:
            stage: $item
            page: status
          values:
            _: $trace_infos.${item}
          with_items: '{{ exporterKeys .trace_infos | toRawJson }}'

then:

# HELP query_perf_seconds query stage duration in seconds
# TYPE query_perf_seconds gauge
query_perf_seconds{page="status",stage="dns_lookup"} 0.00123
query_perf_seconds{page="status",stage="conn_time"} 0.00123
query_perf_seconds{page="status",stage="tcp_con_time"} 0.00123
query_perf_seconds{page="status",stage="tls_handshake"} 0.00123
query_perf_seconds{page="status",stage="server_time"} 0.00123
query_perf_seconds{page="status",stage="response_time"} 0.00123
query_perf_seconds{page="status",stage="total_time"} 0.00123

Don't miss a new httpapi_exporter release

NewReleases is sending notifications on new releases.