Collect Red Hat subscription data
The Red Hat collector is a script for Red Hat Deployment Manager, not the Licenseware Collector agent. It gathers the hardware, installed packages, virtual machine status and subscription detail RDM uses to decide which subscriptions a host needs. The operating system install date it records is what backdating depends on.
Request the script from support@licenseware.io. The file name in these steps is licenseware-collector-rhel-script-v8-no-middleware.sh.
What it checks for
Section titled “What it checks for”The script checks for these utilities and proceeds even if some are missing:
rpm, lscpu, hostname, systemd-detect-virt, subscription-manager, yum, dnf, flatpak, snap
What it collects
Section titled “What it collects”Red Hat add-on packages. It looks for installed packages whose names match pacemaker, cluster, rh-storage-server, rhel-system-roles, rhel-high-availability, or rhel-resilient-storage. RDM recognizes those paid add-ons. For each match the JSON includes name (dots changed to dashes), signature (PGP/GPG from rpm), addon_install_date, and source set to installed.
CPU and topology. architecture from lscpu. model_name from the vendor and model name. socket_count, cores_per_socket, and core_count (sockets multiplied by cores per socket).
Machine identity. name and machine_name from hostname. machine_model from /sys/devices/virtual/dmi/id/sys_vendor and /sys/devices/virtual/dmi/id/product_name, with “None” stripped.
Virtualization. is_virtual from systemd-detect-virt. It is true when the result is not none.
Operating system. os_install_date from the rpm install time of the basesystem package, formatted YYYY-MM-DD HH:MM:SS. os_name from PRETTY_NAME in /etc/os-release. os_version parsed from /etc/redhat-release.
Subscription status. subscription_status from the “Overall Status:” line of subscription-manager status. subscription_timestamp from “Last Refreshed:”. Without that status, RDM cannot backdate a subscription.
Package inventory. A second file, with these sections, captured exactly as the tools return them:
- RPM Packages, from
rpm -qa, with version and release - YUM Packages, from
yum list installed - DNF Apps, from
dnf list installed - Flatpak Apps, from
flatpak list - Snap Apps, from
snap list - Appstream Modules, from
dnf module list --enabled - Red Hat Subscription Manager Apps, from
subscription-manager repos --list-enabled - SCL List, from
scl --list-collectionswhen that command exists
Privileges
Section titled “Privileges”Run it as root, or with sudo. That is what can read system information and installed packages. The user also needs permission to query Red Hat subscription manager.
One host
Section titled “One host”- SSH to the host:
ssh username@target_host - Copy the script:
scp licenseware-collector-rhel-script-v8-no-middleware.sh <user>@<rhel-host>:/tmp/ - Make it executable:
chmod +x licenseware-collector-rhel-script-v8-no-middleware.sh - Run it:
sudo bash licenseware-collector-rhel-script-v8-no-middleware.sh
Or, from /tmp:
chmod +x licenseware-collector-rhel-script-v8-no-middleware.shsudo ./licenseware-collector-rhel-script-v8-no-middleware.shThe script writes two files. Upload both to the RDM - Custom Collector source. That source is listed on Data sources.
Licenseware_Collector_-_RHEL_Script_Output_<timestamp>_<hostname>.jsonLicenseware_Collector_-_RHEL_Package_Inventory_<timestamp>_<hostname>.txt
Many hosts, over SSH
Section titled “Many hosts, over SSH”This needs SSH to each machine, sudo on each machine, and passwordless SSH from the machine you run it on (otherwise each host prompts for a password).
- Put one hostname or IP per line in
servers.txt. - Save a script such as
run_licenseware_collector.shthat, for each line, copies the collector script to/tmpon that host, runs it with sudo, and copies both output files back. - Run
chmod +x run_licenseware_collector.shand then./run_licenseware_collector.sh.
The loop copies the script with scp, runs it with ssh and sudo bash, then uses ssh and cat to pull Licenseware_Collector_RHEL_Script_Output_*.json and Licenseware_Collector_RHEL_Package_Inventory_*.txt into a local output folder, one pair per server.
Many hosts, with Ansible
Section titled “Many hosts, with Ansible”An inventory file named hosts:
[rhel_servers]server1.example.comserver2.example.comA playbook that copies the script to /tmp with mode 0755, runs it with sudo, and saves the output locally. Then:
ansible-playbook -i hosts run_licenseware_collector.ymlThe playbook’s tasks are: copy the script, execute it, and save the output for each server.
Common issues
Section titled “Common issues”Missing command warnings. The script logs utilities that are not installed, and continues. Install what you need, for example sudo dnf install -y redhat-lsb-core dmidecode subscription-manager. Adjust that for the environment.
Subscription manager. If subscription-manager is not configured or not available, subscription_status may be null or absent. That does not stop the run. Without the status, RDM cannot backdate.
Flatpak or Snap. If those frameworks are not used, their sections in the package inventory are empty or show an error. That is expected.
The Licenseware Collector agent, for general hardware and software inventory, is documented at licenseware-collector.com.