Icinga / Icinga/icinga2

"icinga2 object list -t Host" misses assign-where host groups

Open
#10,348 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
2.2k
Forks
616
Avg merge
5d 6h
Merged PRs (30d)
10

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing icinga2 object list -t Host with the API request shown for /v1/objects/hosts, focusing on how host groups are represented. Trace the object-list entry point and its Host output, then verify that hosts assigned to groups display those groups and that the existing command still works for hosts without groups.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
api, cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.