Cbstats can't use in couchbase server 5.0

Hi All,

I was used cbstats for collecting metrics on couchbase 4.6.3 version.

but cbstats can not use couchbase 5.0 version because error occurred.
i was use two command becuase 4.6.3 type and 5.0 type is differ.
error message is follow:
/opt/couchbase/bin/cbstats localhost:11210 -j -b <bucket_name> -p<bucket_password> all
/opt/couchbase/bin/cbstats localhost:11210 -j -b <bucket_name> -u<user_name> -p<user_password> all
Traceback (most recent call last):
File “/opt/couchbase/lib/python/cbstats”, line 762, in
main()
File “/opt/couchbase/lib/python/cbstats”, line 759, in main
c.execute()
File “/opt/couchbase/lib/python/clitool.py”, line 75, in execute
f[0](mc, *args[2:], **opts.dict)
File “/opt/couchbase/lib/python/cbstats”, line 37, in g
f(*args, **kwargs)
File “/opt/couchbase/lib/python/cli_auth_utils.py”, line 75, in g
mc.bucket_select(bucket)
File “/opt/couchbase/lib/python/mc_bin_client.py”, line 531, in bucket_select
return self._doCmd(memcacheConstants.CMD_SELECT_BUCKET, name, ‘’)
File “/opt/couchbase/lib/python/mc_bin_client.py”, line 211, in _doCmd
return self._handleSingleResponse(opaque)
File “/opt/couchbase/lib/python/mc_bin_client.py”, line 204, in _handleSingleResponse
cmd, opaque, cas, keylen, extralen, data = self._handleKeyedResponse(myopaque)
File “/opt/couchbase/lib/python/mc_bin_client.py”, line 200, in _handleKeyedResponse
raise MemcachedError(errcode, msg)
mc_bin_client.ErrorKeyEnoent: Memcached error #1: KEY_ENOENT : Not Found :

why did occur this error message? also, how do i use cbstats cli? please let me know.

Thanks,
Eddie.

Sounds like the user you are trying to use doesn’t have access to the specified bucket.

Can you try with a different user - say the admin user - and see if that works?

@drigby i tried another user that admin user and new user.
but, i can’t use cbstats. Is there another issue in cbstats?

Works for me here on macOS:

/Applications/Couchbase\ Server.app/Contents/Resources/couchbase-core/bin/cbstats \
    localhost:11210 -j -u stats -p password -b default all
{
    "accepting_conns": 1,
    "auth_cmds": 0,
    "auth_errors": 0,
    "bytes": 4336048,
...

The user you are specifying needs to have bucket admin access (IIRC) to read stats - check what roles your user has.

i know admin access role and i use admin account for viewing cbstats.
but couchbase cli occurred Error Message.

Traceback (most recent call last):
File “/opt/couchbase/lib/python/cbstats”, line 762, in
main()
File “/opt/couchbase/lib/python/cbstats”, line 759, in main
c.execute()
File “/opt/couchbase/lib/python/clitool.py”, line 75, in execute
f[0](mc, *args[2:], **opts.dict)
File “/opt/couchbase/lib/python/cbstats”, line 37, in g
f(*args, **kwargs)
File “/opt/couchbase/lib/python/cli_auth_utils.py”, line 75, in g
mc.bucket_select(bucket)
File “/opt/couchbase/lib/python/mc_bin_client.py”, line 531, in bucket_select
return self._doCmd(memcacheConstants.CMD_SELECT_BUCKET, name, ‘’)
File “/opt/couchbase/lib/python/mc_bin_client.py”, line 211, in _doCmd
return self._handleSingleResponse(opaque)
File “/opt/couchbase/lib/python/mc_bin_client.py”, line 204, in _handleSingleResponse
cmd, opaque, cas, keylen, extralen, data = self._handleKeyedResponse(myopaque)
File “/opt/couchbase/lib/python/mc_bin_client.py”, line 200, in _handleKeyedResponse
raise MemcachedError(errcode, msg)
mc_bin_client.ErrorKeyEnoent: Memcached error #1: KEY_ENOENT : Not Found :slight_smile:

only query node has occurred this message, data node not occurred.

cbstats only returns statistics from Data nodes, there’s no Data buckets on query-only nodes. This is expected behaviour.