Simple Reports from Redhat Satellite
Hi
Is there an easy method of producing simple standard reports from a Redhat 5.6 Satellite Server. For example :
- List all clients with last 'check-in' date and time
- List updates applied to clients
Thanks
Greg
Responses
You have several options available - I'll focus on 2
* spacewalk-report
* spacecmd
# spacewalk-report --list-fields
audit-server-groups
audit-servers
audit-users
channel-packages
channels
cloned-channels
custom-info
entitlements
errata-channels
errata-list
errata-list-all
errata-systems
host-guests
inactive-systems
inventory
kickstartable-trees
packages-updates-all
packages-updates-newest
scap-scan
scap-scan-results
splice-export
system-crash-count
system-crash-details
system-currency
system-groups
system-groups-keys
system-groups-systems
system-groups-users
system-history
system-history-channels
system-history-configuration
system-history-entitlements
system-history-errata
system-history-kickstart
system-history-packages
system-history-scap
system-packages-installed
users
users-systems
spacecmd has the following functions built-in
report_duplicates
report_entitlements
report_errata
report_inactivesystems
report_ipaddresses
report_kernels
report_outofdatesystems
report_ungroupedsystems
You can use the API as well (but I am not good with that fuctionality).
spacecmd is (currently) available via the EPEL repo and can be installed on a system other than the Satellite server and execute the queries remotely. https://fedorahosted.org/spacewalk/wiki/spacecmd
No worries Greg.
If you wouldn't mind - Could you give a brief description of how a "secure service" impacts the usage of spacecmd? The reason I ask is that I have heard they may include it as part of the Red Hat supported tree (rather than EPEL) - your example might provide extra motivation to make that happen.
Thanks!
... the beauty of spacecmd is that it's all Python based (I believe). So, you potentially could pull it down and reverse-engineer some of the functionality for reporting.
Greg, I too work with a secure set of systems on contracts, several customers involved. I was able to get spacecmd rather easily approved, and occasional other EPEL things when justified, because it is indeed part of Red Hat, albiet in the "epel" portion of their software availability. That merely means while it is indeed delivered from Red Hat, if you require support for EPEL packages or functions, you must rely on the community.
I use spacecmd and API scripts (but I like perl, and most of the API scripts are often python, and python is fine).
There are some examples of API scripts that will achieve some of what you describe as well, and what James wrote above is of course a great route.
Hi, Is it possible to get the list of updates to be applied to a system using spacecmd? I mean, I'd get a list of patches (with the detail of the specific package to be installed) as it's possible to do with the command "yum check-update --security".
Regards
is spacewalk-report included in rhnss6? if not how do i install it
Paul, regarding your question on spacewalk-report for satellite 6, the answer is no, however, use this to make a csv report of the client systems attached to your system (run as root)
hammer csv content-hosts --export --file /tmp/mylistofsatelliteclients.txt
See the hammer cli guide for more info.
can we use spacecmd in Satellite 6.2.x ? or its already build in
Muhammed Mughal,
spacecmd is replaced by the hammer command in satellite 6. The hammer command is much different. hammer cli guide for more info.
Hi,
Others already gave you plenty of information about spacecmd and spacewalk-report. Very easy to use tools.
API is powerful too.
In one place I developed Perl script that uses API and provides monthly Excel report with these columns:
System
Latest Base Channel
Latest Child Channels
Missing RHEL SECURITY Packages in Latest Channels
Missing RHEL BugFix and ENHANCEMENT Packages in Latest Channels
Unverified Third-Party Packages
Total Missing RHEL Packages in Latest Channels
System Type
System Role
Upgraded Packages This Month
Last Boot
RHEL System Currency Status
Some snippets from the Perl script:
my $chaninfo = $client->call('system.getSubscribedBaseChannel', $session, $systemid);
my $childs = $client->call('system.listSubscribedChildChannels', $session, $systemid);
...
my $SysErrata = $client->call('system.getRelevantErrata', $session, $systemid);
...
my $getinfo = $client->call('system.getDetails', $session, $system->{'id'});
foreach my $ginfo ($getinfo) {
if ( eval "use DateTime::Format::ISO8601" ) {
my $dtx = DateTime::Format::ISO8601->parse_datetime($ginfo->{'last_boot'});
$dt = $dt->strftime('%F %T');
}
else {
$dt = sprintf("%d-%02d-%02d%s%s", unpack('A4A2A2AA8', $ginfo->{'last_boot'}->value()));
}
}
I never had problem to get approval to use Satellite 5 spacecmd and spacewalk-report, even for customers who are in special environments.
Regards,
Dusan Baljevic (amateur radio VK2COT)
I also have never had a problem and never needed to seek approval for satellite 5 spacecmd or spacewalk-report, for anyone in any environment anywhere for any reason. No problems whatsoever. There's an alternative for Satellite 6 where spacecmd and spacewalk-report are no longer available that I mentioned previously.
In the simplest possible form:
Answer to your question 1.
spacewalk-report inventory | awk -F"," '{print $1, $8}'
Or, if you want to include hostname:
spacewalk-report inventory | awk -F"," '{print $1, $2, $8}'
"spacewalk inventory" provides these comma-separated reports:
server_id,profile_name,hostname,ip_address,ipv6_address,registered_by,registration_time,last_checkin_time,kernel_version,packages_out_of_date,errata_out_of_date,software_channel,configuration_channel,entitlements,system_group,organization,virtual_host,architecture,is_virtualized,osad_status,hardware
Regards,
Dusan Baljevic (amateur radio VK2COT)
I wrote this:
https://gist.github.com/gswallow/f7cb5c6ed4af8cae97c5e8d7bae3a016
It uses one extra gem (mail), which is compatible with the /etc/foreman/email.yaml file you need to configure anyway, in the course of configuring Satellite 6. You get an HTML-formatted e-mail with color-coded table rows highlighting systems that haven't checked in in 10 days, by default.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
