diff --git a/tools/summary/diff.sh b/tools/summary/diff.sh new file mode 100755 index 000000000..b76e45fa7 --- /dev/null +++ b/tools/summary/diff.sh @@ -0,0 +1,11 @@ +#!/bin/bash +src=${1:-""} +dst=${2:-""} +if [[ -z $src ]] || [[ -z $dst ]]; then + echo "USAGE: `basename $0` " + exit +fi + +for f in `find $src -maxdepth 1 -name *summary.yaml`; do + diff -y $dst/$f $f| less +done diff --git a/tools/summary/issues-and-bugs.sh b/tools/summary/issues-and-bugs.sh new file mode 100755 index 000000000..3febd49d5 --- /dev/null +++ b/tools/summary/issues-and-bugs.sh @@ -0,0 +1,9 @@ +#!/bin/bash +path=${1:-hotsos-output} +for f in `find $path -maxdepth 1 -name *summary.json`; do + clear + jq -r '"\nHostname: " + .system.hostname, + "Issues:", (.[]|to_entries[]|select(.key=="potential-issues")|.value|to_entries[]|.key, .value), + "Bugs:", (.[]|to_entries[]|select(.key=="known-bugs")|.value|to_entries[]|.key, .value)' $f + read -p "Next? [ENTER]" +done diff --git a/tools/summary/less-all.sh b/tools/summary/less-all.sh new file mode 100755 index 000000000..638dae317 --- /dev/null +++ b/tools/summary/less-all.sh @@ -0,0 +1,5 @@ +#!/bin/bash +path=${1:-hotsos-output} +for f in `find $path -maxdepth 1 -name *summary.yaml`; do + less $f +done diff --git a/tools/summary/view.py b/tools/summary/view.py new file mode 100755 index 000000000..09b8d3ba6 --- /dev/null +++ b/tools/summary/view.py @@ -0,0 +1,62 @@ +#!/usr/bin/env python3 +import glob +import os +import json +import sys +import subprocess + +PLUGIN_NAMES = ['juju', 'mysql', 'openstack', 'openvswitch', 'system', + 'maas', 'kernel', 'kubernetes', 'rabbitmq', 'sosreport', + 'storage', 'vault', 'pacemaker'] + +if __name__ == "__main__": + if len(sys.argv) > 1: + path = os.path.join(sys.argv[1], '*.json') + else: + path = '*.json' + + for f in glob.glob(path): + with open(f) as fd: + subprocess.call(['clear']) + s = json.loads(fd.read()) + print("host: {} ".format(s['system']['hostname'])) + print("date: {}".format(s['system']['date'])) + _enabled = [] + _services = {} + _has_bugs = {} + _has_potential_issues = {} + for plugin in PLUGIN_NAMES: + if plugin in s: + _enabled.append(plugin) + if 'services' in s[plugin]: + enabled = s[plugin]['services'] + enabled = enabled.get('systemd', {}) + _services[plugin] = enabled.get('enabled') + + if 'known-bugs' in s[plugin]: + _has_bugs.update(s[plugin]['known-bugs']) + + if 'potential-issues' in s[plugin]: + _has_potential_issues.update( + s[plugin]['potential-issues']) + +# print("enabled: {}".format(', '.join(sorted(_enabled)))) + print("services:") + for plugin, svcs in _services.items(): + print(" {}: {}".format(plugin, ', '.join(svcs))) + + if _has_bugs: + print("bugs:") + for btype, content in _has_bugs.items(): + print(" {}: {}\n".format(btype, '\n'.join(content))) + + if _has_potential_issues: + print("issues:") + for btype, content in _has_potential_issues.items(): + print(" {}:".format(btype)) + for msg in content: + print(" {}".format(msg)) + + input("\nNext? [ENTER]") + + print("") diff --git a/tox.ini b/tox.ini index b4e8d7268..75da177f8 100644 --- a/tox.ini +++ b/tox.ini @@ -15,7 +15,7 @@ setenv = VIRTUAL_ENV={envdir} TERM=linux HOTSOS_ROOT={toxinidir}/hotsos TESTS_DIR={[testenv]unit_tests} - PYFILES={toxinidir}/setup.py {toxinidir}/hotsos/ {[testenv]unit_tests} + PYFILES={toxinidir}/setup.py {toxinidir}/hotsos/ {[testenv]unit_tests} {toxinidir}/tools non-utc-tz: TZ=EST+5 deps = -r{toxinidir}/requirements.txt