{"id":25456142,"url":"https://github.com/fujio-turner/cb-stats-demo","last_synced_at":"2025-06-18T00:34:54.635Z","repository":{"id":205707319,"uuid":"96288381","full_name":"Fujio-Turner/cb-stats-demo","owner":"Fujio-Turner","description":"Mine Couchbase Server Status to a Log","archived":false,"fork":false,"pushed_at":"2020-08-06T14:42:28.000Z","size":2497,"stargazers_count":2,"open_issues_count":2,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-16T16:50:25.551Z","etag":null,"topics":["sync-gateway"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Fujio-Turner.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2017-07-05T07:11:33.000Z","updated_at":"2021-08-27T15:37:03.000Z","dependencies_parsed_at":"2023-11-06T04:30:35.678Z","dependency_job_id":"478ccdb7-f49b-4e0f-b5a0-1f495c1c43f9","html_url":"https://github.com/Fujio-Turner/cb-stats-demo","commit_stats":null,"previous_names":["fujio-turner/cb-stats-demo"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Fujio-Turner/cb-stats-demo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fujio-Turner%2Fcb-stats-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fujio-Turner%2Fcb-stats-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fujio-Turner%2Fcb-stats-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fujio-Turner%2Fcb-stats-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Fujio-Turner","download_url":"https://codeload.github.com/Fujio-Turner/cb-stats-demo/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fujio-Turner%2Fcb-stats-demo/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260462708,"owners_count":23013161,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["sync-gateway"],"created_at":"2025-02-18T01:29:13.552Z","updated_at":"2025-06-18T00:34:49.619Z","avatar_url":"https://github.com/Fujio-Turner.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cb-stats-demo\nMine Couchbase Server Status to a Log\n\nCouchbase Server has great admin UI with lots of great metrics.\nThis script lets you capture those metrics and put them into a log.\n\n\u003cimg src=\"img/cb-stats-work.png\"\u003e\n\n**CONFIGURATION** \n\nOpen the config.json file and update your settings.\n```javascript\n\n{\n\"node\":\"9.9.9.9\",   \t  (Put in hostname or ip of the node for its stats or \"\" for the whole cluster)\n\"hostname\":\"127.0.0.1\",   (Put in hostname or ip of a node in the cluster)\n\"username\":\"readOnly\",    (Put in the read-only username)\n\"password\":\"password\",    (Put in the read-only password)\n\"path\":\"/path/you/want/cb-stats-demo/to/write/output(log)/\",\n\"dtFormat\":\"%Y-%m-%d %H:%M:%S\",\n\"debug\":false,\n\"port\":\"8091\",\n\"secure\":false\n}\n```\n**RUNNING**\n\nInsert into your cron tab \n```\n* * * * * /usr/bin/python /path/to/cb-stats-demo/cb-stats-demo.py\n```\n\nDateTime Output Format\n\nBy default the DateTime format output looks like this: 2020-08-05 19:23:10  or \"%Y-%m-%d %H:%M:%S\".\nIf you want the time output a little different go here: https://strftime.org/ and update the config.json file \"dtFormat\":\"here\"\n\n**LOGS**\n\n\u003cimg src=\"img/cb-stats-sys-data.png\"\u003e\n\n\u003cimg src=\"img/cb-stats-bucket-data.png\"\u003e\n**FAQ**\n\nQ:How big will the files/log get?\n\nA:It will roughly get about 750KB per minute per bucket per server or about 0.8GB per day per bucket per server. The more CB servies you are running like: N1QL , Eventing, Analytic and ...etc the bigger the file.\n\n\nQ:Will the file size grow forever?\n\nA: No, it is bound to a particular day. Example 2016-06-17_cbstats.txt will only have the stats for that day per server.\n\n\nQ:How do I get rid of the logs that are XYZ days old?\n\nA:Linux has a built in log rotation tool on the folder level. https://www.cyberciti.biz/faq/how-do-i-rotate-log-files/\nIn the future I'll come up with a built-in one.\n\n\nQ:Where does the script collect the metrics from?\n\nA:Couchbase Server has a REST end point on #http://{hostname}:8091/_uistats\nwhich spits out a JSON with all the metrics per node per bucket for the last 60 seconds.\n\n\nQ:Do I have to put my Couchbase Administrator username and password in the config file?\n\nA:No Couchbase lets you create a Read-Only user with username and password that you can put in the config file.\n\n\nQ:Can I collect all the stats for the whole cluster on one machine?\n\nQ:You can, but its best to run the script on each machine to capture its local stats and have a logging agent consume the logs and send them to a third party tool.\n\n\nCompatability: CB 6.5.x\n\nFor CB 6.0.x - Use Branch: 6.0.x\nFor CB 5.x   - Use Branch: cb/4.x\n\nCouchbase Admin GUI System stats ,example CPU, is now treated in the admin gui as a CB service with the data been as \"@system\" much like @analytics @query . If you have an older version of CB 4.x or older please pull/download the branch  cb/4.x.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffujio-turner%2Fcb-stats-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffujio-turner%2Fcb-stats-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffujio-turner%2Fcb-stats-demo/lists"}