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

Commit fc1160b

Browse files
authored
Merge pull request #90 from madflojo/develop
Ready for 2017.01-beta release
2 parents 34c2b7f + 0c8cb79 commit fc1160b

22 files changed

+690
-112
lines changed

CONTRIBUTING.md

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# Contributing to Automatron
2+
3+
Community contributions are essential to the growth of Automatron. Both code and documentation contributions are not only welcomed, they are encouraged. The following guidelines will explain how to get started with contributing to this project.
4+
5+
## Accept our Contributor License Agreement
6+
7+
Before starting to contribute to Automatron please review and accept our [Contributor License Agreement](https://goo.gl/forms/44vauc2jjlNlln2t1)
8+
9+
## Core vs. Plugins
10+
11+
Contributing to the Core platform and contributing Plugins have two different guidelines and requirements. The below will explain some basic concepts of how to contribute different functionality.
12+
13+
### Core
14+
15+
Automatron follows a pluggable architecture with the majority of features being provided by plugins located within the `plugins/` directory. This allows us to keep the Core framework minimal and simple.
16+
17+
At this time there are 4 primary core components of Automatron.
18+
19+
* `discovery` - This component is used to launch node Discovery plugins which serve the purpose of finding new nodes to monitor.
20+
* `runbooks` - The Runbooks component is used to parse and update the monitoring and actioning "rules" applied to monitored nodes.
21+
* `monitoring` - Monitoring is a component that is used to schedule defined checks as well as launching and executing the defined check.
22+
* `actioning` - The Actioning component listen for events based on checks and performs actions specified within Runbooks.
23+
24+
These components are written in Python and as such should follow basic Python development practices.
25+
26+
### Plugins
27+
28+
Where the Automatron Core provides a monitoring and actioning framework, the functional features are all provided by Automatron Plugins. Plugins, are the fastest way to add features to Automatron. As such it is suggested that new contributors start by adding a plugin before adding core functionality.
29+
30+
#### Executable Plugins
31+
32+
At this time there are 6 types of Plugins.
33+
34+
* `actions` - Executables used to perform corrective actions.
35+
* `checks` - Executables used to check system health (Nagios compatible).
36+
* `datastores` - Python modules used by Automatron Core to access datastores.
37+
* `discovery` - Python modules used by Automatron to automatically detect new monitoring targets.
38+
* `logging` - Python modules used to provide custom logging mechanisms to Automatron Core.
39+
* `vetting` - Executables used to identify `facts` for discovered monitoring targets.
40+
41+
While `datastores`, `logging`, and `discovery` plugins are Python modules; `actions`, `checks` and `vetting` are simply executables.
42+
Python is the preferred approach however, these plugins may also be written in Perl or BASH. While other languages are accepted it is important to ensure capabilities are available across as many platforms as possible. When writing plugins do consider the availability of functionality on generic systems.
43+
44+
## Contribution Workflow & Requirements
45+
46+
Automatron follows a workflow very similar to the GitHub flow.
47+
48+
Pull Requests for new features should be opened against the `develop` branch. It is recommended to create a feature branch on your local repository from the `develop` branch to avoid merge conflicts or and ease the integration process.
49+
50+
```console
51+
$ git checkout develop
52+
$ git checkout -b new-feature
53+
```
54+
55+
Periodically the `develop` branch will be merged into the `master` branch to start the process of creating a new release. Prior to merging changes into `master` a release branch will be created for the previous release base.
56+
57+
When opening a Pull Request for a bug fix, if the fix is for the current release, the Pull Request should be opened to the `master` branch. If the fix is for a previous release, the Pull Request should be opened to the release specific branch.
58+
59+
If the bug fix should also be incorporated with the `develop` branch a second Pull Request should be opened to the `develop` branch.
60+
61+
### Tests are required for Core and some Plugins
62+
63+
Any Pull Requests for the Automatron core code base should include applicable `unit`, `integration` and `functional` tests. Automatron uses Coveralls to ensure code coverage does not decrease with each Pull Request.
64+
65+
While not strictly enforced, plugins should also include tests where applicable. In some cases it may not be possible to provide `unit` or `integration` tests for plugins. In these cases it is recommended to create `functional` tests.
66+
67+
### Documentation is required
68+
69+
Documentation of new functionality is important to increase the adoption of Automatron. As such, you may be asked to provide documentation for new functionality created by your Pull Request. This is especially true for new plugins being submitted as plugins must be documented in order for users to adopt the plugin.
70+
71+
Documentation is just as important as new functionality, as such documentation based pull requests are encouraged. For idea's on current gaps please reference our [documentation board](https://github.com/madflojo/automatron/projects/1).
72+
73+
## Developer environment
74+
75+
To ease the development and testing experience of Automatron a `docker-compose` environment has been created and is included within the repository.
76+
77+
To launch a local instance of Automatron simply execute the following `docker-compose` command.
78+
79+
```console
80+
$ sudo docker-compose up --build automatron
81+
```
82+
83+
If you wish to execute tests you can do so by running the following `docker-compose` command.
84+
85+
```console
86+
$ sudo docker-compose up --build test
87+
```
88+
89+
To test documentation updates you can launch a `mkdocs` container as well.
90+
91+
```console
92+
$ sudo docker-compose up --build mkdocs
93+
```
94+
95+
To wipe and reset the `docker-compose` environment simply run the following.
96+
97+
```console
98+
$ sudo docker-compose kill automatron redis
99+
$ sudo docker-compose rm automatron redis tests mkdocs
100+
```

Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ RUN apt-get update --fix-missing && \
55
python-pip \
66
python-dev \
77
nmap \
8-
curl
8+
curl \
9+
libffi-dev \
10+
build-essential \
11+
libssl-dev
912
ADD requirements.txt /
1013
RUN pip install --upgrade setuptools
1114
RUN pip install -r /requirements.txt

config/config.yml.example

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,24 +27,34 @@ discovery: # Discovery Configurations
2727
upload_path: /tmp/
2828
vetting_interval: 30
2929
plugins:
30-
## Start web service for HTTP GET or POST requests
31-
webping:
30+
webping: # Web Service for HTTP GET or POST requests
3231
ip: 0.0.0.0
3332
port: 20000
34-
## Use NMAP to find new hosts
35-
# nmap:
33+
# nmap: # NMAP Scanning for new hosts
3634
# target: 10.0.0.1/8
3735
# flags: -sP
3836
# interval: 40
39-
## Query DigitalOcean
40-
# digitalocean:
37+
# digitalocean: # Query DO's API
38+
# url: https://api.digitalocean.com/v2
4139
# api_key: example
4240
# interval: 60
41+
# aws: # Query AWS' API
42+
# aws_access_key_id: example
43+
# aws_secret_access_key: example
44+
# interval: 60
45+
# filter:
46+
# - PublicIpAddress
47+
# - PrivateIpAddress
48+
# linode:
49+
# url: https://api.linode.com
50+
# api_key: example
51+
# interval: 60
52+
4353

4454
datastore: # Datastore Configurations
4555
## Default Datastore Engine
4656
engine: redis
47-
## Datastore Specific configuration
57+
## Datastore Specific configuration
4858
plugins:
4959
## Redis
5060
redis:

docker-compose.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@ services:
99
test:
1010
build: .
1111
command: python /tests.py
12+
mkdocs:
13+
image: thinkcube/mkdocs
14+
volumes:
15+
- ./:/automatron
16+
ports:
17+
- 8000:8000
18+
working_dir: /automatron
19+
command: mkdocs serve -a 0.0.0.0:8000
1220
coverage:
1321
build: .
1422
command: coverage run tests.py && coverage report

docs/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ actions:
9090

9191
## Next Steps
9292

93-
* Follow our quick start guide: [Automatron in 10 minutes](Automatron-in-10-minutes)
93+
* Follow our quick start guide: [Automatron in 10 minutes](automatron-in-10-minutes)
9494
* Check out [example Runbooks](https://github.com/madflojo/automatron/tree/master/config/runbooks/examples) for automating common tasks
9595
* Read our [Runbook Reference](Runbooks) documentation to better understand the anatomy of a Runbook
9696
* Deploy a [Docker container](https://hub.docker.com/r/madflojo/automatron/) instance of Automatron

docs/plugins/discovery/aws.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
The `aws` Discovery plugin is used to discover new instances on Amazon Web Services. This plugin will periodically check AWS and add all identified instances to the "potential targets" queue.
2+
3+
## Configuration
4+
5+
This plugin does require some configuration in Automatron's master configuration file `config.yml`.
6+
7+
```yaml
8+
discovery:
9+
plugins:
10+
aws:
11+
aws_access_key_id: example
12+
aws_secret_access_key: example
13+
interval: 60
14+
filter:
15+
- PublicIpAddress
16+
- PrivateIpAddress
17+
```
18+
19+
The `aws` plugin requires four configuration items.
20+
21+
* `aws_access_key_id` - This an Key ID for AWS
22+
* `aws_secret_access_key` - This is the secret key used to authenticate with AWS
23+
* `interval` - This is the frequency to query Digital Ocean's API
24+
* `filter` - This is used to define whether Public or Private IP addresses are used for target identification

docs/plugins/discovery/digitalocean.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@ This plugin does require some configuration in Automatron's master configuration
88
discovery:
99
plugins:
1010
digitalocean:
11+
url: http://example.com
1112
api_key: example
1213
interval: 60
1314
```
1415
1516
The `digitalocean` plugin requires two configuration items.
1617

17-
* `api_key` - This is the Digital Ocean API key.
18+
* `url` - This is the URL of Digital Ocean's API
19+
* `api_key` - This is the Digital Ocean API key
1820
* `interval` - This is the frequency to query Digital Ocean's API

docs/plugins/discovery/linode.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
The `linode` Discovery plugin is used to discover new Linode servers. This plugin will periodically perform an HTTP GET request against Linode's API. All servers identified are then added to the "potential targets" queue.
2+
3+
## Configuration
4+
5+
This plugin does require some configuration in Automatron's master configuration file `config.yml`.
6+
7+
```yaml
8+
discovery:
9+
plugins:
10+
linode:
11+
url: http://example.com
12+
api_key: example
13+
interval: 60
14+
```
15+
16+
The `linode` plugin requires three configuration items.
17+
18+
* `url` - This is the URL to Linode's API
19+
* `api_key` - This is the Linode API key
20+
* `interval` - This is the frequency to query Linode's API

docs/plugins/discovery/roster.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
The `roster` Discovery plugin is used to discover new hosts via the Automatron base configuration file. This plugin allows users to simply specify hosts within the main configuration file `config/config.yml`.
2+
3+
## Configuration
4+
5+
This plugin requires configuration in Automatron's master configuration file `config.yml`.
6+
7+
```yaml
8+
discovery:
9+
plugins:
10+
roster:
11+
hosts:
12+
- 10.0.0.1
13+
- 10.0.0.3
14+
```
15+
16+
The `roster` plugin requires one configuration items.
17+
18+
* `hosts` - A list of target hosts.

mkdocs.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,12 @@ pages:
1717
- Plugins:
1818
- Index: plugins.md
1919
- Discovery:
20-
- nmap: plugins/discovery/nmap.md
21-
- Web Ping: plugins/discovery/webping.md
20+
- AWS: plugins/discovery/aws.md
2221
- Digital Ocean: plugins/discovery/digitalocean.md
22+
- Linode: plugins/discovery/linode.md
23+
- Network Map (nmap): plugins/discovery/nmap.md
24+
- Roster file: plugins/discovery/roster.md
25+
- Web Ping: plugins/discovery/webping.md
2326
- Checks:
2427
- Network:
2528
- Ping: plugins/checks/network/ping.md

0 commit comments

Comments
 (0)