osism / issues

This repository is used for bug reports that are cross-project or not bound to a specific repository (or to an unknown repository).
https://www.osism.tech
1 stars 1 forks source link

openstack-exporter still <nil> values in nova_server_status #1018

Open mario-minners opened 4 months ago

mario-minners commented 4 months ago

Hi,

The openstack exporter container is started with OS_COMPUTE_API_VERSION=latest, this is not allowed.

❯ OS_COMPUTE_API_VERSION=latest openstack server list
Invalid format of client version 'latest'. Expected format 'X.Y', where X is a major part and Y is a minor part of version.

This breaks the fixes rolled out with Version 1.7

Ref: https://github.com/openstack-exporter/openstack-exporter/pull/308

mario-minners commented 4 months ago

This should work instead.

❯ OS_COMPUTE_API_VERSION=2.latest openstack server list -vvv 2>&1 | grep "API version"
compute API version 2.latest, cmd group openstack.compute.v2
identity API version 3, cmd group openstack.identity.v3
image API version 2, cmd group openstack.image.v2
network API version 2, cmd group openstack.network.v2
object_store API version 1, cmd group openstack.object_store.v1
volume API version 3, cmd group openstack.volume.v3
dns API version 2, cmd group openstack.dns.v2
neutronclient API version 2, cmd group openstack.neutronclient.v2
load_balancer API version 2.0, cmd group openstack.load_balancer.v2
orchestration API version 1, cmd group openstack.orchestration.v1
berendt commented 4 months ago

OS_COMPUTE_API_VERSION set via kolla-ansible:

dragon@testbed-manager:~$ docker inspect prometheus_openstack_exporter | grep OS_COMPUTE_API_VERSION
                "OS_COMPUTE_API_VERSION=latest",

Defaults in kolla-ansible:

  prometheus-openstack-exporter:
    container_name: "prometheus_openstack_exporter"
    group: "prometheus-openstack-exporter"
    enabled: "{{ enable_prometheus_openstack_exporter | bool }}"
    environment:
      OS_COMPUTE_API_VERSION: "{{ prometheus_openstack_exporter_compute_api_version }}"
    image: "{{ prometheus_openstack_exporter_image_full }}"
    volumes: "{{ prometheus_openstack_exporter_default_volumes + prometheus_openstack_exporter_extra_volumes }}"
    dimensions: "{{ prometheus_openstack_exporter_dimensions }}"
    haproxy:
      prometheus_openstack_exporter:
        enabled: "{{ enable_prometheus_openstack_exporter | bool }}"
        mode: "http"
        external: false
        port: "{{ prometheus_openstack_exporter_port }}"
        backend_http_extra:
          - "timeout server {{ prometheus_openstack_exporter_timeout }}"
      prometheus_openstack_exporter_external:
        enabled: "{{ enable_prometheus_openstack_exporter_external | bool }}"
        mode: "http"
        external: true
        port: "{{ prometheus_openstack_exporter_port }}"
        backend_http_extra:
          - "timeout server {{ prometheus_openstack_exporter_timeout }}"

Default value:

prometheus_openstack_exporter_compute_api_version: "latest"

Workaround:

Set prometheus_openstack_exporter_compute_api_version in environments/kolla/configuration.yml to set a good version. I will prepare a fix for the wrong default on Friday.

mario-minners commented 4 months ago

don't change the default yet

with gopherclient this results in an error

ts=2024-05-10T15:41:34.970Z caller=exporter.go:126 level=error err="Failed to collect metric for exporter" exporter=nova error="failed to collect metric: running_vms, error: Bad request with: [GET https://.../v2.1/os-hypervisors/detail], error message: {\"badRequest\": {\"code\": 400, \"message\": \"API Version String 2.latest is of invalid format. Must be of format MajorNum.MinorNum.\"}}"

mario-minners commented 4 months ago

Ok it seems, that the gopherclient fallback to the default OS_COMPUTE_API_VERSION without comment. If some set the prometheus_openstack_exporter_compute_api_version to an explicit version like 2.95 it will replace the nils with the correct values.

mario-minners commented 4 months ago

s/gopherclient/gophercloud/g