Skip to content
This repository has been archived by the owner on Sep 30, 2023. It is now read-only.

Commit

Permalink
Merge pull request #112 from madflojo/develop
Browse files Browse the repository at this point in the history
Release 2017.08
  • Loading branch information
madflojo authored Aug 3, 2017
2 parents 0a95715 + 0397ecb commit 1bfc172
Show file tree
Hide file tree
Showing 27 changed files with 635 additions and 31 deletions.
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ services:
- docker

install:
- cp config/config.yml.example config/config.yml
- docker build -t automatron .
- docker run -d -p 127.0.0.1:6378:6378 --name redis redis
- docker run -d --link redis:redis --name automatron automatron
Expand All @@ -19,7 +20,8 @@ before_script:

script:
- docker ps
- python tests.py
- docker logs automatron
- docker run --rm=True --link automatron:automatron --link redis:redis automatron python tests.py -i -f
- coverage run tests.py

after_success:
Expand Down
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ discovery: python -B discovery.py -c config/config.yml
runbooks: python -B runbooks.py -c config/config.yml
monitoring: python -B monitoring.py -c config/config.yml
actioning: python -B actioning.py -c config/config.yml
web: python -B web.py -c config/config.yml
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ Automatron is a framework for creating self-healing infrastructure. Simply put,

The goal of Automatron is to allow users to automate the execution of common tasks performed during system events. These tasks can be as simple as **sending an email** to as complicated as **restarting services across multiple hosts**.

![Automatron Dashboard](https://raw.githubusercontent.com/madflojo/automatron/develop/docs/img/dashboard.png)

## Features

* Automatically detect and add new systems to monitor
Expand Down
7 changes: 6 additions & 1 deletion actioning.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,16 @@ def update_target_status(item, target):
'CRITICAL' : 0,
'UNKNOWN' : 0
}
target['runbooks'][item['runbook']]['last_status'] = None
# Increase counts of status'
for check in item['checks'].keys():
# Update Status Counter
target['runbooks'][item['runbook']]['status'][item['checks'][check]] = (
target['runbooks'][item['runbook']]['status'][item['checks'][check]] + 1)
not_found.discard(item['checks'][check]) # Removes status from list of not found status'
# Update last_status with return
target['runbooks'][item['runbook']]['last_status'] = item['checks'][check]
# Removes status from list of not found status'
not_found.discard(item['checks'][check])

# Reset count to 0 for missing status'
for missing_status in not_found:
Expand Down
9 changes: 8 additions & 1 deletion config/config.yml.example
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ discovery:
# Web Service for HTTP PINGs
webping:
ip: 0.0.0.0
port: 8000
port: 9000
# roster:
# hosts:
# - 10.0.0.1
Expand All @@ -50,3 +50,10 @@ datastore:
db: 0
host: redis
port: 6379

