2017-01-07 11:46:50 +00:00
|
|
|
# Monit Dashboard
|
|
|
|
|
|
|
|
## Description
|
2017-01-07 12:53:08 +00:00
|
|
|
|
|
|
|
Python web application to get a dashboard of a bunch of [Monit] servers at a
|
|
|
|
glance.
|
2017-01-07 11:46:50 +00:00
|
|
|
|
|
|
|
## How does it work?
|
2017-01-07 12:53:08 +00:00
|
|
|
|
|
|
|
Every 300 seconds (hardcoded) the application ask for the data served by the
|
|
|
|
Monit built-in web server in a XMl report from each configured server. Then,
|
|
|
|
thanks to the built-in web server, it is displayed in a single HTML page.
|
2017-01-07 11:46:50 +00:00
|
|
|
|
|
|
|
## Pre requisites
|
|
|
|
|
|
|
|
### Debian GNU/Linux
|
|
|
|
|
|
|
|
#### Web.py framework
|
2017-01-07 12:53:08 +00:00
|
|
|
|
2017-01-07 11:46:50 +00:00
|
|
|
- `apt install python-webpy`
|
|
|
|
|
|
|
|
#### Python libraries
|
2017-01-07 12:53:08 +00:00
|
|
|
|
2017-01-07 11:46:50 +00:00
|
|
|
- `apt install python-xmltodict python-requests`
|
|
|
|
|
|
|
|
### CentOS
|
|
|
|
|
|
|
|
#### Python PIP
|
2017-01-07 12:53:08 +00:00
|
|
|
|
2017-01-07 11:46:50 +00:00
|
|
|
- `yum install epel-release`
|
|
|
|
- `yum install python-pip`
|
|
|
|
|
|
|
|
#### Web.py framework
|
2017-01-07 12:53:08 +00:00
|
|
|
|
2017-01-07 11:46:50 +00:00
|
|
|
- `pip install web.py`
|
|
|
|
|
|
|
|
#### Python libaries
|
|
|
|
|
|
|
|
- `yum install python-requests python-xmltodict python-simplejson`
|
|
|
|
|
|
|
|
## Requisites
|
2017-01-07 12:53:08 +00:00
|
|
|
|
|
|
|
- Config file `conf/servers.json` prior run. You might find a sample file at
|
|
|
|
`conf/servers.json.example`.
|
2017-01-07 11:46:50 +00:00
|
|
|
- Please see [Config](#config) section for further details.
|
|
|
|
|
|
|
|
## Run
|
2017-01-07 12:53:08 +00:00
|
|
|
|
2017-01-07 11:46:50 +00:00
|
|
|
`./bin/monit-dashboard.py`
|
|
|
|
|
2017-01-07 12:53:08 +00:00
|
|
|
By default, it will be reachable at <http://localhost:8080>. You might change
|
|
|
|
the port by adjusting `app.run(port=8080)` in `bin/monit-dashboard.py` file.
|
2017-01-07 11:46:50 +00:00
|
|
|
|
|
|
|
## References
|
2017-01-07 12:53:08 +00:00
|
|
|
|
|
|
|
- [web.py 0.3 tutorial][webpy-tutorial]
|
|
|
|
- [Learn Python the hard way, ex 50][lpthw]
|
2017-01-07 11:46:50 +00:00
|
|
|
- [A template example][template-example]
|
|
|
|
- [How to change HTTP server port][port]
|
|
|
|
|
|
|
|
## Config
|
2017-01-07 12:53:08 +00:00
|
|
|
|
2017-01-07 11:46:50 +00:00
|
|
|
- Placed in `conf/servers.json`
|
|
|
|
- Sample settings as follows:
|
2017-01-07 12:53:08 +00:00
|
|
|
|
|
|
|
```
|
|
|
|
{
|
2017-01-07 11:46:50 +00:00
|
|
|
"My server to monit": {
|
|
|
|
"url": "http://example.com:2812",
|
|
|
|
"user": "monit",
|
|
|
|
"passwd": "*****"
|
2017-01-07 12:53:08 +00:00
|
|
|
}
|
2017-01-07 11:46:50 +00:00
|
|
|
}
|
2017-01-07 12:53:08 +00:00
|
|
|
```
|
2017-01-07 11:46:50 +00:00
|
|
|
|
|
|
|
# Credits
|
2017-01-07 12:53:08 +00:00
|
|
|
|
|
|
|
- [Original idea][idea]
|
2017-01-07 11:46:50 +00:00
|
|
|
- Frontend support: Júlia Vázquez
|
2017-01-07 12:53:08 +00:00
|
|
|
- [Icons]
|
2017-01-07 11:46:50 +00:00
|
|
|
- [Accordion menu][accordion]
|
|
|
|
|
|
|
|
# License
|
2017-01-07 12:53:08 +00:00
|
|
|
|
2017-01-07 11:46:50 +00:00
|
|
|
[AGPL][license]
|
|
|
|
|
2017-01-07 12:53:08 +00:00
|
|
|
[accordion]: http://www.w3schools.com/howto/howto_js_accordion.asp
|
|
|
|
[icons]: https://commons.wikimedia.org/wiki/User:House
|
|
|
|
[idea]: https://imil.net/blog/2016/03/16/Fetch-monit-status-in-JSON/
|
|
|
|
[license]: LICENSE
|
|
|
|
[lpthw]: https://learnpythonthehardway.org/book/ex50.html
|
2017-01-07 11:46:50 +00:00
|
|
|
[monit]: https://mmonit.com/monit/
|
|
|
|
[port]: https://stackoverflow.com/questions/14444913/web-py-specify-address-and-port
|
|
|
|
[template-example]: https://stackoverflow.com/questions/28508869/using-web-py-to-dynamically-output-values-from-process-initiated-by-form-submiss
|
2017-01-07 12:53:08 +00:00
|
|
|
[webpy]: http://webpy.org/
|
|
|
|
[webpy-tutorial]: http://webpy.org/tutorial3.en
|