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

Solution Verified - Updated -


  • Red Hat Satellite 6


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


Steps to follow on Satellite 6.6 or newer

# 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.

Steps to follow on Satellite 6.5 or older

  • 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

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.

hammer csv Error: No such sub-command 'csv'.

Looks as if this is no longer active. Is there an update to this command? Also why can't I do this via the GUI in Host Collections??

Figured out what I needed:

hammer --csv host-collection hosts --id 6 > report.csv

Still wish I could do this via the GUI for Host Collections.

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.

How to get rid of the ESX hosts from the CSV - "virt-who-xxxxxx.example.com" ?


You can use something like below with the hammer command.

 hammer --csv host list --search "hypervisor =  false"

Thanks. I used similar kind of option in the hammer command but this one looks to be the best to filter the hypervisor hosts.

Yup. I am glad that it helped.. This one will cleanly filter out all the hosts which are marked as a hypervisor in the satellite's DB, so you will only get the list of content hosts.

Up to Satellite 6.5 we used: hammer csv content-hosts --export --file /root/adminbatch/content-hosts-export.csv --itemized-subscriptions --verbose --organization ... which deliver results for columns: Name Organization Environment Content View Host Collections Virtual Guest of Host OS Arch Sockets RAM Cores SLA Products Subscription Name Subscription Type Subscription Quantity Subscription SKU Subscription Contract Subscription Account Subscription Start Subscription End Subscription Guest

The solution for Satellite 6.6 delivers the following: 1. Login to satellite Web UI --> Hosts --> Content Hosts --> Click on Export on the top right of the page resulting columns: Name Subscription Status Installable Updates - Security Installable Updates - Bug Fixes Installable Updates - Enhancements Installable Updates - Package Count OS Environment Content View Registered Last Checkin

  1. hammer --csv --csv-separator ';' host list > content-hosts.csv resulting columns: Id Name Operating System Host Group IP MAC Global Status Content View Lifecycle Environment

After our upgade to Satellite 6.6 we have no possibilty to generate Subscription Report with same informations that delivers hammer csv content-hosts .. comand. Thats annoying.

Hello Reiner,

You still should be able to get that by following the initial steps from the article 4671341.

i.e. You have to download and install this rpm tfm-rubygem-hammer_cli_csv-2.3.1-3.el7sat.noarch.rpm manually on Satellite 6.6 or 6.7.

If you are specifically looking for the entitlement report, then please upgrade your satellite to 6.7 and you should have a report template already available that provides similar information as hammer csv content-hosts.

Hello Sayan, thanks for for your hint to article 4671341. After download and install, our CSV Report works as before (up to Satellite 6.5). It save a lot of work. Regards, Reiner

Hello Reiner,

I am glad that it helped.

I found it

hammer host list --search 'os_title = "RedHat 5.11"'

Hint: in this case, it's the same field name as if you were using the GUI.

What is the search filter that gets me operatingsystem_name? e.g.

RHEL Server 7.6


I used the command below to have the report content hostname and the IP address.

"hammer --csv --csv-separator ';' host list > content-hosts.csv"

But, there are many hosts not listed the IP address while it's already registered in UI front of "IPv4 Address"