diff --git a/cbcollect_info b/cbcollect_info index 61db994f0a..3b296246fb 100755 --- a/cbcollect_info +++ b/cbcollect_info @@ -161,7 +161,8 @@ def retrieve_config_value(config_key, node=None): config_key, node=node) places = [("escript", - "cbdumpconfig.escript", + os.path.dirname(os.path.abspath(__file__)) + + "/cbdumpconfig.escript", os.path.dirname(os.path.abspath(__file__)) + "/../var/lib/couchbase/config/config.dat"), ("escript", @@ -224,13 +225,14 @@ def get_dbdir(): return "" def get_credential(): - ret = retrieve_config_value('\s*{creds,\[\{"(.+)",\s*\[\{password,\s*"(.+)"}') + ret = retrieve_config_value('\s*{creds,\[\{"(.+)",\s*\[\{password,\s*"(.*)"\}') if ret: return "{0}:{1}".format(ret[0], ret[1]) else: return "" -_tasks = [ +def make_tasks(): + _tasks = [ UnixTask("uname", "uname -a"), WindowsTask("System information", "systeminfo"), WindowsTask("Computer system", "wmic computersystem", reformat=True), @@ -322,42 +324,48 @@ _tasks = [ os.path.dirname(sys.argv[0]) + "/cbdumpconfig.escript /opt/couchbase/var/lib/couchbase/config/config.dat"), AllOsTask("couchbase logs", "cbbrowse_logs", log_file="ns_server.debug.log"), AllOsTask("couchbase logs", "cbbrowse_logs info", log_file="ns_server.info.log"), - AllOsTask("couchbase logs", "cbbrowse_logs error", log_file="ns_server.error.log"), - AllOsTask("couchbase diags", - ["curl", "-u", get_credential(), "localhost:8091/diag?noLogs=1"], - log_file="diag.log") - ] - -for flg in ['', '-a']: - _tasks = _tasks + [ - AllOsTask("memcached stats all", - "cbstats %s 127.0.0.1:11210 all _admin _admin" % (flg), - log_file="stats.log"), - AllOsTask("memcached stats checkpoint", - "cbstats %s 127.0.0.1:11210 checkpoint _admin _admin" % (flg), - log_file="stats.log"), - AllOsTask("memcached stats dispatcher", - "cbstats %s 127.0.0.1:11210 dispatcher logs _admin _admin" % (flg), - log_file="stats.log"), - AllOsTask("memcached stats hash", - "cbstats %s 127.0.0.1:11210 hash detail _admin _admin" % (flg), - log_file="stats.log"), - AllOsTask("memcached stats tap", - "cbstats %s 127.0.0.1:11210 tap _admin _admin" % (flg), - log_file="stats.log"), - AllOsTask("memcached stats tapagg", - "cbstats %s 127.0.0.1:11210 tapagg _admin _admin" % (flg), - log_file="stats.log"), - AllOsTask("memcached stats timings", - "cbstats %s 127.0.0.1:11210 timings _admin _admin" % (flg), - log_file="stats.log"), - AllOsTask("memcached memory stats", - "cbstats %s 127.0.0.1:11210 raw memory _admin _admin" % (flg), - log_file="stats.log"), - AllOsTask("memcached allocator stats", - "cbstats %s 127.0.0.1:11210 raw allocator _admin _admin" % (flg), - log_file="stats.log") - ] + AllOsTask("couchbase logs", "cbbrowse_logs error", log_file="ns_server.error.log") + ] + + c = get_credential() + if c: + _tasks.append( + AllOsTask("couchbase diags", + "curl \"http://%s@127.0.0.1:8091/diag?noLogs=1\"" % (c), + log_file="diag.log")) + + for flg in ['', '-a']: + _tasks = _tasks + [ + AllOsTask("memcached stats all", + "cbstats %s 127.0.0.1:11210 all _admin _admin" % (flg), + log_file="stats.log"), + AllOsTask("memcached stats checkpoint", + "cbstats %s 127.0.0.1:11210 checkpoint _admin _admin" % (flg), + log_file="stats.log"), + AllOsTask("memcached stats dispatcher", + "cbstats %s 127.0.0.1:11210 dispatcher logs _admin _admin" % (flg), + log_file="stats.log"), + AllOsTask("memcached stats hash", + "cbstats %s 127.0.0.1:11210 hash detail _admin _admin" % (flg), + log_file="stats.log"), + AllOsTask("memcached stats tap", + "cbstats %s 127.0.0.1:11210 tap _admin _admin" % (flg), + log_file="stats.log"), + AllOsTask("memcached stats tapagg", + "cbstats %s 127.0.0.1:11210 tapagg _admin _admin" % (flg), + log_file="stats.log"), + AllOsTask("memcached stats timings", + "cbstats %s 127.0.0.1:11210 timings _admin _admin" % (flg), + log_file="stats.log"), + AllOsTask("memcached memory stats", + "cbstats %s 127.0.0.1:11210 raw memory _admin _admin" % (flg), + log_file="stats.log"), + AllOsTask("memcached allocator stats", + "cbstats %s 127.0.0.1:11210 raw allocator _admin _admin" % (flg), + log_file="stats.log") + ] + + return _tasks def main(): from optparse import OptionParser @@ -386,7 +394,7 @@ def main(): os.environ['PATH'] = ';'.join(path) runner = TaskRunner(verbosity=options.verbosity) - for task in _tasks: + for task in make_tasks(): runner.run(task) runner.zip(args[0])