Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid field specified errors while trying to use custom vars in v/objects/hosts API #10246

Open
wp-perc opened this issue Nov 19, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@wp-perc
Copy link

wp-perc commented Nov 19, 2024

Describe the bug

While requesting host objects to Icinga2 API using the v1/objects/hosts endpoint , it is not possible to limit returned attributes to a specific custom variable.

Here the call that produces the error:

curl -k -X GET -u '<USERNAME>:<PASSWORD>' 'https://127.0.0.1:5665/v1/objects/hosts?pretty=1&attrs=vars.host_os'
{
    "error": 400,
    "status": "Invalid field specified: vars.host_os"
}

If I just restrict output to the whole vars dictionary ( attrs=vars ), the API call works fine, but the output contains all the custom variables, and this is not what I want.

Expected behavior

Other APIs can successfully address a single custom variable (see as example https://icinga.com/docs/icinga-2/latest/doc/12-icinga2-api/#creating-config-objects), so I am expecting to be able to select which custom variables include in the output.

If this is the intended behavior, documentation is not clear about it.

Your Environment

Include as many relevant details about the environment you experienced the problem in

# icinga2 --version
icinga2 - The Icinga 2 network monitoring daemon (version: r2.14.2-1)

Copyright (c) 2012-2024 Icinga GmbH (https://icinga.com/)
License GPLv2+: GNU GPL version 2 or later <https://gnu.org/licenses/gpl2.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

System information:
  Platform: Red Hat Enterprise Linux
  Platform version: 8.10 (Ootpa)
  Kernel: Linux
  Kernel version: 4.18.0-553.22.1.el8_10.x86_64
  Architecture: x86_64

Build information:
  Compiler: GNU 8.5.0
  Build host: staging7681master
  OpenSSL version: OpenSSL 1.1.1k  FIPS 25 Mar 2021
  • Enabled features (icinga2 feature list): api checker ido-mysql mainlog notification
@Al2Klimov Al2Klimov added the enhancement New feature or request label Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants