Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 827851 Details for
Bug 995967
RFE: RHOS log collector tool
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
rhos-log-collector script
rhos-log-collector.py (text/plain), 2.41 KB, created by
Alan Pevec
on 2013-11-22 15:15:06 UTC
(
hide
)
Description:
rhos-log-collector script
Filename:
MIME Type:
Creator:
Alan Pevec
Created:
2013-11-22 15:15:06 UTC
Size:
2.41 KB
patch
obsolete
>#!/usr/bin/python ># ># rhos-log-collector ># run and collect support reports on each OpenStack hosts in parallel ># list of OpenStack hosts can be extracted from Packstack answer file ># or provided in PSSH hosts file format, see pssh(1). > >import ConfigParser >import subprocess >import sys >import uuid > >from optparse import OptionParser > >def get_hosts(answer_file): > """Return the list of OpenStack hosts from Packstack answer file.""" > # based on packstack/modules/ospluginutils.py gethostlist(CONF) > conf = ConfigParser.ConfigParser() > conf.read(answer_file) > hosts = [] > for name, value in conf.items('general'): > if name.endswith("_host"): > value = value.split('/')[0] > if value and value not in hosts: > hosts.append(value) > elif name.endswith("_hosts"): > for host in value.split(","): > host = host.strip() > host = host.split('/')[0] > if host and host not in hosts: > hosts.append(host) > return hosts > >def pssh(opts, remote_cmd): > """Execute remote_cmd on multiple hosts using pssh.""" > cmd = ["pssh", "-i", "-t", "0"] > cmd.extend(opts) > cmd.append(remote_cmd) > return subprocess.call(cmd) > >def pslurp(opts, remote_dir, local_dir): > """Copy remote_dir folder recursively from multiple machines using pslurp.""" > cmd = ["pslurp", "-t", "0", "-r"] > cmd.extend(opts) > cmd.append(remote_dir) > cmd.append(local_dir) > return subprocess.call(cmd) > >opts = OptionParser("usage: %prog [--answer-file=PACKSTACK-ANSWER_FILE] [--hosts=PSSH-HOSTS-FILE]") >opts.add_option("--answer-file", help="Packstack answer file to extract OpenStack hosts to get support report from") >opts.add_option("--hosts", help="PSSH hosts file (each line [user@]host[:port])") > >(options, args) = opts.parse_args() >if options.answer_file: > hosts = get_hosts(options.answer_file) > hosts_opt = ["-H"] > for host in hosts: > hosts_opt.append("root@%s" % host) >elif options.hosts: > hosts_opt = ["-h", options.hosts] >else: > opts.print_usage() > raise SystemExit > ># remote /tmp may be tmpfs, use generated uuid-folder in homedir instead >tmpdir="sos-%s" % str(uuid.uuid1()) >if pssh(hosts_opt, "sosreport --tmp-dir ~/%s" % tmpdir) == 0: > pslurp(hosts_opt, tmpdir, tmpdir) > print "Support reports from all hosts are saved in %s" % tmpdir >else: > print "%s failed." % sys.argv[0] > raise SystemExit
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Flags:
apevec
: review?
Actions:
View
Attachments on
bug 995967
: 827851