Satellite 6.5 Reporting Engine: What and Why
Red Hat Satellite is a system management solution that makes it easy to deploy, scale, and manage your Red Hat infrastructure in physical, virtual, and cloud environments. Satellite allows users to tune and update systems to ensure their efficient, safe operation in accordance with various standards. By automating most of the tasks associated with maintaining the system’s performance, Satellite helps organizations increase efficiency, reduce operating costs, and more readily respond to strategic business requests.

Although you can perform basic administrative tasks using the Red Hat services included with your Red Hat Enterprise Linux subscription, Red Hat Satellite adds extensive lifecycle management capabilities.
Among these features are:
From a single console, you can manage thousands of systems as easily as a single, which increases availability, reliability, and gives you the ability to audit the system.
And now we have the new Red Hat Satellite 6.5!
One of the cool things about Red Hat Satellite 6.5 is the new report engine.
Satellite Server often acts as the center where all the information about Red Hat corporate systems flows, and this newest engine allows you to create and export reports containing information about Satellite client hosts, software subscriptions, and applicable software defects (applicable errata) and etc. Reports are programmed in the embedded Ruby (ERB) language.
Satellite 6.5 comes complete with ready-made reports, and the engine gives users the ability to customize these reports or create their own. Satellite 6.5 embedded reports are generated in CSV format, however in this post we will show how you can create reports in HTML format.
Satellite 6.5 includes four built-in reports:
To generate a report, open the Monitor menu , select Report Templates and click the Generate button to the right of the desired report. Leave the filtering field blank to include all the data in the report, or enter something there to limit the results. For example, if only RHEL 8 hosts should be displayed in the Registered Hosts report, then specify the filter os = RedHat and os_major = 8 , as shown in the screenshot below:

After generating the report, you can download it and open it in a spreadsheet of the LibreOffice Calc type, which imports the data from CSV and puts them in columns, for example, as the Applicable errata report in the screenshot below:

