An open API service indexing awesome lists of open source software.

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

Awesome Lists containing this project

README

          

# mongodb-influxdb

[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](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

```