man rpmchk
NAME
rpmchk - compare 'rpm -qa' or --qf files
SYNOPSIS
rpmchk [-options] [-filters]
DESCRIPTION
The rpmchk command compares 'rpm -qa' or 'rpm -q --qf' files.
Files look something like (with 'rpm -qa' output):
# Linux plagueis.arsc.edu 2.6.23.15-80.fc7 ... x86_64
arts-32bit-1.5.1-15.3
autoyast2-installation-2.13.69-0.3
compat-openssl097g-32bit-0.9.7g-11
The first line "host entry" is optional, seed files with:
print "# 'uname -a'" > file
rpm -qa >>file
If the file(s) are not seeded the host name is extracted from the
filename.
Optionally, 'rpm -qa --qf ...' can be used with the -qf option.
OPTIONS
-files file1[,file2...]
Input 'rpm -qa' listings, comma or white-space separated. If
not provided then will be prompted for file names. The fol-
lowing three variations all accomplish the same thing:
ls *.qa | ./rpmchk -match
rpmchk -f "'ls *.qa'" -match
rpmchk -f berg.qa,b1n1.qa,b1n2.qa -match
-qf format
Identify 'rpm --queryformat' used. The first character of
'format' optionally specifies field delimeter, default is
space.
Recognized fields and associated 'rpm --querytags':
N for NAME
V for VERSION
R for RELEASE
E for EPOCH
S for SERIAL
B for BUILDTIME
O for OS
A for ARCH
X to ignore a field (some other tag)
any other characters are ignored
With:
rpm -qa --qf "%{NAME}:%{VERSION}:%{ARCH}\n"
Use:
rpmchk -qf :NVA
A default 'rpm -qa' is like:
rpm -qa --qf "%{NAME}-%{VERSION}-%{RELEASE}\n"
which can be problematic as NAME may contain dashes.
Default parsing assumes last field is RELEASE, next to last
field is VERSION, and everything else is NAME. If somebody
codes a '-' in VERSION or RELEASE, well, that is unkind.
FILTERS, HOSTS
-Type version1[,version2...]
OS types to report (requires 'uname -a' lines).
+Type version1[,version2...]
OS types to exclude.
-Version OS1[,OS2...]
OS versions to report (requires 'uname -a' lines).
+Version OS1[,OS2...]
OS versions to exlcude.
-Arch arch1[,arch2...]
Linux architectures to report (requires 'uname -a' lines).
+Arch arch1[,arch2...]
Linux architectures to exclude.
-host host1[,host2...]
Host name(s) to report.
+host host1[,host2...]
Host name(s) to exclude.
Note, the type, version, and architecture criteria are and'd while
host is or'd.
FILTERS, PACKAGES
-name package1[,package2...]
Package name(s) to report.
+name package1[,package2...]
Package name(s) to exclude.
-arch arch1[,arch2...]
Package architectures to report.
+arch arch1[,arch2...]
Package architectures to exclude.
-OS os1[,os2...]
Package OSs to report.
+OS os1[,os2...]
Package OSs to exclude.
!version
Ignore VERSION and RELEASE for matching packages.
!release
Ignore RELEASE for matching packages.
!epoch Ignore EPOCH for matching packages.
!serial
Ignore SERIAL for matching packages.
!buildt
Ignore BUILDTIME for matching packages.
!os Ignore OS for matching packages.
!arch Ignore ARCH for matching packages.
DISPLAY OPTIONS
-match Matched hosts (package/version/... on all hosts) not
reported.
-single
No space between host columns. If display width exceeds 131
characters then -single will be default.
-count Display number of hosts with RPM and first matching host
instead of the host matrix.
-list count
Display up to count nodes missing rpm. Use 0 for all.
+list count
Display up to count node missing rpm. Use 0 for all.
-xName value
Specify a maximum NAME length to display. Defaults as 20 and
field maximum is 64.
-xVer value
Specify a maximum VERSION length to display. Defaults as 12
and field maximum is 64.
-xRel value
Specify a maximum RELEASE length to display. Defaults as 12
and field maximum is 64.
-xEpo value
Specify a maximum EPOCH length to display. Defaults as 8 and
field maximum is 16.
-xSer value
Specify a maximum SERIAL length to display. Defaults as 8
and field maximum is 16.
-xBui value
Specify a maximum BUILDTIME length to display. Defaults as
12 and field maximum is 16.
-xOS value
Specify a maximum OS length to display. Defaults as 8 and
field maximum is 16.
-xArc value
Specify a maximum ARCH length to display. Defaults as 8 and
field maximum is 16.
-output output-file
To specify output file, defaults to stdout.
-debug Debugging information.
-verbose
Verbose option to display filters.
-? Display terse help message.
EXAMPLES
Show non-matching package/version from 'rpm -qa' files:
#b b b : 3 hosts
#1 1 e : 58 total packages
#n n r :
#1 2 g :
# m :
# a :
# n :Name Version
#
- i i :AIX-rpm 5.2.0.85
i - - :AIX-rpm 5.2.0.91
- - i :atk 1.4.0
- - i :cdrecord 1.9
- - i :conserver 8.1.7
- - i :expat-devel 1.95.7
- - i :fontconfig 2.2.2
- - i :freetype2 2.1.7
- - i :gettext 0.10.40
- - i :glib 1.2.10
- - i :glib2 2.2.3
- - i :gtk+ 1.2.10
- - i :gtk2 2.2.4
- - i :libjpeg 6b
- - i :libpng 1.2.1
- - i :libtiff 3.6.1
- - i :mkisofs 1.13
- - i :openCIMOM 0.8
- - i :pango 1.2.5
- i i :tk 8.3.3
i - - :tk 8.3.4
- - i :xft 0.0
- - i :xrender 0.0
- - i :zlib 1.2.2
#
# 34 of 58 packages installed on all 3 hosts
Using files generated by (on a cluster of 400+ nodes):
$ pdsh -g all 'print "# 'uname -a'" >'hostname'.qf'
$ pdsh -g all \
'rpm -qa --qf "%{NAME} %{VERSION} %{RELEASE} %{ARCH}\n" >>'host-
name'.qf'
Reporting with various filters:
$ rpmchk -qf NV -f "'ls *.qf_mid'" -match -Ver "2.6.9" \
+host mn1sm,mpbs* +name sun-symon*
#Linux x86_64 2.6.9-55.0.9.EL_lustre.1
#
#m m m m m m m m : 8 hosts
#l l l l l l m m : 1470 total packages
#u u u u u u d d :
#s s s s s s s s :
#t t t t t t 1 2 :
#r r r r r r :
#e e e e e e :
#1 2 3 4 5 6 :Name Version
#
i i i i i i - - :TWeagent 7.1
i - - - - - - - :kernel-source 2.6.9
i - - - - - - - :lustre-autoconf 2.57
i - - - - - - - :lustre-automake 1.7.8
i - - - - - - - :lustre-source 1.4.7
i - - - - - - - :lustre-source 1.4.7.1
i i i i i i - - :mvSatalinux-2.6.9-55 3.6.3_2
i i i i i i - - :n1sm-linux-agent 1
- - - - - - i i :scli 1.06.16
#
# 1461 of 1470 packages installed on all 8 hosts
Report matching host count and first matching node:
$ ls mt*.qf_mid | rpmchk -qf NV -match -count
#Linux x86_64 2.6.5-7.276-smp-hdmb-pap
#
# : 358 hosts
# : 637 total packages
# First :Name Version
#
1 mt350 :TWeagent 7.1
354 mt001 :base-mgmt-client 3.0
71 mt261 :base-mgmt-grid 2.2
71 mt261 :base-mgmt-inventory 1.0
4 mt253 :dhcpcd 1.3.22pl4
354 mt001 :heartbeat 1.2.3
298 mt001 :herd 1.6
62 mt069 :mcelog 0.2
354 mt001 :n1sm-linux-agent 1
#
# 628 of 637 packages installed on all 358 hosts
Report up to 3 matching nodes:
$ ls mg*.qf_mid |
rpmchk -qf NV -match +h mg56,mg57 +l 3
#Linux x86_64 2.6.5-7.276-smp-hdmb-pap
#
#: 55 hosts
#: 636 total packages
#:Name Version : 55:Matched_On
#
#:base-mgmt-client 3.0 : 54:
:base-mgmt-grid 2.2 : 3:mg08 mg22 mg55
:base-mgmt-inventory 1.0 : 3:mg08 mg22 mg55
#:heartbeat 1.2.3 : 54:
:libapr0 2.0.49 : 1:mg45
#:libapr0 2.0.59 : 54:
:mcelog 0.2 : 3:mg22 mg39 mg55
#:n1sm-linux-agent 1 : 54:
#
# 628 of 636 packages installed on all 55 hosts
Report up to 3 missing nodes:
$ ls mg*.qf_mid |
rpmchk -qf NV -match +h mg56,mg57 -l 3
#Linux x86_64 2.6.5-7.276-smp-hdmb-pap
#
#: 55 hosts
#: 636 total packages
#:Name Version : 55:Missing_On
#
:base-mgmt-client 3.0 : 1:mg52
#:base-mgmt-grid 2.2 : 52:
#:base-mgmt-inventory 1.0 : 52:
:heartbeat 1.2.3 : 1:mg52
#:libapr0 2.0.49 : 54:
:libapr0 2.0.59 : 1:mg45
#:mcelog 0.2 : 52:
:n1sm-linux-agent 1 : 1:mg52
#
# 628 of 636 packages installed on all 55 hosts
NOTES
Suggestions for enhancements or bug reports can be directed to
fnkac@uaf.edu.
This command utilizes the cci command parser utilized by non-UNIX
operating systems instead of the traditional UNIX getopt() parsing.
Options have been defined to "look like" UNIX style options, but can
be spelled out or generally abbreviated. For example '-o' is the
same as '-output'. Because of this multiple options must be space
separated and the hyphen is part of the option name. Also because
of this order of options is irrelevant.
ACKNOWLEDGEMENTS
Written at the University of Alaska Fairbanks, ARSC.