{ "info": { "author": "Kapil Thangavelu", "author_email": "kapil.foss@gmail.com", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Developers", "Operating System :: OS Independent", "Programming Language :: Python" ], "description": "Juju DB Introspection\n---------------------\n\nProvide introspection tools to understand the state of the system,\nincluding relation data which is normally opaque.\n\nThis is intended as a foresnic tool for advanced users to diagnose\nor examine the state of the environment.\n\n***Use at own risk. This can break between any juju versions***\n\nThis is very specific to the underlying database structures of any\ngiven juju version, which is an implementation detail subject to\nchange without notice.\n\nThat said the implementation here works across all extant releases of\njuju core. However past success is no guarantee of future compatiblity.\n\n*** Do no write to the db ***\n\nDo not attempt to write to any of these structures, bad things will\nhappen and you get to keep all the broken things. Use the juju api if\nyou need to modify something. Juju uses a mongodb client-side transaction\nlibrary that does multi-document mods atomically and is dependent on\nall writers using the same txn library. More details on that here for\nthe curious\n\nhttp://blog.labix.org/2012/08/22/multi-doc-transactions-for-mongodb\n\n\nInstall\n=======\n\nAvailable via pypi, dependencies are pymongo and pyyaml::\n\n $ pip install juju-dbinspect\n\nDepending on your provider and juju version you may need to open up\naccess to port 37017 on the state server (machine 0 if not ha).\n\n\nCLI Intro\n=========\n\n\nCLI Usage is documented via the built-in help::\n\n $ juju db --help\n\n juju db --help\n usage: juju-db [-h] [-e ENVIRONMENT] [-v] targets [targets ...]\n\n Juju database introspection\n\n Drop into an interactive python shell.\n $ juju db shell\n\n Get the last n transactions (default 100) that have modified the\n environment.\n $ juju db history [n]\n\n Get the names of all the services in the system.\n $ juju db services\n\n Get the names of all the units in the system.\n $ juju db units\n\n Get the details on machine 0.\n $ juju db 0\n\n Get the details on the unit mysql/0.\n $ juju db mysql/0\n\n Get the details on the mysql service::\n $ juju db mysql\n\n Get the relation settings for the mysql/0 unit in the wordpress relation::\n $ juju db mysql/0 wordpress\n\n\n positional arguments:\n targets\n\n optional arguments:\n -h, --help show this help message and exit\n -e ENVIRONMENT, --environment ENVIRONMENT\n Juju environment to operate on\n -v, --verbose Verbose output\n\n\n\nDB Interactive Shell\n====================\n\nAlso available with the same core functionality is a python interactive shell with access to the\ndb. The shell can be started with::\n\n kapil@realms-slice:~$ juju db shell -e syracuse\n Juju DB Shell\n >>>\n\nBasics entity iteration commands::\n\n >>> units()\n [u'message/0', u'db/0', u'identity/0', u'meter/0']\n >>> machines()\n [u'0', u'230', u'232', u'233', u'231']\n >>> services()\n [u'db', u'identity', u'message', u'meter']\n >>> pprint(relations())\n [u'db:cluster',\n u'message:cluster',\n u'identity:cluster',\n u'meter:identity-service identity:identity-service',\n u'identity:shared-db db:shared-db',\n u'meter:amqp message:amqp']\n\n\nLet's inspect machine 0's constraints::\n\n >> machine('0').constraints\n {u'cpupower': None, u'container': None, u'cpucores': None,\n u'mem': None, u'arch': None, u'rootdisk': None}\n\nWhat units are on machine 230::\n\n >> machine('230').units\n\n\nAnd what's going on with the meter/0 unit::\n\n >>> pprint(unit('meter/0'))\n\n {u'_id': u'meter/0',\n u'charmurl': u'local:precise/ceilometer-52',\n u'life': 0,\n u'machineid': u'233',\n u'ports': [{u'number': 8777, u'protocol': u'tcp'}],\n u'principal': u'',\n u'privateaddress': u'10.0.3.103',\n u'publicaddress': u'10.0.3.103',\n u'resolved': u'',\n u'series': u'precise',\n u'service': u'meter',\n u'subordinates': [],\n u'tools': {u'sha256': u'',\n u'size': 0L,\n u'url': u'',\n u'version': u'1.17.3.1-precise-amd64'}}\n\n\n >>> unit('meter/0').status\n {u'status': u'started', u'statusinfo': u'', u'statusdata': {}}\n\nLet's inspect the identity to metering service relation and look at the relation data\nof their units::\n\n >>> unit('meter/0').relation_data('identity')\n {u'_id': u'r#190#requirer#meter/0',\n u'admin_url': u'http://10.0.3.103:8777',\n u'internal_url': u'http://10.0.3.103:8777',\n u'private-address': u'10.0.3.103',\n u'public_url': u'http://10.0.3.103:8777',\n u'region': u'RegionOne',\n u'requested_roles': u'ResellerAdmin',\n u'service': u'ceilometer'}\n\n >>> unit('identity/0').relation_data('meter')\n {u'_id': u'r#190#provider#identity/0',\n u'admin_token': u'witieweithoinaiwuojeFiepuneiseye',\n u'auth_host': u'10.0.3.27',\n u'auth_port': u'35357',\n u'auth_protocol': u'https',\n u'ca_cert': u'omitted for brevity',\n u'https_keystone': u'True',\n u'private-address': u'10.0.3.27',\n u'service_host': u'10.0.3.27',\n u'service_password': u'eingahVeehivaiHahnohngahTooYizei',\n u'service_port': u'5000',\n u'service_protocol': u'https',\n u'service_tenant': u'services',\n u'service_username': u'ceilometer',\n u'ssl_cert': u'omitted for brevity',\n u'ssl_key': u'omitted for brevity'}\n >>>\n\n\nWe can also examine the history of the environment via introspection of the transaction log::\n\n >>> history()\n\n 2014/03/06-19:31:39 applied\n units:message/0 update {u'$set': {u'privateaddress': u'10.0.3.215'}}\n 2014/03/06-19:31:39 applied\n units:message/0 update {u'$set': {u'publicaddress': u'10.0.3.215'}}\n 2014/03/06-19:31:40 applied\n settingsrefs:s#message#local:precise/rabbitmq-server-146 update {u'$inc': {u'refcount': 1}}\n units:message/0 update {u'$set': {u'charmurl': u'local:precise/rabbitmq-server-146'}}\n 2014/03/06-19:33:07 applied\n units:message/0 update {u'$addToSet': {u'ports': {u'protocol': u'tcp', u'number': 5672}}}\n 2014/03/06-19:33:08 applied\n units:message/0 cond {u'life': {u'$ne': 2}}\n statuses:u#message/0 update {u'$set': {u'status': u'installed', u'statusdata': {}, u'statusinfo': u''}}\n 2014/03/06-19:33:08 applied\n units:message/0 update {u'$pull': {u'ports': {u'protocol': u'tcp', u'number': 55672}}}\n 2014/03/06-19:33:09 applied\n units:message/0 update {u'$addToSet': {u'ports': {u'protocol': u'tcp', u'number': 5671}}}\n 2014/03/06-19:33:13 applied\n units:message/0 cond {u'life': {u'$ne': 2}}\n statuses:u#message/0 update {u'$set': {u'status': u'started', u'statusdata': {}, u'statusinfo': u''}}\n 2014/03/06-19:33:13 applied\n units:message/0 cond {u'life': 0}\n relations:message:cluster update {u'$inc': {u'unitcount': 1}}\n settings:r#198#peer#message/0 create {u'private-address': u'10.0.3.215'}\n relationscopes:r#198#peer#message/0 create {u'_id': u'r#198#peer#message/0'}\n 2014/03/06-19:33:43 applied\n units:identity/0 cond {u'life': 0}\n relations:identity:cluster update {u'$inc': {u'unitcount': 1}}\n settings:r#197#peer#identity/0 create {u'private-address': u'10.0.3.80'}\n relationscopes:r#197#peer#identity/0 create {u'_id': u'r#197#peer#identity/0'}\n 2014/03/06-19:33:52 applied\n units:identity/0 cond {u'life': 0}\n relations:identity:shared-db db:shared-db update {u'$inc': {u'unitcount': 1}}\n settings:r#200#requirer#identity/0 create {u'private-address': u'10.0.3.80'}\n relationscopes:r#200#requirer#identity/0 create {u'_id': u'r#200#requirer#identity/0'}\n 2014/03/06-19:33:52 applied\n units:db/0 cond {u'life': 0}\n relations:identity:shared-db db:shared-db update {u'$inc': {u'unitcount': 1}}\n settings:r#200#provider#db/0 create {u'private-address': u'10.0.3.225'}\n relationscopes:r#200#provider#db/0 create {u'_id': u'r#200#provider#db/0'}\n 2014/03/06-19:33:52 applied\n units:message/0 cond {u'life': 0}\n relations:meter:amqp message:amqp update {u'$inc': {u'unitcount': 1}}\n settings:r#199#provider#message/0 create {u'private-address': u'10.0.3.215'}\n relationscopes:r#199#provider#message/0 create {u'_id': u'r#199#provider#message/0'}\n 2014/03/06-19:33:53 applied\n settings:r#199#provider#message/0 update {u'$set': {u'hostname':\n u'10.0.3.215', u'ssl_port': u'5671', u'ssl_ca':'value_omitted'}\n u'$unset': {}}\n\n\nAvailable helper commands\n\n - units\n - unit\n - services\n - service\n - machines\n - machine\n - relations\n - relation\n - charms", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/kapilt/juju-dbinspect", "keywords": null, "license": "BSD", "maintainer": null, "maintainer_email": null, "name": "juju-dbinspect", "package_url": "https://pypi.org/project/juju-dbinspect/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/juju-dbinspect/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/kapilt/juju-dbinspect" }, "release_url": "https://pypi.org/project/juju-dbinspect/0.1.6.1/", "requires_dist": null, "requires_python": null, "summary": "Juju database introspection", "version": "0.1.6.1" }, "last_serial": 1212217, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "6a01a215d765e9bc82b7bd98ede326b2", "sha256": "819206e65dbecdcec31f59bec071aed9ced707a95676066d4562bb56e8f79b11" }, "downloads": -1, "filename": "juju-dbinspect-0.1.0.tar.gz", "has_sig": false, "md5_digest": "6a01a215d765e9bc82b7bd98ede326b2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8989, "upload_time": "2014-03-13T13:17:22", "url": "https://files.pythonhosted.org/packages/c2/2a/49053ef265ae17cc59aa535a9102fce01266b8e994a77250c4c920aeb8a3/juju-dbinspect-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "72dbe18eaa774d01f3bb2b1b9c0b7c12", "sha256": "5b987336b3e40680537513e3d481d257e59bfc00d7ffaf1917377fae97570325" }, "downloads": -1, "filename": "juju-dbinspect-0.1.1.tar.gz", "has_sig": false, "md5_digest": "72dbe18eaa774d01f3bb2b1b9c0b7c12", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9887, "upload_time": "2014-03-13T13:19:19", "url": "https://files.pythonhosted.org/packages/33/46/6290f2055199678849dd4d74f5a582358848c5d9741a52cd2660cc4f66f3/juju-dbinspect-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "1c3c7ad551007bd2f45e7380cbc77d34", "sha256": "1a1f31b8e1706d5353efb769405b70c9a54e74463b2f06495d5b7b84a33b0867" }, "downloads": -1, "filename": "juju-dbinspect-0.1.2.tar.gz", "has_sig": false, "md5_digest": "1c3c7ad551007bd2f45e7380cbc77d34", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9902, "upload_time": "2014-03-13T13:21:31", "url": "https://files.pythonhosted.org/packages/87/70/43a25185bb1c62171529ebf38f7fde846f13ec18b61eade895dca3fe066e/juju-dbinspect-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "14e259756f5317110c548d310c99f5b8", "sha256": "d37cf6e344d61e7fd12a645eca563f513847e42a6fa714b96113c69945e6507a" }, "downloads": -1, "filename": "juju-dbinspect-0.1.3.tar.gz", "has_sig": false, "md5_digest": "14e259756f5317110c548d310c99f5b8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9975, "upload_time": "2014-03-13T16:34:41", "url": "https://files.pythonhosted.org/packages/01/45/43fbb800c545a0f53214e2f94397fd688a6c6489262f5864c9497d790a34/juju-dbinspect-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "dbd5ef8574690faa6bbb9abd6e95d7fd", "sha256": "9bd1257b4844c077875f6a5543cb6a4d2d59bbd056adc30b53a28f4f156b859a" }, "downloads": -1, "filename": "juju-dbinspect-0.1.4.tar.gz", "has_sig": false, "md5_digest": "dbd5ef8574690faa6bbb9abd6e95d7fd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10192, "upload_time": "2014-03-24T22:27:22", "url": "https://files.pythonhosted.org/packages/7b/f7/469bcc1733a83f87b007d954975b87cf21e0b8a4c3c7df0d82f651a923c7/juju-dbinspect-0.1.4.tar.gz" } ], "0.1.5": [ { "comment_text": "", "digests": { "md5": "bc3f8b500656e03f313be251fc451a0f", "sha256": "171f6a803d8b6493446e8db0cadd2f2f226235f5dd211b1000ec810daffad86f" }, "downloads": -1, "filename": "juju-dbinspect-0.1.5.tar.gz", "has_sig": false, "md5_digest": "bc3f8b500656e03f313be251fc451a0f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10220, "upload_time": "2014-03-28T16:44:51", "url": "https://files.pythonhosted.org/packages/ff/97/c5310431cbd1a2076268e1f92b70e4ec377a56fa2b8f95e518cd909c06f2/juju-dbinspect-0.1.5.tar.gz" } ], "0.1.6": [ { "comment_text": "", "digests": { "md5": "adec0d4679997de4bd9ed00ec7444f6d", "sha256": "3ca691b3c11fc84a01ebdd61e8e5732112ecf36c48bd0d7315f02d11c5135409" }, "downloads": -1, "filename": "juju-dbinspect-0.1.6.tar.gz", "has_sig": false, "md5_digest": "adec0d4679997de4bd9ed00ec7444f6d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10150, "upload_time": "2014-09-03T20:46:25", "url": "https://files.pythonhosted.org/packages/ee/c4/584498eca8d6f0062be0243055a1ab8ea46d985452edbfce507c2224c320/juju-dbinspect-0.1.6.tar.gz" } ], "0.1.6.1": [ { "comment_text": "", "digests": { "md5": "819e0688bf40685375bc112a3695d160", "sha256": "285494550dfe6b0de6a5ed9eaf1b175cf566a1d928c129da852600c9253d4958" }, "downloads": -1, "filename": "juju-dbinspect-0.1.6.1.tar.gz", "has_sig": false, "md5_digest": "819e0688bf40685375bc112a3695d160", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10152, "upload_time": "2014-09-03T22:53:04", "url": "https://files.pythonhosted.org/packages/fb/bd/04db810aec93aa55554386d95d5435881dca6103908e74c3b52f51cf4726/juju-dbinspect-0.1.6.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "819e0688bf40685375bc112a3695d160", "sha256": "285494550dfe6b0de6a5ed9eaf1b175cf566a1d928c129da852600c9253d4958" }, "downloads": -1, "filename": "juju-dbinspect-0.1.6.1.tar.gz", "has_sig": false, "md5_digest": "819e0688bf40685375bc112a3695d160", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10152, "upload_time": "2014-09-03T22:53:04", "url": "https://files.pythonhosted.org/packages/fb/bd/04db810aec93aa55554386d95d5435881dca6103908e74c3b52f51cf4726/juju-dbinspect-0.1.6.1.tar.gz" } ] }