## Web UI & API
web:
listen: 0.0.0.0
port: 8000
# Bootswatch theme - https://bootswatch.com/
theme: slate
2 changes: 1 addition & 1 deletion config/runbooks/init.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'*':
#'*':
## Example Runbooks
## ----------------
# - examples/disk_free
Expand Down
14 changes: 11 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,30 @@ version: '2'
services:
automatron:
build: .
ports:
- 8000:8000
volumes:
- ./templates:/templates
- ./static:/static
depends_on:
- redis
redis:
image: redis
test:
build: .
command: python /tests.py
command: python /tests.py -i -f
depends_on:
- redis
- automatron
mkdocs:
build:
context: .
dockerfile: docs/Dockerfile
volumes:
- ./:/tmp/mkdocs
ports:
- 8000:8000
command: mkdocs serve -a 0.0.0.0:8000
- 8080:8080
command: mkdocs serve -a 0.0.0.0:8080
coverage:
build: .
command: coverage run tests.py && coverage report
Binary file added docs/img/dashboard.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 5 additions & 3 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
![Automatron](https://raw.githubusercontent.com/madflojo/automatron/master/docs/img/logo_huge.png)

Automatron is a framework for creating self-healing infrastructure. Simply put, it detects system events & takes action to correct them.

The goal of Automatron is to allow users to automate the execution of common tasks performed during system events. These tasks can be as simple as **sending an email** to as complicated as **restarting services across multiple hosts**.

![Automatron Dashboard](/img/dashboard.png)

## Features

* Automatically detect and add new systems to monitor
Expand All @@ -13,6 +13,8 @@ The goal of Automatron is to allow users to automate the execution of common tas
* Allows dead simple **arbitrary shell commands** for both [checks](runbooks/checks.md) and [actions](runbooks/actions.md)
* Runbook flexibility with **Jinja2** templating support
* Pluggable Architecture that simplifies customization
* Bootstrap based dashboard showing real-time events


## Runbooks

Expand Down Expand Up @@ -94,4 +96,4 @@ By using **Facts** and **Jinja2** together you can customize a single runbook to

## Follow Automatron

[![Twitter Follow](https://img.shields.io/twitter/follow/automatronio.svg?style=flat-square)](https://twitter.com/automatronio) [![Gitter](https://badges.gitter.im/madflojo/automatron.svg)](https://gitter.im/madflojo/automatron?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) [![GitHub forks](https://img.shields.io/github/forks/madflojo/automatron.svg?style=social&label=Fork)](https://github.com/madflojo/automatron) [![GitHub stars](https://img.shields.io/github/stars/madflojo/automatron.svg?style=social&label=Star)](https://github.com/madflojo/automatron)
[![Twitter Follow](https://img.shields.io/twitter/follow/automatronio.svg?style=flat-square)](https://twitter.com/automatronio) [![Gitter](https://badges.gitter.im/madflojo/automatron.svg)](https://gitter.im/madflojo/automatron?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) [![GitHub stars](https://img.shields.io/github/stars/madflojo/automatron.svg?style=social&label=Star)](https://github.com/madflojo/automatron)
8 changes: 6 additions & 2 deletions docs/install/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,16 @@ The above `redis` instance will be used as a default datastore for Automatron.
Once the `redis` instance is up and running we can start an Automatron instance.

```sh
$ sudo docker run -d --link redis:redis -p 8000:8000 -v /path/to/config:/config --restart=always --name automatron madflojo/automatron
$ sudo docker run -d --link redis:redis -p 8000:8000 -p 9000:9000 -v /path/to/config:/config --restart=always --name automatron madflojo/automatron
```

In the above `docker run` command we are using `-v` to mount a directory from the host to the container as `/config`. This `/config` directory will be the home to Automatron's configuration files and Runbooks.

## Dashboard

To view the Automatron dashboard simply open up `http://<host ip>:8080` in your favorite browser. As target nodes are identified and runbooks are executed, events will start to be reflected on the dashboard.

With these steps complete, we can now move to [Configuring](/configure.md) Automatron.

!!! tip
!!! tip
A `docker-compose.yml` file is included in the base repository which can be used to quickly stand up environments using `docker-compose up automatron`.
4 changes: 4 additions & 0 deletions docs/install/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,7 @@ $ honcho start
```

To shut down Automatron you can use the `kill` command to send the `SIGTERM` signal to the running processes.

## Dashboard

To view the Automatron dashboard simply open up `http://<instance ip>:8080` in your favorite browser. As target nodes are identified and runbooks are executed, events will start to be reflected on the dashboard.
3 changes: 3 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ site_description: A framework for creating self-healing infrastructure. It simpl
site_author: Benjamin Cane
site_favicon: img/favicon.ico
theme: material
google_analytics:
- "UA-3378969-14"
- "auto"
extra:
logo: 'img/automatron.png'
social:
Expand Down
Empty file removed plugins/vetting/remote/.empty
Empty file.
15 changes: 15 additions & 0 deletions plugins/vetting/remote/ping.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash
## Ping server then return true or false JSON

if [ -z $1 ]
then
exit 1
fi

/bin/ping -c 1 $1 > /dev/null 2>&1
if [ $? -eq 0 ]
then
echo '{"ping": true}'
else
echo '{"ping": false}'
fi
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ mock
six>=1.7
coverage
boto3
flask
23 changes: 13 additions & 10 deletions runbooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,19 @@ def cache_runbooks(config, logger):
if runbooks:
for target in runbooks:
all_books[target] = {}
for books in runbooks[target]:
logger.debug("Processing book: {0}".format(books))
book_path = "{0}/{1}".format(config['runbook_path'], books)
if os.path.isdir(book_path):
book_path = book_path + "/init.yml"
if os.path.isfile(book_path) is False:
logger.warn("Runbook File Error: {0} is not a file".format(book_path))
else:
with open(book_path) as bh:
all_books[target][books] = bh.read()
if runbooks[target]:
for books in runbooks[target]:
logger.debug("Processing book: {0}".format(books))
book_path = "{0}/{1}".format(config['runbook_path'], books)
if os.path.isdir(book_path):
book_path = book_path + "/init.yml"
if os.path.isfile(book_path) is False:
logger.warn("Runbook File Error: {0} is not a file".format(book_path))
else:
with open(book_path) as bh:
all_books[target][books] = bh.read()
else:
logger.warn("Error: No runbooks specified under {0}".format(target))
return all_books

def render_runbooks(runbook, facts):
Expand Down
Binary file added static/img/automatron.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/banner.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 1bfc172

Please sign in to comment.