https://github.com/cailloumajor/mongodb-influxdb
Manages data flow between MongoDB and InfluxDB
https://github.com/cailloumajor/mongodb-influxdb
database influxdb mongodb rust-lang tsdb
Last synced: about 2 months ago
JSON representation
Manages data flow between MongoDB and InfluxDB
- Host: GitHub
- URL: https://github.com/cailloumajor/mongodb-influxdb
- Owner: cailloumajor
- License: mit
- Created: 2022-11-25T15:31:34.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-02-20T06:44:18.000Z (over 1 year ago)
- Last Synced: 2025-02-20T07:33:18.641Z (over 1 year ago)
- Topics: database, influxdb, mongodb, rust-lang, tsdb
- Language: Rust
- Homepage:
- Size: 574 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# mongodb-influxdb
[](https://conventionalcommits.org)
## Specifications
This service is responsible for data flow between MongoDB and InfluxDB. It has following roles.
### Recording data from MongoDB to InfluxDB
This service will query the configured database and collection at regular interval (configured by a CLI argument), and send data points to InfluxDB (line protocol), one for each document in the collection. The measurement will be set to the namespace of the collection.
Data points will have following characteristics:
- document primary key (`_id`) as a tag value, with `id` as the tag key;
- each key and value pair in the `val` sub-document, respectively as field key and value;
## Data flow
```mermaid
sequenceDiagram
participant MongoDB
participant Me as This service
participant TSDB as InfluxDB
loop Each collect interval
Me->>+MongoDB: Query documents
MongoDB-->>-Me: Replies with documents
activate Me
Me-->Me: Converts documents to line protocol
deactivate Me
Me->>+TSDB: Writes data points
TSDB-->>-Me: Sends write result
end
```
## Usage
```console
$ mongodb-influxdb --help
Usage: mongodb-influxdb [OPTIONS] --mongodb-database --mongodb-collection --influxdb-api-token --influxdb-org --influxdb-bucket
Options:
--interval
Scraping interval [env: INTERVAL=] [default: 1m]
--mongodb-uri
URI of MongoDB server [env: MONGODB_URI=] [default: mongodb://mongodb]
--mongodb-database
MongoDB database [env: MONGODB_DATABASE=]
--mongodb-collection
MongoDB collection [env: MONGODB_COLLECTION=]
--influxdb-url
InfluxDB root URL [env: INFLUXDB_URL=] [default: http://influxdb:8086]
--influxdb-api-token
InfluxDB API token with write-buckets permission [env: INFLUXDB_API_TOKEN=]
--influxdb-org
InfluxDB organization name or ID [env: INFLUXDB_ORG=]
--influxdb-bucket
InfluxDB bucket to write to [env: INFLUXDB_BUCKET=]
-v, --verbose...
Increase logging verbosity
-q, --quiet...
Decrease logging verbosity
-h, --help
Print help
```