How to find the subscription consumption via Satellite CLI?
Environment
- Red Hat Satellite v.6
- Hammer
- RestAPI
Issue
- How to list Subscriptions consumed by Content Host?
- How to use the hammer CLI to show which content hosts are using which subscriptions?
- How to list the hosts using a particular subscription?
Resolution
- On Satellite server v 6.1:
# hammer subscription list --content-host=client.example.com --organization-id <id>
NOTE: Above output would list subscription information for a single host system,
- On Satellite server v 6.2:
# hammer organization list
# hammer subscription list --host=client.example.com --organization-id <ORG_ID>
- The above command will list for only a single host system, for a group of hosts, we can use the for loop command.
# for name in $(cat /tmp/host_list) ; do hammer subscription list --host $name --organization-id <ORG_ID> ; done
- To list the hosts which are using a particular subscription the below API call can be used.
# hammer subscription list --organization-id <ORG_ID> ## Note down the Subscription ID for the subscription.
# curl -k -u admin -X GET https://satellite.example.com/katello/api/subscriptions/<id> | json_reformat
NOTE:
-
Replace the <ORG_ID> with the actual values.
-
In the API output, you can look at the systems section for the subscribed hosts.
-
On Satellite Server v 6.3 and above:
# hammer subscription list --organization-id <ORG_ID>
# hammer host list --search 'subscription_name = "Red Hat Enterprise Linux for Virtual Datacenters with Smart Management, Standard"'
NOTE: Replace the subscription name in the above command, to find Hosts that are consuming that particular subscription.
For more KB articles/solutions related to Red Hat Satellite 6.x hammer Issues, please refer to the Consolidated Troubleshooting Article for Red Hat Satellite 6.x hammer-related Issues
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.