How to Setup Chaos Monkey to Assess the Resilience of the Server’s Network on a Linux Machine

How to Setup Chaos Monkey to Check Network Resilience

Chaos Monkey stands out as a pivotal tool in server and network administration. Developed by Netflix, it’s designed to randomly terminate instances in production to ensure that engineers implement their services to be resilient to instance failures. By introducing controlled chaos into your system, you can identify vulnerabilities and rectify them before they become critical issues.

This tutorial will guide you through the process of setting up Chaos Monkey on a Linux machine to assess the resilience of your server’s network. Before diving in, it’s essential to understand the importance of such tools. In today’s digital age, where uptime and reliability can make or break a business, tools like Chaos Monkey are invaluable. They help ensure that your infrastructure can withstand unexpected disruptions.

Let’s get started.


  • A Linux machine (Ubuntu, CentOS, or any other distribution).
  • Root or sudo access to the machine.
  • Docker installed on the machine.


Start by updating your system’s package list:

sudo apt update

Install Docker if it’s not already installed:

sudo apt install

Pull the Chaos Monkey Docker image:

docker pull netflixoss/chaosmonkey


Create a configuration file for Chaos Monkey. This file will define which services or instances Chaos Monkey should target.

touch /etc/chaosmonkey/config.toml

Here is an example configuration file:

enabled = true
schedule_enabled = true
leashed = false
accounts = ["production", "test"]

host = ""
name = "chaosmonkey"
user = "chaosmonkey"
encrypted_password = "securepasswordgoeshere"

endpoint = ""

Edit the configuration file using a text editor like nano or vim. Define the services, regions, and other parameters as per your requirements.

See also  How to Use ‘fio’ to Measure the Speed of Data Reads/Writes on Storage Devices in Linux

Running Chaos Monkey:

Run the Chaos Monkey Docker container using the configuration file:

docker run -v /etc/chaosmonkey:/config netflixoss/chaosmonkey

Monitoring and Logging:

Chaos Monkey provides logs that can be monitored to understand which instances were terminated and when.

Use the following command to view the logs:

docker logs [container_id]

Safety Measures:

  • Always ensure you have backups of critical data before running Chaos Monkey.
  • Run Chaos Monkey in a controlled environment first, such as a staging or development environment, before deploying it in production.


  1. What is the primary purpose of Chaos Monkey?

    Chaos Monkey is designed to introduce controlled failures into systems to test their resilience and ensure that services can handle unexpected disruptions without significant downtime.

  2. Is it safe to run Chaos Monkey in a production environment?

    While Chaos Monkey is designed for production environments, it’s crucial to have backups and understand the potential impact. It’s recommended to first test in a controlled environment.

  3. How does Chaos Monkey choose which instances to terminate?

    Chaos Monkey’s behavior is determined by its configuration. You can specify which services or instances it should target, ensuring it aligns with your testing objectives.

  4. Can I schedule when Chaos Monkey runs?

    Yes, Chaos Monkey can be scheduled to run at specific times, allowing you to test system resilience during off-peak hours or planned maintenance windows.

  5. Do I need Docker to run Chaos Monkey?

    While Chaos Monkey can be run without Docker, using the Docker container simplifies the setup and deployment process, making it a recommended approach.

See also  How to Setup Nessus to Perform a Security Vulnerability Test on a Linux Machine

Commands Mentioned

  • sudo apt update – Updates the package list on the Linux machine.
  • sudo apt install – Installs Docker on the machine.
  • docker pull netflixoss/chaosmonkey – Pulls the Chaos Monkey Docker image.
  • touch /etc/chaosmonkey/config.toml – Creates a configuration file for Chaos Monkey.
  • docker run -v /etc/chaosmonkey:/config netflixoss/chaosmonkey – Runs the Chaos Monkey Docker container using the configuration file.
  • docker logs [container_id] – Views the logs of a specific Docker container.


Ensuring the resilience of your server’s network is paramount in today’s digital landscape. Downtime can lead to significant revenue loss, damage to brand reputation, and decreased user trust. By introducing tools like Chaos Monkey into your infrastructure, you’re taking a proactive approach to identify and rectify potential vulnerabilities.

Chaos Monkey, by design, challenges the traditional methods of system testing. Instead of waiting for an unexpected outage or disruption, it allows administrators to simulate these scenarios in a controlled manner. This proactive approach ensures that when real-world disruptions occur, your systems are well-equipped to handle them, minimizing downtime and ensuring a seamless user experience.

See also  How to Use ‘iotop’ to Measure the Speed of Data Reads/Writes on Storage Devices in Linux

Moreover, the insights gained from these tests are invaluable. They not only highlight the vulnerabilities but also provide a roadmap for enhancing system robustness. Regularly running Chaos Monkey and analyzing its results can lead to iterative improvements in your infrastructure.

For those who manage servers, whether it’s on dedicated servers, VPS servers, cloud hosting, or shared hosting, understanding and implementing resilience testing tools is no longer a luxury but a necessity. The digital ecosystem is evolving rapidly, and with it, the challenges and threats are also multiplying.

In conclusion, while Chaos Monkey might seem like a disruptive tool, its value in fortifying your server’s network cannot be overstated. By embracing such tools and the philosophy of chaos engineering, you’re not only preparing your systems for the unexpected but also ensuring that your users have a consistent and reliable experience, no matter what challenges arise. Remember, in the world of server administration, it’s always better to be proactive than reactive.


Leave a Reply

Your email address will not be published. Required fields are marked *