Skip to content
Gremlin attack support for the Chaos Toolkit
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
chaosgremlin
tests
.gitignore
.travis.yml
CHANGELOG.md
LICENSE
MANIFEST.in
README.md
ci.bash
pytest.ini
requirements.txt
setup.cfg
setup.py

README.md

chaostoolkit-gremlin

Build Status

Gremlin, Inc support for the Chaos Toolkit.

Install

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install chaostoolkit-gremlin

Usage

To use this package, you must create an account with Gremlin, Inc. Once registered, create a new organisation (formerly known as team). You may have to ask your Gremlin administrator to do this for you.

Once this is done, you must set the following environmental variables so the Chaos Toolkit can pick up them:

  • GREMLIN_EMAIL: the email used to register to Gremlin and associated to that organisation
  • GREMLIN_PWD: your password
  • GREMLIN_ORG_NAME: the organisation's name you created

Note that 2FA is not yet implemented in this package.

Next you need to specify to load those variables and inject them into this package's activities. At the top of the experiment file, add the following object:

{
    "secrets": {
        "gremlin": {
            "email": {
                "type": "env",
                "key": "GREMLIN_EMAIL"
            },
            "password": {
                "type": "env",
                "key": "GREMLIN_PWD"
            },
            "org_name": {
                "type": "env",
                "key": "GREMLIN_ORG_NAME"
            }
        }
    }
}

Finally, in all activities where you call a function from this package, make sure to add the following property:

"secrets": ["gremlin"]

Here is a full example of running a CPU attack experiment:

{
    "title": "Can our system handle a node being CPU-busy?",
    "description": "CPU-usage may be impactful on our response time",
    "secrets": {
        "gremlin": {
            "email": {
                "type": "env",
                "key": "GREMLIN_EMAIL"
            },
            "password": {
                "type": "env",
                "key": "GREMLIN_PWD"
            },
            "org_name": {
                "type": "env",
                "key": "GREMLIN_ORG_NAME"
            }
        }
    },
    "method": [
        {
            "name": "attack-on-cpu",
            "type": "action",
            "background": true,
            "provider": {
                "type": "python",
                "module": "chaosgremlin.actions",
                "func": "attack",
                "secrets": ["gremlin"],
                "arguments": {
                    "command": {
                        "type": "cpu"
                    },
                    "target": {
                        "type": "Random"
                    }
                }
            }
        }
    ]
}

Contribute

If you wish to contribute more functions to this package, you are more than welcome to do so. Please, fork this project, make your changes following the usual PEP 8 code style, sprinkling with tests and submit a PR for review.

You can’t perform that action at this time.