A tool for monitoring machines in an intranet.
- The tool can run python script over any number of clients.
- The server loops across all clients asynchornously to run the given script
- Data transferred between the server and the clients is encrypted using RSA
s
PKCS1_OAEP
standards (asymmetric encryption/decryption using an RSA key pair)
- Clients config will be passed in one XML file
- The server script will be excute either by hand or using a cronjob
- Data encryption is Asymmetric. All clients have the public encryption key
- All client nodes in the network have the dependencies needed for the client script to run successfully
-
Install
virtualenv
by running this command:pip install virtualenv
refer to virtualenv docs -
Create a new virtualenv:
virtualenv env_hawkeye -ppython3
-
Install requirements:
pip install -r requirements
-
Add hawkeye dir to python path:
export PYTHONPATH="${PYTHONPATH}:/path/to/hawkeye"
-
Make sure your ssh server is up and running. You can use this command
sudo systemctl restart sshd
NOTE: The command might differ depending on your OS -
Install Postgresql version <= 9.3
-
Run the
db_script.sql
in order to create the database. -
!!! Change credentials and configurations in the
settings.py
- Activate the virtualenv:
source /path/to/env_hawkeye/bin/activate
- Prepare
config.xml
file that contains configurations to all network nodes that will be monitored - Run
python /path/to/hawkeye/source/hawkeye.py -h
for more info
(env_hawkeye)[user@localhost]$ python /path/to/hawkeye/source/hawkeye.py -h
usage: hawkeye.py [-h] xml_config_path
A tool for monitoring machines in an intranet.
positional arguments:
xml_config_path path to xml config file for nodes you want to monitor
optional arguments:
-h, --help show this help message and exit
- Run
python /path/to/hawkeye/source/hawkeye.py /path/to/config.xml
(env_hawkeye)[user@localhost]$ python /path/to/hawkeye/source/hawkeye.py /path/to/config.xml
INFO:Hawkeye: Initializing clients list
INFO:Hawkeye: Parsing config
...
...
IMPORTANT NOTE: make sure the requirements for the client script are met on all clients to be monitored as mentioned in the Assumptions section above.
- Create a config file with all your clients credentials. Use the following example as a reference:
<root>
<client ip="127.0.0.1" port="22" username="user" password="password" mail="[email protected]">
<alert type="memory" limit="50%" />
<alert type="cpu" limit="20%" />
</client>
<client ip="127.0.0.1" port="22" username="user" password="pasword" mail="[email protected]">
<alert type="memory" limit="50%" />
<alert type="cpu" limit="20%" />
</client>
</root>
- Import
hawkeye
into your application:
from hawkeye.source.hawkeye import Hawkeye
# config created in step 1
hawkeye = Hawkeye(xml_config)
hawkeye.run()
(Enhancements that weren't implemented due to lack of time)
- More unit tests
- Integration tests
- Mail Client
emailer.py
that supports multiple email protocols - Default alert limit for different metrics
- OS-specific metrics and statistics
- Run multiple scripts
- Add Async. event loop to enhance performance