Hammer CLI CSV to report errata counts per host

Latest response

Is there are way to export all Content Hosts, adding in the installable errata counts by host for security, bug, and enhancement?

It seems like this ought to be simply built into the Satellite UI, but no such report export capability seems to exist (which is rather bizarre).

With a command like:

hammer csv content-hosts --export --file /tmp/reports.csv

I can get all kinds of content host information per host, except for the very information I need, installable errata counts by host.

Responses

not sure which version of satellite 6 you are on, but this is actually quite easy in 6.3.x

$  hammer --csv host errata list --host host.example.com
ID,Erratum ID,Type,Title,Installable
23703,RHBA-2018:0770,bugfix,"gtk3, gdm, gnome-shell, gnome-session update, new packages: wayland",true
24906,RHEA-2018:1771,enhancement,linux-firmware enhancement update,true
24705,RHSA-2018:1700,security,Important: procps-ng security update,true
24677,RHSA-2018:1629,security,Important: kernel security update,true
24584,RHEA-2018:1581,enhancement,microcode_ctl bug fix and enhancement update,true
24550,RHSA-2018:1453,security,Critical: dhcp security update,true
24506,RHEA-2018:1377,enhancement,ca-certificates enhancement update,true
24504,RHBA-2018:1401,bugfix,sos bug fix and enhancement update,true
24497,RHBA-2018:1383,bugfix,gcc bug fix update,true
24496,RHBA-2018:1375,bugfix,rsyslog bug fix update,true
24493,RHBA-2018:1388,bugfix,iptables bug fix update,true
24489,RHEA-2018:1376,enhancement,"nspr, nss-util, nss-softokn, and nss bug fix and enhancement update",true
24486,RHBA-2018:1398,bugfix,e2fsprogs bug fix update,true
24484,RHBA-2018:1389,bugfix,openldap bug fix update,true
24431,RHSA-2018:1318,security,"Important: kernel security, bug fix, and enhancement update",true
24432,RHBA-2018:1339,bugfix,tzdata enhancement update,true
24250,RHSA-2018:1200,security,Important: patch security update,true
24167,RHBA-2018:1143,bugfix,nfs-utils bug fix update,true

oh and you can further refine it

$  hammer --csv host errata list --host host.example.com --search "type=security"
ID,Erratum ID,Type,Title,Installable
24705,RHSA-2018:1700,security,Important: procps-ng security update,true
24677,RHSA-2018:1629,security,Important: kernel security update,true
24550,RHSA-2018:1453,security,Critical: dhcp security update,true
24431,RHSA-2018:1318,security,"Important: kernel security, bug fix, and enhancement update",true
24250,RHSA-2018:1200,security,Important: patch security update,true
24042,RHSA-2018:1062,security,"Important: kernel security, bug fix, and enhancement update",true
23924,RHSA-2018:0855,security,"Moderate: ntp security, bug fix, and enhancement update",true
23828,RHSA-2018:0913,security,"Low: policycoreutils security, bug fix, and enhancement update",true
23795,RHSA-2018:0980,security,"Low: openssh security, bug fix, and enhancement update",true
23784,RHSA-2018:0998,security,Moderate: openssl security and bug fix update,true
23754,RHSA-2018:0666,security,"Moderate: krb5 security, bug fix, and enhancement update",true
23684,RHSA-2018:0849,security,"Low: gcc security, bug fix, and enhancement update",true

I've seen that capability, however, this is not what I was looking for. It would be more like this kind of output:

Host,OS_Description,Security_Count,Bugfix_Count,Enhancment_Count
host1, RHEL 7.5, 5, 25, 2
host2, RHEL 7.5, 5, 22, 2
host3, RHEL 7.5, 4, 25, 2
host4, RHEL 7.5, 5, 25, 1

The purpose is quite simple, management wants a summary, not all of the details for every host. This information can be seen but not exported from the UI.

My misunderstanding. You're right that would be nice, but I don't think there's a way to do it, without scripting either the hammer output and looping over it to get your numericals or writing something in Python against the API to get it.

We opted for the latter, to generate executive metrics (a pretty graph :D) We store the numericals in a mysql db because its faster than querying Satellite. We run this job once a day that extracts all the errata info, host info, numerics, etc and dumps it into a mysql db that serves a custom reporting front-end.

I would be willing to submit a ticket against an RFE for this type of output from hammer though, at least a simple metric count of each type.

Maybe I should check out the API. I thought someone said it was REST based so I could try doing something similar as what you did. Thanks for the info.

Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.