Skip to main content

A tool for exporting (or importing) Datadog dashboards to (or from) json

Project description

Build Status

dashjson.py -- a Datadog tool

A tool for exporting (or importing) Datadog dashboards to (or from) json. It allows the Datadog dashboard definitions to be

  • version controlled as json files, and
  • migrated across Datadog accounts

Tested with Python 3.6.7 and datadog 0.26.0.

How to use

Create the credentials file containing the api_key and the app_key. Example content of the credentials file (your keys can be found at https://app.datadoghq.com/account/settings#api):

# cat ~/.dashjson.json
{
    "api_key": "abcdefg12345678",
    "app_key": "abcdefg987654321"
}

Install via pip:

python3 -m pip install --user dashjson

Show usage of the tool:

python3 -m dashjson -h

How to build (for contributors only)

These are the steps I used on Ubuntu 18.04.

Add the following lines to ~/.bashrc:

# Due to https://github.com/pypa/pipenv/issues/2122
export PATH="${HOME}/.local/bin:$PATH"

# Due to https://github.com/pypa/pipenv/issues/1382
export PIPENV_VENV_IN_PROJECT=true

Install pip and pipenv:

sudo apt install python3-pip
python3 -m pip install --user pipenv

Clone and set up the project locally:

git clone git@github.com:ouyi/dashjson.git
cd dashjson
pipenv install --dev
pipenv run python -m unittest
pipenv run python dashjson.py -h

Upload a release:

rm -rf build/ dist/
python setup.py sdist bdist_wheel
pip install . -vvv
python -m dashjson -h
vim setup.py # bump version
git add setup.py && git commit -m "Bump version"
git tag -a my_tag -m "My message"
git push origin master && git push origin --tags
python -m twine upload dist/*

TODOs

  1. Automatically determine the dashboard type

For import, the information is available in the input file. For export, we can first get a list of all screenboards and then check existence by id.

  1. Embed a code coverage badge

The coverage data can be generated with:

coverage run --source=dashjson -m unittest && coverage report && coverage-badge -f -o coverage.svg
  1. Automate the release process

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dashjson-0.1.5.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dashjson-0.1.5-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file dashjson-0.1.5.tar.gz.

File metadata

  • Download URL: dashjson-0.1.5.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7

File hashes

Hashes for dashjson-0.1.5.tar.gz
Algorithm Hash digest
SHA256 d33f3fb0cac75cdfcd8aee8b0f31e69f5037314c137c7461115ee247f198e9a7
MD5 1ba8d1a0799cbfa4f6460dd186e2ca0c
BLAKE2b-256 ed4aa619d799d43ff4c4d17fe734749214903f80b29d6ac2f4f64e905528ddd1

See more details on using hashes here.

File details

Details for the file dashjson-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: dashjson-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7

File hashes

Hashes for dashjson-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 769ba1705d606c44794d6afee1557699fbc5ff5acc4563d27d61c59b4415b97c
MD5 21ee92896147eae4beb0aa1e4316abc7
BLAKE2b-256 eb00842afeeddbefbca587cc7a7d7fce04557d752e0fbc2fcf1c29047b6a15e4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page