Please note that the Default option is enabled in the properties of the embedded reports , so they are automatically added to all new organizations and locations that you create in Satellite.
Let's analyze customization using the built-in Subscriptions report as an example . By default, this report reflects the total number of subscriptions (1), as well as the number of available, that is, free subscriptions (2). We will add another column to it with the number of subscriptions used, which is defined as (1) - (2). For example, if in total we have 50 RHEL subscriptions and 10 of them are free, then 40 subscriptions are used.
Since editing embedded reports is blocked and it is not recommended to change them, you will have to clone the embedded report, give it a new name and then modify this clone copy.
So, if we want to modify the Subscriptions report , then we must first clone it. Therefore, open the Monitor menu , selectReport Templates and select Clone in the drop-down menu to the right of the Subscriptions template . Then we enter the name of the clone report (let's call it Custom Subscriptions ) and add the line 'Used' between the Available and Quantity lines : pool.quantity - pool.available, - pay attention to the comma at the end of the line. Here is how it looks in the screenshot:

Then we click the Submit button , which returns us to the Report Templates page . There, click the Generate button to the right of the Custom Subscriptions report you just created . Leave the Subscriptions filter field blank and click Submit . After that, a report is created and loaded, in which there is a Used column added by us .

Help for the embedded Ruby language is located on the Help tab in the report editing window. It provides an overview of the syntax, as well as the available variables and methods.
Now let's look at creating our own reports using the example of an Ansible-Roles report assigned to hosts in Satellite. Open the Monitor menu , click Report Templates and then click the Create Template button . Call our report Ansible Roles Report and insert the following ERB code into it:
This code generates a report by hosts, displaying the attribute "all_ansible_roles" for them.
Then go to the Inputs tab and click the + Add Input button . We say that name is hosts , and description type is Filter by hosts (optional) . Then click Submit and then click the Generate button to the right of the report you just created. Next, you can set the host filter or click Submit immediately to generate a report for all hosts. The generated report will look something like this in LibreOffice Calc:

Satellite Reporting Engine allows you to generate reports not only in CSV format. As an example, we will create our own report based on the integrated Host Statuses report , but only in the form of an HTML table with color-coded cells based on status. To do this, we clone Host Statuses , and then replace its ERB code with the following:
This report generates HTML that will look something like this in the browser:

The hammer command is used to run the report from the command line , and the cron utility automates this process.
Use the hammer report-template generate —name "" command, for example:
The contents of the report will be displayed on the console. Information can be redirected to a file, and then set up cron so that it runs a shell script to generate a report and sends it by e-mail. The HTML format is perfectly displayed in email clients, which allows you to organize regular delivery of reports to interested parties in a convenient form for perception.
Thus, the reporting engine in Satellite 6.5 is a powerful tool for exporting important data that companies have in Satellite. It is very flexible and allows you to use both built-in reports and their revised versions. In addition, users can create their own reports from scratch. Details about the Satellite Reporting Engine are available in our YouTube video.
July 9 at 11:00 Moscow time do not miss the webinar about the new version of Red Hat Enterprise Linux 8
Our speaker is Aram Kananov, manager of the platform development and management systems department of Red Hat in Europe, the Middle East and Africa. Aram’s work at Red Hat includes a comprehensive analysis of the market, industry and competitors, as well as product positioning and marketing for the platform’s business unit, which includes managing the entire life cycle of the entire product from implementation to end use.

Although you can perform basic administrative tasks using the Red Hat services included with your Red Hat Enterprise Linux subscription, Red Hat Satellite adds extensive lifecycle management capabilities.
Among these features are:
- Installation of patches;
- Subscription management;
- Initialization;
- Configuration management.
From a single console, you can manage thousands of systems as easily as a single, which increases availability, reliability, and gives you the ability to audit the system.
And now we have the new Red Hat Satellite 6.5!
One of the cool things about Red Hat Satellite 6.5 is the new report engine.
Satellite Server often acts as the center where all the information about Red Hat corporate systems flows, and this newest engine allows you to create and export reports containing information about Satellite client hosts, software subscriptions, and applicable software defects (applicable errata) and etc. Reports are programmed in the embedded Ruby (ERB) language.
Satellite 6.5 comes complete with ready-made reports, and the engine gives users the ability to customize these reports or create their own. Satellite 6.5 embedded reports are generated in CSV format, however in this post we will show how you can create reports in HTML format.
Satellite 6.5 built-in reports
Satellite 6.5 includes four built-in reports:
- Applicable errata - a list of software defects (errata) to be fixed on content hosts (optionally filtered by hosts or defects);
- Host statuses - report on the status of the Satellite hosts (optionally filtered by hosts);
- Registered hosts - information about Satellite hosts: IP address, OS version, software subscription (optionally filtered by hosts);
- Subscriptions - information about software subscriptions: total number of subscriptions, number of free ones, SKU codes (optionally filtered by subscription parameters).
To generate a report, open the Monitor menu , select Report Templates and click the Generate button to the right of the desired report. Leave the filtering field blank to include all the data in the report, or enter something there to limit the results. For example, if only RHEL 8 hosts should be displayed in the Registered Hosts report, then specify the filter os = RedHat and os_major = 8 , as shown in the screenshot below:

After generating the report, you can download it and open it in a spreadsheet of the LibreOffice Calc type, which imports the data from CSV and puts them in columns, for example, as the Applicable errata report in the screenshot below:

Please note that the Default option is enabled in the properties of the embedded reports , so they are automatically added to all new organizations and locations that you create in Satellite.
Customization of embedded reports
Let's analyze customization using the built-in Subscriptions report as an example . By default, this report reflects the total number of subscriptions (1), as well as the number of available, that is, free subscriptions (2). We will add another column to it with the number of subscriptions used, which is defined as (1) - (2). For example, if in total we have 50 RHEL subscriptions and 10 of them are free, then 40 subscriptions are used.
Since editing embedded reports is blocked and it is not recommended to change them, you will have to clone the embedded report, give it a new name and then modify this clone copy.
So, if we want to modify the Subscriptions report , then we must first clone it. Therefore, open the Monitor menu , selectReport Templates and select Clone in the drop-down menu to the right of the Subscriptions template . Then we enter the name of the clone report (let's call it Custom Subscriptions ) and add the line 'Used' between the Available and Quantity lines : pool.quantity - pool.available, - pay attention to the comma at the end of the line. Here is how it looks in the screenshot:

Then we click the Submit button , which returns us to the Report Templates page . There, click the Generate button to the right of the Custom Subscriptions report you just created . Leave the Subscriptions filter field blank and click Submit . After that, a report is created and loaded, in which there is a Used column added by us .

Help for the embedded Ruby language is located on the Help tab in the report editing window. It provides an overview of the syntax, as well as the available variables and methods.
Create your own report
Now let's look at creating our own reports using the example of an Ansible-Roles report assigned to hosts in Satellite. Open the Monitor menu , click Report Templates and then click the Create Template button . Call our report Ansible Roles Report and insert the following ERB code into it:
<%#
name: Ansible Roles Report
snippet: false
template_inputs:
- name: hosts
required: false
input_type: user
description: Limit the report only on hosts found by this search query. Keep empty
for report on all available hosts.
advanced: false
model: ReportTemplate
-%>
<% load_hosts(search: input('hosts'), includes: :ansible_roles).each_record do |host| -%>
<% report_row({
'Name': host.name,
'All Ansible Roles': host.all_ansible_roles
}) -%>
<% end -%>
<%= report_render -%>
This code generates a report by hosts, displaying the attribute "all_ansible_roles" for them.
Then go to the Inputs tab and click the + Add Input button . We say that name is hosts , and description type is Filter by hosts (optional) . Then click Submit and then click the Generate button to the right of the report you just created. Next, you can set the host filter or click Submit immediately to generate a report for all hosts. The generated report will look something like this in LibreOffice Calc:

HTML Reporting
Satellite Reporting Engine allows you to generate reports not only in CSV format. As an example, we will create our own report based on the integrated Host Statuses report , but only in the form of an HTML table with color-coded cells based on status. To do this, we clone Host Statuses , and then replace its ERB code with the following:
Host Statuses
<% load_hosts(search: input('hosts'), includes: :host_statuses).each_record do |host| -%>
<% all_host_statuses_hash(host).each do |key, value| -%>
<% end -%>
<% break -%>
<% end -%>
<%- load_hosts(search: input('hosts'), includes: :host_statuses).each_record do |host| -%>
<% if host.global_status == 0 -%>
<% elsif host.global_status == 1 -%>
<% else -%>
<% end -%>
<% all_host_statuses_hash(host).each do |key, value| -%>
<% if value == 0 -%>
<% elsif value == 1 -%>
<% else -%>
<% end -%>
<% end -%>
<% end -%>
Hostname Status <%= key %> <%= host.name %> OK Warning Error (<%= host.global_status %>) OK Warning Error (<%= value %>)
This report generates HTML that will look something like this in the browser:

Running reports from the command line
The hammer command is used to run the report from the command line , and the cron utility automates this process.
Use the hammer report-template generate —name "" command, for example:
# hammer report-template generate —name "Host statuses HTML"
The contents of the report will be displayed on the console. Information can be redirected to a file, and then set up cron so that it runs a shell script to generate a report and sends it by e-mail. The HTML format is perfectly displayed in email clients, which allows you to organize regular delivery of reports to interested parties in a convenient form for perception.
Thus, the reporting engine in Satellite 6.5 is a powerful tool for exporting important data that companies have in Satellite. It is very flexible and allows you to use both built-in reports and their revised versions. In addition, users can create their own reports from scratch. Details about the Satellite Reporting Engine are available in our YouTube video.
July 9 at 11:00 Moscow time do not miss the webinar about the new version of Red Hat Enterprise Linux 8
Our speaker is Aram Kananov, manager of the platform development and management systems department of Red Hat in Europe, the Middle East and Africa. Aram’s work at Red Hat includes a comprehensive analysis of the market, industry and competitors, as well as product positioning and marketing for the platform’s business unit, which includes managing the entire life cycle of the entire product from implementation to end use.