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

"icinga2 object list -t Host" misses host groups #10348

Open
oxzi opened this issue Feb 13, 2025 · 2 comments
Open

"icinga2 object list -t Host" misses host groups #10348

oxzi opened this issue Feb 13, 2025 · 2 comments

Comments

@oxzi
Copy link
Member

oxzi commented Feb 13, 2025

Describe the bug

Starting with an Icinga 2 setup with hosts and these hosts being part of host groups. When querying these hosts via icinga2 object list -t Host, no groups are being listed.

$ icinga2 object list -t Host | grep groups
  * groups = [ ]
  * groups = [ ]
  * groups = [ ]
[ . . . ]

However, this information is available when using the Icinga 2 API.

curl -k -s -S -u "icingadb-web:$ICINGA2_API_PASSWORD" -H 'Accept: application/json' 'https://localhost:5665/v1/objects/hosts?pretty=1' | grep -A 1 'groups": \[$'
                "groups": [
                    "openbsd-servers"
--
                "groups": [
                    "openbsd-servers"
--
                "groups": [
                    "linux-servers"

[ . . . ]

To Reproduce

Create one or multiple Host objects, place these in HostGroups, execute the commands from above.

Expected behavior

I would expect the groups to be part of the icinga2 object list output.

Screenshots

N/A

Your Environment

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

  • Version used (icinga2 --version): r2.14.5-1

Additional context

N/A

@yhabteab
Copy link
Member

Create one or multiple Host objects, place these in HostGroups, execute the commands from above.

This works fine for me:

~/Workspace/icinga2 (master ✗) icinga2 object list -t Host --name icinga2
Object 'icinga2' of type 'Host':
  % declared in '/Users/yhabteab/Workspace/icinga2/prefix/etc/icinga2/conf.d/hosts.conf', lines 22:1-22:21
  * __name = "icinga2"
...
  * groups = [ "groot" ]
    % = modified in '/Users/yhabteab/Workspace/icinga2/prefix/etc/icinga2/conf.d/hosts.conf', lines 30:3-30:22

API created host:

~/Workspace/icinga2 (master ✗) icinga2 daemon -C --dump-objects
~/Workspace/icinga2 (master ✗) icinga2 object list -t Host --name icinga2
Object 'icinga2' of type 'Host':
  % declared in '/Users/yhabteab/Workspace/icinga2/prefix/var/lib/icinga2/api/packages/_api/96a0468e-9e30-46f3-b5f1-8696393d1d01/conf.d/hosts/icinga2.conf', lines 1:0-1:20
  * __name = "icinga2"
....
  * groups = [ "groot" ]
    % = modified in '/Users/yhabteab/Workspace/icinga2/prefix/var/lib/icinga2/api/packages/_api/96a0468e-9e30-46f3-b5f1-8696393d1d01/conf.d/hosts/icinga2.conf', lines 4:2-4:21

@yhabteab
Copy link
Member

Ah, host groups with assign where host.name ... don't show up!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants