Skip to main content

Integrating with Monasca to provide OpenStack with predictive analytics.

Project description

GitHub license DOI

monasca-predictor

monasca-predictor is a Python module that integrates with Monasca to provide OpenStack services with predictive analytics based on the collected measurements.

For instance, monasca-predictor can be used to leverage on time-series forecasting techniques and enable a predictive auto-scaling strategy. The following figure shows how this component can be integrated into a standard OpenStack elasticity control-loop to automatically resize a Senlin cluster of Nova instances:

pred-auto-scaling

In this case, depending on the future status of the system (as depicted by the relevant predictive analytics), one can configure Monasca alarms to trigger appropriate Senlin scaling actions to reconfigure the cluster.

Installation

This project is compatible with Python 3.7.*. To install, run

pip install monasca-predictor

To install from source, assuming venv to be available on the system, run

git clone https://github.com/giacomolanciano/monasca-predictor
cd monasca-predictor
make py37

The monasca-predictor command can now be issued from within the newly created virtual env, that can be activated by running

source .venv/py37/bin/activate

Configuration

This component assumes OpenStack, and Monasca in particular, to be already installed on the system and configured appropriately.

Similarly to Monasca components, it is possible to configure the behavior of monasca-predictor through a yaml config file structured as follows (default values specified for optional fields only):

Api:
  ###################################################################
  # This section allows for specifying the information required to  #
  # call OpenStack APIs. It is recommended to fill in the fields    #
  # using the same values that can be found in the config file of   #
  # monasca-agent-forwarder.                                        #
  ###################################################################
  ca_file: ...
  endpoint_type: ...
  insecure: ...
  keystone_url: ...
  password: ...
  project_domain_id: ...
  project_domain_name: ...
  project_name: ...
  region_name: ...
  service_type: ...
  user_domain_name: ...
  username: ...
Logging:
  # Whether to enable log rotation
  enable_logrotate: true

  # Whether to disable logging to file
  disable_file_logging: false

  # Path to log file
  predictor_log_file: /var/log/monasca-predictor/predictor.log

  # The minimum severity level of messages to be logged
  log_level: INFO
Main:
  ###################################################################
  # The following parameters allows for specifying the information  #
  # required to call the monasca-agent-forwarder endpoint. It is    #
  # recommended to fill in the fields using the same values that    #
  # can be found in the config file of monasca-agent-collector.     #
  forwarder_url: ...
  hostname: ...
  ###################################################################

  # The time interval (in seconds) to wait between predictor activations
  inference_frequency_seconds: ...

  # A list of predictive analytics to be produced
  predictions:
      # The ID of the OpenStack project containing the objects to be monitored
    - tenant_id:

      # A map of custom properties that the objects to be monitored must match
      dimensions:
        key: value
        ...

      # A list of metrics to be retrieved for the object to be monitored
      metrics: [ ... ]

      # The name of the output (predictive) metric
      out_metric: ...

      # A list of statistics to compute temporal aggregations of the input metrics with
      # (e.g., avg, max, cnt)
      time_aggregation_statistics: []

      # The time interval (in seconds) to consider when computing temporal aggregations
      # (required only when time_aggregation_statistics is non-empty)
      time_aggregation_period_seconds: ...

      # A list of statistics to compute spatial aggregations of the input metrics with
      # (e.g., avg, max, cnt)
      space_aggregation_statistics: []

      # A list of properties to use for grouping (a '*' groups by all keys)
      group_by: []

      # Whether to merge metrics coming from different objects into a single series
      merge_metrics: false

      # The forecasting time period (in seconds, depends on the underlying model)
      prediction_offset_seconds: ...

      # The amount of historical data to look at for a single prediction (in seconds,
      # depends on the underlying model)
      lookback_period_seconds: ...

      # The standard type of forecasting model to use (only 'linear' is supported).
      # This value takes precedence over model_path.
      model_type: ...

      # Path to forecasting model dump (.h5, .pt, .joblib). This value is ignored
      # when model_type is specified.
      model_path: ...

      # Path to data scaler dump (.joblib)
      scaler_path: ...

    - ...

Run

Assuming you are within the expected virtual env (see Installation) and prepared a config file named predictor.yaml (see Configuration), you can launch monasca-predictor by running

monasca-predictor -f predictor.yaml

NOTE: in general, you may need monasca-predictor to run in the background for a relatively long period. Therefore, it is recommended to start it from within a screen, or whatever method you prefer to run processes in detached mode.

Getting started

If you want to see monasca-predictor in action, you can check out the paper "Predictive Auto-Scaling with OpenStack Monasca" (accepted at UCC 2021) and its companion repo, including: OpenStack quick setup instructions, example config files, results from the paper, etc.

If you found monasca-predictor (and the aforementioned material) useful for your research work, please consider citing:

@inproceedings{Lanciano2021Predictive,
  author={Lanciano, Giacomo and Galli, Filippo and Cucinotta, Tommaso and Bacciu, Davide and Passarella, Andrea},
  booktitle={2021 IEEE/ACM 14th International Conference on Utility and Cloud Computing (UCC)},
  title={Predictive Auto-scaling with OpenStack Monasca},
  year={2021},
  doi={10.1145/3468737.3494104},
}

Contribution

All kind of contributions (e.g., bug reports, bug fixes, new feature ideas, documentation enhancements) are welcome. Feel free to open a new issue to get in touch with the maintainers.

License

This project is licensed under the terms of Apache 2.0 license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

monasca-predictor-0.1.1.tar.gz (144.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

monasca_predictor-0.1.1-py3-none-any.whl (21.7 kB view details)

Uploaded Python 3

File details

Details for the file monasca-predictor-0.1.1.tar.gz.

File metadata

  • Download URL: monasca-predictor-0.1.1.tar.gz
  • Upload date:
  • Size: 144.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.6.9

File hashes

Hashes for monasca-predictor-0.1.1.tar.gz
Algorithm Hash digest
SHA256 bb3559e91d20394cc1eec2b718afdf9d6686aef961e413b6d5fbab1b146d261b
MD5 627fd933cfbb2c4fdc93789735f5aedd
BLAKE2b-256 115c55525b01401f25a4503dc20f4ed2deb8c6acc452129d84e40acb00552bfe

See more details on using hashes here.

File details

Details for the file monasca_predictor-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: monasca_predictor-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 21.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.6.9

File hashes

Hashes for monasca_predictor-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b0ddde1a3a3f5ba897ddf46dfe8b1e50fac5c92a0fbaf4c79e46ff5dd40056b5
MD5 5adf6dbe3b9d90e83bc5e4de86c7b0ae
BLAKE2b-256 8037ce98e7561eb2c3ea4fcc98a028eab5947b735e4adcbfa1a35655f45eb1ad

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page