MongoDB Atlas Plugin
note
*** MongoDB detailed costs are currently only retrievable for the current month. Historical costs from prior months are queryable if previously obtained ***
Setup Guide
- Obtain plugin binary
- Visit https://github.com/opencost/opencost-plugins/releases and choose the most recent release
- Download the correct OpenAI binary for your architecture/OS
- Create a sibling directory to OpenCost called
plugins
- In plugins directory, create two sub directories:
bin
andconfig
- Put the plugin binary in the
bin
dir, ensure it is executable
- Visit the MongoDB Atlas organization administration platform and generate a public and private key
- Obtain the organization ID from the administration page
- Create
mongodb_atlas_config.json
in theconfig
dir, with the API key generated in the prior step:
{
"atlas_private_key": "<mongo_private_key>",
"atlas_public_key": "<mongo_public_key>",
"atlas_org_id":"<org_id>",
}
- Ensure you set the following env vars:
PLUGIN_EXECUTABLE_DIR
Should have the full path to thebin
dir you set upPLUGIN_CONFIG_DIR
Should have the full path to theconfig
dirCUSTOM_COST_ENABLED
Set to“true”
- Also, set
LOG_LEVEL
to‘debug’
- Add in any other env vars you normally pass to OpenCost
- Start the app
Using the MongoDB Atlas plugin via the Helm chart
- Update your local OpenCost Helm values file with the following settings:
loglevel: debug
plugins:
enabled: true
install:
enabled: true
fullImageName: curlimages/curl:latest
folder: /opt/opencost/plugin
# leave this commented to always download most recent version of plugins
#version: <INSERT_SPECIFIC_PLUGINS_VERSION>
# leave this commented to always download most recent version of plugins
# version: <INSERT_SPECIFIC_PLUGINS_VERSION>
# the list of enabled plugins
enabledPlugins:
- mongodb-atlas
# pre-existing secret for plugin configuration
configSecret: ""
configs:
mongodb-atlas: |
{
"atlas_private_key": "<mongo_private_key>",
"atlas_public_key": "<mongo_public_key>",
"atlas_org_id":"<org_id>",
}
opencost:
exporter:
cloudProviderApiKey: "AIzaSyDXQPG_MHUEy9neR7stolq6l0ujXmjJlvk"
- Install/update your helm deployment with the values
- Confirm that, after waiting a few minutes for ingestion, your MongoDB costs are available in the UI
- Logs should indicate that MongoDB costs are being fetched for recent windows
- Debug logging can be enabled via the configuration file for enhanced debugging
Example UI
Below is an example of visualizations from the MongoDB plugin in the OpenCost external costs UI: