"2. Print out average CPU/Memory of services of the same type " "4. Have the ability to track and print CPU/Memory of all instances of a given service over time (until the command is stopped, e.g. ctrl + c)."
Assumed that "services of the same type "[2] and "all instances of a given service"[4] means the same thing so took service_name as service type as no other service type is defined.
Defined service health with cpu+memory<100
condition, which is pseudo service health should be defined by the service specific conditions and the number of CPUs was not known so the definition of health is an improvement area.
Assumed that CPX server is running on port 7777
only
Used click for commands and followed the recommendations here
The app can be generelize for any cloud API and the installation can be done via pip
Run cpx_server on port ./cpx_server.py 7777
- make sure that you are at /cloudy
python3 setup.py build
python3 setup.py install
python3 cloudy/__main__.py command (optional:argument)
-
services :Prints running services to stdout. usage:
python3 cloudy/__main__.py services
-
avg :Prints out average CPU and Memory of services out of their instances. usage
python3 cloudy/__main__.py avg
-
flag :Flags services which have fewer than 2 healthy instances running. usage
python3 cloudy/__main__.py flag
-
watch : Watches specific service resources (until the command is stopped, e.g. ctrl + c).
python3 cloudy/__main__.py watch service_name