Python library to periodically write and read the system status in a Redis DB.
If you want to start monitoring a remote machine using rstatus, go to the playbook directory and follow the instructions.
You can install the project and all its dependencies using pip:
pip install -e git+https://github.com/mcloudpy/rstatus.git
Recommended option for development: checkout the code and edit it whenever you need.
pip install -e git+https://github.com/mcloudpy/rstatus.git#egg=rstatus
If you have already downloaded the code and you don't need to edit it, you can simply do...
pip install ./
If a previous version was already installed use this:
pip install ./ --upgrade
And to uninstall it:
pip uninstall rstatus
If you follow the installation procedure described above, all the dependencies will be automatically installed in your python environment.
However, you can also find them listed in the requirements.txt file. To install them in your python environment without installing the rstatus module just run:
pip install -r requirements.txt
Use the following command to see the last measures:
rconsumer -host [redis_hostip] -db [rstatus_db_number]
import argparse
from redis import StrictRedis
from communication import StatusReceiver
r = StrictRedis(host=host, port=port, db=db_number)
# The aspects to query in the DB. They correspond with "psutil" method names and their subfields.
keys = ["cpu_percent", "swap_memory.percent"]
sr = StatusReceiver(r, keys)
print sr.get_last_measures()
If you just want to test how it works, use the following command:
rproducer -host [redis_hostip] -db [rstatus_db_number] -config [config_file]
If you want to start monitoring a remote machine using rstatus, go to the playbook directory and follow the instructions.
The config.yml file defines which features will be measured and sent to the database.
If you want to measure other aspects, please change the file to refer to other psutil methods.
To check that you have changed it properly, run:
# Cd to the root of this project
python rstatus/config.py -config config.yml
This will print the psutil methods that will be called.
rstatus is part of the mCloud project (IPT-2011-1558-430000), Este proyecto ha recibido financiación del Ministerio de Economía y Competitividad, dentro del Plan Nacional de Investigación Científica, Desarrollo e Innovación Tecnológica 2008-2011 y el Fondo Europeo de Desarrollo Regional (FEDER).