mongo databases and collections statistics fdw for postgresql
Project description
Mongo database and collection statistics foreign data wrapper for PostgreSQL written in python.
dependencies
installation
install python module
from sources (bitbucket)
$ git clone https://bitbucket.org/olshevskiy87/mongostat_fdw.git $ cd mongostat_fdw $ python setup.py installusing pip
$ pip install mongostat_fdw
create extension “multicorn” in postgresql (e.g. using psql)
$$ create extension multicorn;
create foreign servers
$$ CREATE SERVER mongostat_fdw_db FOREIGN DATA WRAPPER multicorn OPTIONS ( wrapper 'mongostat_fdw.MongoDBStatFDW' );$$ CREATE SERVER mongostat_fdw_coll FOREIGN DATA WRAPPER multicorn OPTIONS ( wrapper 'mongostat_fdw.MongoCollStatFDW' );create foreign tables
$$ CREATE FOREIGN TABLE mongo_db_stat ( "avgObjSize" NUMERIC, collections INT, "dataFileVersion" JSONB, -- for Postgres 9.4+ or JSON, or (at least) TEXT "extentFreeList" JSONB, -- Mongo 3.0.0+ "dataSize" NUMERIC, db TEXT, "fileSize" NUMERIC, "indexSize" NUMERIC, indexes INT, "nsSizeMB" BIGINT, "numExtents" INT, objects INT, ok NUMERIC, "storageSize" NUMERIC, "extentFreeList" JSONB -- for Postgres 9.4+ or JSON, or (at least) TEXT ) SERVER mongostat_fdw_db OPTIONS ( -- uri 'mongodb://127.0.0.1:27017', host '127.0.0.1', port '27017', db 'test' );$$ CREATE FOREIGN TABLE mongo_coll_stat ( "avgObjSize" NUMERIC, count INT, "indexSize" JSONB, "lastExtentSize" NUMERIC, nindexes INT, ns TEXT, "numExtents" INT, ok NUMERIC, "paddingFactor" NUMERIC, size NUMERIC, "storageSize" NUMERIC, "systemFlags" INT, "totalIndexSize" NUMERIC, "userFlags" INT ) SERVER mongostat_fdw_coll OPTIONS ( db 'test' );
usage
get “test” database statistics
$$ select db, "fileSize", "dataSize", "avgObjSize", indexes, "dataFileVersion"
from mongo_db_stat;
db | fileSize | dataSize | avgObjSize | indexes | dataFileVersion
-------+----------+----------+---------------+---------+--------------------------
local | 67108864 | 2840 | 405.714285714 | 1 | {"major": 4, "minor": 5}
admin | 0 | 0 | 0.0 | 0 | {}
(2 rows)
get “test” database collections statistics
$$ select ns as tbl_name, size, "storageSize", count
from mongo_coll_stat;
tbl_name | size | storageSize | count
---------------------+------+-------------+-------
test.system.indexes | 72 | 4096 | 1
test.test_coll | 344 | 4096 | 7
(2 rows)
external links
license
Copyright (c) 2016 Dmitriy Olshevskiy. MIT LICENSE.
See LICENSE.txt for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mongostat_fdw-0.0.1.tar.gz.
File metadata
- Download URL: mongostat_fdw-0.0.1.tar.gz
- Upload date:
- Size: 3.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bd2826f5f8d64d54f5fa106965fea6994947aa075662e841903c2ff6da84b783
|
|
| MD5 |
67962f9ea18b2fadf40f8a0b4196d601
|
|
| BLAKE2b-256 |
487a6b4bdd38f6b8cfba42acd2ea9a48615a74a7e9f64eb51adbf990f52e7bf7
|
File details
Details for the file mongostat_fdw-0.0.1-py2-none-any.whl.
File metadata
- Download URL: mongostat_fdw-0.0.1-py2-none-any.whl
- Upload date:
- Size: 6.0 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
08085b3ff6c9c6041f5230dfda044428682c2415c62322c102ef4cb031ae77bb
|
|
| MD5 |
3e7fed72f08af602ca41b5a98bbc4b61
|
|
| BLAKE2b-256 |
9888898c4196c652624a9417293fc8d08b9bbe7d0e77b7f8e505d701679ff508
|