Skip to content

Commit

Permalink
Updated docs with CLI changes
Browse files Browse the repository at this point in the history
  • Loading branch information
tomakehurst committed Apr 19, 2014
1 parent 5d6ce09 commit 47aea59
Showing 1 changed file with 8 additions and 24 deletions.
32 changes: 8 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,39 +50,23 @@ I'd welcome any feedback about successes/failures on other distros or versions.

Using the CLI
-------------
The command line interface supports three types of action:
* Define a new client/service
* Add a fault
* Reset all faults
The Saboteur package installs a CLI executable which can be used to configure and reset faults both locally and remotely.
Typing ``sab`` without arguments (or with ``-h``) will display usage information.

*Note: I'm not particularly keen on the defined client/service model for the CLI, so I'll probably change it to accept
host, port and direction directly when adding faults*

A client or service must first be defined before faults can be added or reset. You should define a client when the saboteur agent is running on the same host as client to a remote service. For instance if my application on host app01 connects to a database cluster on hosts db01 and db02 (listening on port 3306) and the saboteur agent is running on app01, I'd define a client:

``
$ sab define-client db --hosts app01 --to_port 3306
``

Then I can add some delay onto packets between my app and anything listening on port 3306:
To create a new fault:

``
$ sab add db --fault_type DELAY --delay 200 --variance 50 --distribution normal
$ sab add --fault_type NETWORK_FAILURE --to_port 8818 --direction IN --hosts myhost1,myhost2
``

When I want to put everything back to normal I can issue a reset:
To remove all faults:

``
$ sab reset db
$ sab reset --hosts myhost1,myhost2
``

When running the saboteur agent on the host of the service being depended on, define a service instead. If the agent is running on the database hosts from the previous example, define the service this way:

``
$ sab define-service db --hosts db01,db02 --to_port 3306
``
Note: omitting ``--hosts`` will cause commands to be sent to localhost.

Typing ``sab -h`` prints detailed usage information.

Using the HTTP API directly
---------------------------
Expand All @@ -96,7 +80,7 @@ Saboteur has a simple JSON over HTTP API. To add a new rule, simply POST to the
"correlation": 25 }' http://192.168.2.11:6660/
``

See [saboteur-tests.py](https://github.com/tomakehurst/saboteur/blob/master/saboteur/tests/saboteur-tests.py "saboteur-tests.py")
See [the tests](https://github.com/tomakehurst/saboteur/blob/master/tests/apicommands_tests.py "the tests")
for more examples of valid commands.

To reset all faults, send a DELETE request to the root path e.g.
Expand Down

0 comments on commit 47aea59

Please sign in to comment.