Datrium Proactive Protection for Natural Hazards is now on Docker
I recently released a set of Python components that make Datrium take pro-active virtual machine snapshots and replicate them upon detection of high winds, high temperature, or earthquakes in a defined region.
The reason I built the tool is to enable real-time weather and geological monitoring using real-time data from the U.S. Geological Survey and to trigger actions under certain conditions.
While it is simple to use the tool, it does require Python knowledge and the creation of an environment to run the scripts and modules.
For this reason, I converted the tool into a Docker container that can be instantiated and updated on-demand without the need to know anything about Python.
The container can be downloaded from here.
Before starting, make sure Docker and Docker-Compose are both installed in your system.
mkdir datrium_natural_hazard_protection
cd datrium_natural_hazard_protection
touch docker-compose.yml
vi docker-compose.yml
Copy/Paste the content below into docker-compose.yml, replacing and adding values where necessary. You must register for a free API key with OpenWeather at https://home.openweathermap.org/users/sign_up and add to the pyowm_api_key value.
version: "3"
services:
com.myvirtualcloud.dvx.automation:
image: andreleibovici/datrium_natural_hazard_protection:latest
environment:
# Location (City)
- prod_location_city=Auckland
# Country Abbreviation (2-digit)
- prod_location_country=NZ
# DVX Fully-Qualified-Domain-Name
- prod_dvx_fqdn=DVX_FQDN
# DVX Admin username
- prod_dvx_username=admin
# DVX Admin Password
- prod_dvx_password=PASSWORD
# Choose true or false to enable snapshots replication
- repl_replicate=false
# Replication site target as configures in DVX
- repl_location=DVX_NAME
# Retain snapshot for the specified amount of time (in seconds) from current time.
# Use 'forever' to retain the snapshot forever.
- snapshot_retention=3600
# Filename containing list of vms to protect
- vms_to_protect_filename=vms_to_protect.txt
# Frequency to check for natural hazard events (seconds) and snapshot/replicate
- frequency_check=300
# Km/h
- wind_speed_max=40
# Celsius
- temperature_max=45
# Richter scale minimum earthquaque magnitude
- quake_magnitude_min=4
# "hour", "day", "week", "month"
- quake_period=hour
# You MUST provide a valid public API key from pyowm
- pyowm_api_key=YOUR_PYOWM_API_KEY
volumes:
- /path/vms_to_protect.txt:/vms_to_protect.txtYou will need to make sure a file name vms_to_protect.txt is available in the directory, and this file must have the VMs to be protected. Here is an example:
Citrix-01
MySQL-Linux-01
MySQL-Linux-02
epic-cache01
epic-clarity01
pgress-01
(EOF)
Download and start the Docker image using docker-compose:
docker pull andreleibovici/datrium_natural_hazard_protection docker-compose up -d
To the application check logs, use:
docker-compose logs -f

This article was first published by Andre Leibovici (@andreleibovici) at myvirtualcloud.net