Project

General

Profile

Actions

Feature #1170

closed

Statistics Page - Group by Hostgroups

Added by Craig White about 13 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Statistics
Target version:
Fixed in Releases:
Found in Releases:

Description

Seems as though you have 9 pie charts and 10 would give balance...


# diff -u statistics_controller.rb statistics_controller.rb-new 
--- statistics_controller.rb    2011-09-14 09:47:57.712461508 -0700
+++ statistics_controller.rb-new    2011-09-14 09:47:34.372454180 -0700
@@ -5,6 +5,7 @@
     @arch_count  = Host.count_distribution :architecture
     @env_count   = Host.count_distribution :environment
     @klass_count = Host.count_habtm "puppetclass" 
+    @group_count = Host.gr_totals
     @cpu_count   = FactValue.count_each "processorcount" 
     @model_count = FactValue.count_each "manufacturer" 
     @mem_size    = FactValue.mem_average "memorysize" 
@@ -16,7 +17,7 @@
     respond_to do |format|
       format.html
       format.json do
-        render :json => { :statistics => { :os_count    => @os_count, :arch_count => @arch_count,
+        render :json => { :statistics => { :os_count    => @os_count, :arch_count => @arch_count, :host_groups => @group_count,
                                            :env_count   => @env_count, :klass_count => @klass_count, :cpu_count => @cpu_count,
                                            :model_count => @model_count, :mem_size => @mem_size, :mem_free => @mem_free, :swap_size => @swap_size,
                                            :swap_free   => @swap_free, :mem_totsize => @mem_totsize, :mem_totfree => @mem_totfree } }

# diff -u host.rb host.rb-new 
--- host.rb    2011-09-14 09:52:07.932460435 -0700
+++ host.rb-new    2011-09-14 09:51:46.032454329 -0700
@@ -626,4 +626,14 @@
     status
   end

+  def self.gr_totals
+    @grouphash = {}
+    @hostgroups = Hostgroup.find(:all)
+    @hostgroups.each do |group|
+      @groupname = group.name
+      @group_count = Host.count(:all, :conditions => ["hostgroup_id = ?", group.id])
+      @grouphash[@groupname] = @group_count
+    end
+    return @grouphash
+  end
 end

# diff -u index.html.erb index.html.erb-new 
--- index.html.erb    2011-09-14 09:53:39.262459112 -0700
+++ index.html.erb-new    2011-09-14 09:53:27.452460645 -0700
@@ -17,4 +17,6 @@

   <%= pie_chart("mem_totals" ,"Total memory usage", [["free memory (GB)", @mem_totfree],["used memory (GB)",@mem_totsize-@mem_totfree]]) %>

+  <%= pie_chart("host_groups" ,"Host Group Distribution", @group_count) %>
+
 </center>


Related issues 1 (0 open1 closed)

Related to Foreman - Bug #22515: statics chart links for hostgroup can be wrongClosedOhad Levy02/06/2018Actions
Actions #1

Updated by Ohad Levy almost 13 years ago

  • Assignee set to Craig White

while in the latest view the stats are aligned, it would still be nice to have this patch, mind sending it via git as well ? :)

Actions #2

Updated by Benjamin Papillon about 12 years ago

  • Category set to Web Interface
  • Status changed from New to Assigned
  • Assignee changed from Craig White to Amos Benari
Actions #3

Updated by Ohad Levy over 10 years ago

  • Assignee deleted (Amos Benari)
Actions #4

Updated by Ohad Levy over 10 years ago

  • Description updated (diff)
  • Status changed from Assigned to New
Actions #5

Updated by b sh about 10 years ago

Hey,

This is a very old ticket. Should we close it or try to push Craig's patch?

Actions #6

Updated by The Foreman Bot over 8 years ago

  • Status changed from New to Ready For Testing
  • Assignee set to Ohad Levy
  • Pull request https://github.com/theforeman/foreman/pull/3769 added
Actions #7

Updated by Ohad Levy over 8 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100
Actions #8

Updated by Dominic Cleal over 8 years ago

  • Tracker changed from Bug to Feature
  • Category changed from Web Interface to Statistics
  • Translation missing: en.field_release set to 160
Actions #9

Updated by The Foreman Bot over 8 years ago

  • Pull request https://github.com/theforeman/foreman/pull/3780 added
Actions #10

Updated by Ohad Levy almost 7 years ago

  • Related to Bug #22515: statics chart links for hostgroup can be wrong added
Actions

Also available in: Atom PDF