Git Product home page Git Product logo

foreman_compute_resources_statistics_view's Introduction

foreman_compute_resources_statistics_view

A small plugin to showcase the awesome Deface library. It simply adds a statistics to the ComputeResources list and properties table. It also adds new max values and usage values statisticss to compute resources new/edit form where we can set the max cpus, memory and size and overusage of cups, memory and size of the compute resource. These values are used to display the statistics.

Screenshots

Statistics in Compute resource list page

Statistics in Compute resource show page

Statistics fields in Compute resource form

Installation

Require the gem in Foreman (you may need extra dependencies such as libxml or libxslt to build the nokogiri dependency)

gem 'foreman_compute_resources_statistics_view', :git => "https://github.com/ingenico-group/foreman_compute_resources_statistics_view.git"

Update Foreman with the new gems:

bundle update foreman_compute_resources_statistics_view

Post installation

After installing this gem we need to run the following rake task to setup the database

rake compute_resource_statistics:add_columns RAILS_ENV=production 

This rake task will add max_cpus_limit(integer), max_memory_limit(float), max_size_limit(float), cpus_overusage(integer), memory_overusage(float), size_overusage(float) columns to compute_resources table. These columns are required to calculate the statistics. After adding these columns this rake task will fetch the max values from the compute resource(like max_cpus, max_memory and max_size) and for over usage columns the default value is 150. These columns are also added to new/edit form of compute resources to update the exact values. This rake task will also create new table called compute_resource_statistics table to store the used values like used cpus, memory and size. These values are fetched from the compute resource.

To update the used values in compute_resource_statistics table please use below rake task(This can be ran using rake task so that it will display accurate values every time)

rake compute_resource_statistics:update_used_statistics RAILS_ENV=production 

Pre remove

If we want to remove this feature and remove all columns and table related to this feature. Please run below rake task and remove this gem from the Gemfile

rake compute_resource_statistics:remove_columns RAILS_ENV=production 

Configuration

Add below content to settings.yaml file

:compute_resource_statistics_view:
  :list_page:
    :title: Statistics
    :title_after: Name
    :content: usage_statistics
    :content_after: link_to compute.name
    :view: :compute_resources_list
  :show_page:
    :title: Statistics
    :after: compute_resource.provider_friendly_name
    :content: usage_statistics
    :view: :compute_resources_properties
  :edit_form:
    :view: :edit_statistic_values
    :after: compute_connection

title is an arbitrary string which is displayed as the statistics header. content is a method call to the ComputeResource object, using compute.send.

In this list_page setting is used to display the statistics in compute resources list page and show_page is used to display statistics in compute resource show page and edit_form is used to display max value and usage value fields of CPUs, memory and size in new/edit form of compute resource. max and usage values are used to calculate the statistics to display.

You will need to restart Foreman for changes to take effect, as the settings.yaml is only read at startup.

Limitations

This gem will display statistics only for compute resources of types Ovirt, Libvirt and Vmware

License

GPLv3

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.