Lars Berntzon

Lars Berntzon

Tuesday, 04 June 2019 13:56

WhatsWrong

WhatsWrong

usage: ww [-p <percentage>] {ok|fail} file-1 [{ok|fail} file-2] ...

Examines a set of files to find what is significant for ok and failure files
This can for instance be used to check for differences between many machines
in order to find out what is significant for a failure situation. One can for
example use the list of installed rpms of all involved machines. For the machines
where things are ok the list of rpm:s is given to the ok set and for machines where .
the problem occurs, the rpm list is specified for the fail set.
Lines from all files are used and matched with a ok/fail status. If a certain
line occures in both the fail and ok sets it is disgarded. If a line is not found
in one of the sets but in the other then it will be reported as a diff.
A line is considered found in a set only if it is found in all files in the set,
this can how ever be changed with the -p option which specified what percentage of
the files the line must be found in. Default percentage is 100%
The input files does not need to be sorted.
The output from the script will be rows with the set name where the line is unique
followed by the line (colon separated). Each set name is prefixed with a + sign when
the line is unique for this set and a - sign when the line is missing for the set.

Example:

ww -p 70 fail host1.rpmpgs fail host2.rpmpkgs ok host3.rpmpkgs ok host4.rpmpkgs

Will print rpm packages that are installed on at least 70 % of the failing hosts and
not more than 30 % on the ok hosts; or rpm packages that are installed on at least 70 %
of the ok hosts and not more than 30 % on the failing hosts.

Other situation where this command can be useful:
- Comparing system logs from many machines where some machines are having problem.
For the program to work, the files needs to have any unique texts removed like time
stamps, pids and hostnames.
- Checking some text processing programs. In this case, the text files must be processed
in some way, perhaps the set of characters or the set of words are extracted from each
text file.

And by the way. You can use any names for the sets, the names 'ok' and 'fail' are just
examples. You can also use any number of sets. Like:

ww fail host1.rpms fail host2.rpms ok host3.rpms ok host4.rpms random host5.rpms random host6.rpms