Extract csv report for information on content-hosts registered with Red Hat Satellite 6.

Solution Verified - Updated -


  • Red Hat Satellite 6.2.x
  • Red Hat Satellite 6.6


  • Steps to extract a csv report containing information about the registered content-hosts with Red Hat Satellite 6.


Steps to follow till satellite 6.5:

  • Install the tfm-rubygem-hammer_cli_csv.noarch package on the Red Hat Satellite server (Provided by the Red Hat Satellite repository).
# sudo yum install tfm-rubygem-hammer_cli_csv.noarch
  • Run the hammer command to create a csv report.
# hammer csv content-hosts --export --file /tmp/reports.csv
# hammer -u <<username>> -p <<password>> csv content-hosts  --export --file content-hosts-export.csv --itemized-subscriptions --verbose --organization <<organization name>>

where, the /tmp/reports.csv is the report file which gets generated after running the above command.

  • The above command will provide information for all the registered content-hosts about the below parameters:

Name,Count,Organization,Environment,Content View,Host Collections,Virtual,Host,OS,Arch,Sockets,RAM,Cores,SLA,Products,Subscriptions

  • For Satellite 6.6
# hammer --csv --csv-separator ';' host list > content-hosts.csv

Login to satellite web ui --> Hosts --> Content Hosts --> Click on Export on the top right of the page.

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.


Be advised: "Package rubygem-hammer_cli_csv- is obsoleted by tfm-rubygem-hammer_cli_csv- which is already installed".

also, Warning: Option --csv-export is deprecated. Use --export Warning: Option --csv-file is deprecated. Use --file

Let me know how to download the same kind for report for list of clients under Host Collection:

Most commands, including hammer csv can have their output limited using the --search option. In your example, if you had a host collection named Production, you can do an export of just those systems using the following command

hammer csv content-hosts \
  --export --file /tmp/reports.csv \
  --search "host_collection = Production"

Hey Rich:

Is there a way to just return the hosts associated with a specific activation key? Or perhaps contract id?

--search "(contract = XXXXXXXX)"

That's giving me a Error: 400 Bad Request

Activation key is simple

hammer host list --search "activation_key = ak-Reg_To_Crash"
ID  | NAME                   | OPERATING SYSTEM | HOST GROUP | IP              | MAC              
305 | ama-1.example.com      | RedHat 7.2       | Crash      | | 52:54:00:22:da:07
308 | boot.example.com       | RedHat 7.1       | Crash      | | 52:54:00:35:62:bf
2   | crash-0001.example.com | RedHat 7.2       | Crash      | | 52:54:00:62:3c:be
3   | crash-0002.example.com | RedHat 7.2       | Crash      | | 52:54:00:2c:4e:9c

You can't easily search for contract unless you use the hammer csv output and then grep or provide a --search option to that command.

If wanted to capture the facts (custom facts) output for a host in csv format

# hammer host list
# hammer --csv fact list --search "host=<host_fdqn>"  > /tmp/abc.csv

For passwordless hammer login

Is there a way to have hammer also report the release for a content host as Satellite sees it?

That is not possible. Per hammer help:

hammer> csv content-hosts --help
     csv content-hosts [OPTIONS]

 Name - Name of resource
 Search - Search for matching names during import (overrides 'Name' column)
 Organization - Organization name
 Environment - Lifecycle environment name
 Content View - Content view name
 Host Collections - Comma separated list of host collection names
 Virtual - Is a virtual host, Yes or No
 Guest of Host - Hypervisor host name for virtual hosts
 OS - Operating system
 Arch - Architecture
 Sockets - Number of sockets
 RAM - Quantity of RAM in bytes
 Cores - Number of cores
 SLA - Service Level Agreement value
 Products - Comma separated list of products, each of the format "<sku>|<name>"
 Subscriptions - Comma separated list of subscriptions, each of the format "<quantity>|<sku>|<name>|<contract>|<account>"
 Subscription Name - Subscription name (only applicable for --itemized-subscriptions)
 Subscription Type - Subscription type (only applicable for --itemized-subscriptions)
 Subscription Quantity - Subscription quantity (only applicable for --itemized-subscriptions)
 Subscription SKU - Subscription SKU (only applicable for --itemized-subscriptions)
 Subscription Contract - Subscription contract number (only applicable for --itemized-subscriptions)
 Subscription Account - Subscription account number (only applicable for --itemized-subscriptions)
 Subscription Start - Subscription start date (only applicable for --itemized-subscriptions)
 Subscription End - Subscription end date (only applicable for --itemized-subscriptions)

Is it possible to get an output which content-host used which subscription in Satellite 6.6? Like "hammer csv --export --itemized-subscriptions … " in Satellite 6.5

Satellite 6.6 : When I click on Content Hosts --> Export I get output as follows which is perfect for manager reporting:

Name ; Subscription Status ; Installable Updates - Security ; Installable Updates - Bug Fixes ; Installable Updates - Enhancements ; Installable Updates - Package Count ; OS ; Environment ; Content View

dfwlxinfra03.levi.com Fully entitled 0 0 0 0 RedHat 7.7 non-prod rhel7

I don't get same output using hammer as resolution suggests . I am needing the quantities of patches that need to be applied. Haven't found right combination in hammer yet to get same report. This does not provide same information:

hammer --csv --csv-separator ';' host list

Id;Name;Operating System;Host Group;IP;MAC;Global Status;Content View;Lifecycle Environment 601;brulxbftreep01.levi.com;RedHat 7.6;;;00:50:56:82:57:20;Error;rhel7;prod 558;brulxorad02.levi.com;RedHat 7.6;;;00:50:56:82:f8:41;Error;rhel7;non-prod 579;brulxorad03.levi.com;RedHat 7.6;;;00:50:56:82:e8:90;Error;rhel7;non-prod

Hello Rich,

The "hammer host list" command won't give you that desired output on Satellite 6.6 related to installable errata.

Please use the report template "Applicable errata" to extract the same information from Satellite. --> Monitor --> Report Templates --> Applicable errata

It's faster as it will collect the data from database directly and you will have an option to filter the report by either hostname or ERRATA ID.

I hope that helps.

Thanks & Regards, Sayan

Thanks. I have been trying to get report configured from that template. I am looking for summary number, not detail information. The answer is in their somewhere, I will find it.

Hello Rich,

Please open up a support case with RedHat and mention the exact requirements you have in the same. Redhat might be able to provide some alternate and quick solutions for you as well depending upon what kind of report or data you need.

Meanwhile, the workaround posted below might not be that pretty but still will do the trick for you.

# cat custom_info.rb 
require 'csv'

file = "/tmp/host_data.csv"
hosts = Host.order(:id)

column_headers = ["Organization", "Host ID", "Host Name", "Operating System", "Kernel", "Installable Errata", "Subscription","Content View","Environment"]

CSV.open(file, 'w', write_headers: true, headers: column_headers) do |writer|
  hosts.each do |h|
    writer << [h.organization, h.id, h.name, h.os.try(:title), h.facts['uname::release'], h.content_facet_attributes.try(:errata_counts), h.subscription_names, h.content_view.try(:name), h.lifecycle_environment.try(:name)]

# foreman-rake console < custom_info.rb

# less /tmp/host_data.csv

But I still will strongly recommend using the report templates and get in touch with Redhat support to explore the possibilities around the same.