Project

General

Profile

Bug #1166

Statistics - No Inventory data has been found

Added by Trey Dockendorf over 7 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Facts
Target version:
Difficulty:
Triaged:
No
Bugzilla link:
Pull request:
Team Backlog:
Fixed in Releases:
Found in Releases:

Description

I'm having an issue with specific facts causing the statistics page to fail rendering. This has happened on both 0.3 and the Sept 7th nightly. This is the error I get...

"No Inventory data has been found - add some hosts and facts and try again" 

Follow the advice in a previous thread, I found in the debug output which facts were problemtic, in my case it was "swapsize" and "swapfree". By commenting out those entries I was able to get Foreman to load the statistics page...

Comments added to app/controllers/statistics_controller.rb
-------------

    #@swap_size   = FactValue.mem_average "swapsize" 
    #@swap_free   = FactValue.mem_average "swapfree" 
... 
#:model_count => @model_count, :mem_size => @mem_size, :mem_free => 
@mem_free, :swap_size => @swap_size, 
:model_count => @model_count, :mem_size => @mem_size, :mem_free => 
@mem_free, 
#:swap_free   => @swap_free, :mem_totsize => 
@mem_totsize, :mem_totfree => @mem_totfree } } 
:mem_totsize => @mem_totsize, :mem_totfree => @mem_totfree } }

Removed these lines in app/views/statistics/index.html.erb
--------------

    <td> 
      <%= pie_chart("swap_usage" ,"Average swap usage", [["free swap 
(GB)",@swap_free],["used swap (GB)",@swap_size-@swap_free]]) %> 
    </td>

Here's the error when page fails to load...

  FactValue Load (0.6ms)   SELECT value FROM 'fact_values' INNER JOIN 
'fact_names' ON 'fact_names'.id = 'fact_values'.fact_name_id WHERE 
'fact_names'.'name' = 'swapsize') ORDER BY LOWER(fact_values.value) 
Unknown string

And these are the two tables with the swap space data...

mysql> select value from fact_values inner join fact_names on fact_names.id=fact_values.fact_name_id where fact_names.name="swapsize" order by lower(fact_values.value); 
+----------+ 
| value    | 
+----------+ 
| 1.50 GB  | 
| 1.91 GB  | 
| 1.97 GB  | 
| 1.97 GB  | 
| 1.97 GB  | 
| 1.97 GB  | 
| 1.97 GB  | 
| 1.97 GB  | 
| 1.97 GB  | 
| 1.97 GB  | 
| 1.97 GB  | 
| 1.97 GB  | 
| 1.97 GB  | 
| 17.70 GB | 
| 3.84 GB  | 
| 3.84 GB  | 
| 3.91 GB  | 
| 3.91 GB  | 
| 3.91 GB  | 
| 3.91 GB  | 
| 3.91 GB  | 
| 64.00M   | 
+----------+ 
22 rows in set (0.00 sec)
mysql> select value from fact_values inner join fact_names on fact_names.id=fact_values.fact_name_id where fact_names.name="swapfree" order by lower(fact_values.value); 
+----------+ 
| value    | 
+----------+ 
| 1.50 GB  | 
| 1.85 GB  | 
| 1.86 GB  | 
| 1.91 GB  | 
| 1.95 GB  | 
| 1.96 GB  | 
| 1.97 GB  | 
| 1.97 GB  | 
| 1.97 GB  | 
| 1.97 GB  | 
| 1.97 GB  | 
| 1.97 GB  | 
| 1.97 GB  | 
| 17.69 GB | 
| 3.84 GB  | 
| 3.84 GB  | 
| 3.91 GB  | 
| 3.91 GB  | 
| 3.91 GB  | 
| 3.91 GB  | 
| 3.91 GB  | 
| 64.00M   | 
+----------+

Let me know what other data would be of use in troubleshooting this.

Thanks
- Trey

Associated revisions

Revision 99a2326b (diff)
Added by Tim Speetjens over 7 years ago

fixes #1166 - be more liberal in accepted values for to_gb - add better logging message

Signed-off-by: Tim Speetjens <>

History

#1 Updated by Ohad Levy over 7 years ago

any chance you can get a trace? (afair, it should be in the log file).

Ohad

#2 Updated by Trey Dockendorf over 7 years ago

Here's the log output when loading the Statistics page. Let me know if anything else would help in this.

Processing StatisticsController#index (for 165.91.97.106 at 2011-09-19 10:52:54) [GET]
  User Load (0.2ms)   SELECT * FROM `users` WHERE (`users`.`id` = 1) 
Setting current user thread-local variable to admin
  Host Columns (1.9ms)   SHOW FIELDS FROM `hosts`
  SQL (0.2ms)   SELECT count(*) AS count_all, operatingsystem_id AS operatingsystem_id FROM `hosts` GROUP BY operatingsystem_id 
  Operatingsystem Columns (0.5ms)   SHOW FIELDS FROM `operatingsystems`
  Operatingsystem Load (0.2ms)   SELECT * FROM `operatingsystems` WHERE (`operatingsystems`.`id` IN (1,2,3)) ORDER BY LOWER(operatingsystems.name)
skipped  as it has has no label
  SQL (0.2ms)   SELECT count(*) AS count_all, architecture_id AS architecture_id FROM `hosts` GROUP BY architecture_id 
  Architecture Columns (0.5ms)   SHOW FIELDS FROM `architectures`
  Architecture Load (0.1ms)   SELECT * FROM `architectures` WHERE (`architectures`.`id` IN (1,2)) 
skipped  as it has has no label
  SQL (0.2ms)   SELECT count(*) AS count_all, environment_id AS environment_id FROM `hosts` GROUP BY environment_id 
  Environment Columns (0.4ms)   SHOW FIELDS FROM `environments`
  Environment Load (0.2ms)   SELECT * FROM `environments` WHERE (`environments`.`id` = 1) ORDER BY LOWER(environments.name)
  SQL (1.1ms)   SELECT count(DISTINCT `hosts`.id) AS count_all, puppetclass_id AS puppetclass_id FROM `hosts` LEFT OUTER JOIN `host_classes` ON (`hosts`.`id` = `host_classes`.`host_id`) LEFT OUTER JOIN `puppetclasses` ON (`puppetclasses`.`id` = `host_classes`.`puppetclass_id`) GROUP BY puppetclass_id 
  Puppetclass Columns (0.6ms)   SHOW FIELDS FROM `puppetclasses`
  Puppetclass Load (0.1ms)   SELECT * FROM `puppetclasses` WHERE (`puppetclasses`.`id` = 6) ORDER BY LOWER(puppetclasses.name)
  Puppetclass Load (0.1ms)   SELECT * FROM `puppetclasses` WHERE (`puppetclasses`.`id` = 9) ORDER BY LOWER(puppetclasses.name)
  Puppetclass Load (0.1ms)   SELECT * FROM `puppetclasses` WHERE (`puppetclasses`.`id` = 29) ORDER BY LOWER(puppetclasses.name)
  Puppetclass Load (0.1ms)   SELECT * FROM `puppetclasses` WHERE (`puppetclasses`.`id` = 48) ORDER BY LOWER(puppetclasses.name)
  Puppetclass Load (0.1ms)   SELECT * FROM `puppetclasses` WHERE (`puppetclasses`.`id` = 70) ORDER BY LOWER(puppetclasses.name)
  Puppetclass Load (0.1ms)   SELECT * FROM `puppetclasses` WHERE (`puppetclasses`.`id` = 89) ORDER BY LOWER(puppetclasses.name)
  Puppetclass Load (0.1ms)   SELECT * FROM `puppetclasses` WHERE (`puppetclasses`.`id` = 95) ORDER BY LOWER(puppetclasses.name)
  Puppetclass Load (0.1ms)   SELECT * FROM `puppetclasses` WHERE (`puppetclasses`.`id` = 96) ORDER BY LOWER(puppetclasses.name)
  Puppetclass Load (0.1ms)   SELECT * FROM `puppetclasses` WHERE (`puppetclasses`.`id` = 105) ORDER BY LOWER(puppetclasses.name)
  Puppetclass Load (0.1ms)   SELECT * FROM `puppetclasses` WHERE (`puppetclasses`.`id` = 106) ORDER BY LOWER(puppetclasses.name)
  Puppetclass Load (0.1ms)   SELECT * FROM `puppetclasses` WHERE (`puppetclasses`.`id` = 107) ORDER BY LOWER(puppetclasses.name)
  Puppetclass Load (0.1ms)   SELECT * FROM `puppetclasses` WHERE (`puppetclasses`.`id` = 108) ORDER BY LOWER(puppetclasses.name)
  Puppetclass Load (0.1ms)   SELECT * FROM `puppetclasses` WHERE (`puppetclasses`.`id` = 109) ORDER BY LOWER(puppetclasses.name)
  Puppetclass Load (0.1ms)   SELECT * FROM `puppetclasses` WHERE (`puppetclasses`.`id` = 110) ORDER BY LOWER(puppetclasses.name)
  Puppetclass Load (0.1ms)   SELECT * FROM `puppetclasses` WHERE (`puppetclasses`.`id` = 111) ORDER BY LOWER(puppetclasses.name)
  Puppetclass Load (0.1ms)   SELECT * FROM `puppetclasses` WHERE (`puppetclasses`.`id` = 112) ORDER BY LOWER(puppetclasses.name)
  Puppetclass Load (0.1ms)   SELECT * FROM `puppetclasses` WHERE (`puppetclasses`.`id` = 113) ORDER BY LOWER(puppetclasses.name)
  Puppetclass Load (0.1ms)   SELECT * FROM `puppetclasses` WHERE (`puppetclasses`.`id` = 114) ORDER BY LOWER(puppetclasses.name)
  Puppetclass Load (0.1ms)   SELECT * FROM `puppetclasses` WHERE (`puppetclasses`.`id` = 115) ORDER BY LOWER(puppetclasses.name)
  Puppetclass Load (0.1ms)   SELECT * FROM `puppetclasses` WHERE (`puppetclasses`.`id` = 120) ORDER BY LOWER(puppetclasses.name)
  Puppetclass Load (0.1ms)   SELECT * FROM `puppetclasses` WHERE (`puppetclasses`.`id` = 121) ORDER BY LOWER(puppetclasses.name)
  Puppetclass Load (0.1ms)   SELECT * FROM `puppetclasses` WHERE (`puppetclasses`.`id` = 124) ORDER BY LOWER(puppetclasses.name)
  Puppetclass Load (0.1ms)   SELECT * FROM `puppetclasses` WHERE (`puppetclasses`.`id` = 125) ORDER BY LOWER(puppetclasses.name)
  Puppetclass Load (0.1ms)   SELECT * FROM `puppetclasses` WHERE (`puppetclasses`.`id` = 128) ORDER BY LOWER(puppetclasses.name)
  Puppetclass Load (0.1ms)   SELECT * FROM `puppetclasses` WHERE (`puppetclasses`.`id` = 129) ORDER BY LOWER(puppetclasses.name)
  Puppetclass Load (0.1ms)   SELECT * FROM `puppetclasses` WHERE (`puppetclasses`.`id` = 130) ORDER BY LOWER(puppetclasses.name)
  Puppetclass Load (0.1ms)   SELECT * FROM `puppetclasses` WHERE (`puppetclasses`.`id` = 132) ORDER BY LOWER(puppetclasses.name)
  Puppetclass Load (0.1ms)   SELECT * FROM `puppetclasses` WHERE (`puppetclasses`.`id` = 135) ORDER BY LOWER(puppetclasses.name)
  Puppetclass Load (0.1ms)   SELECT * FROM `puppetclasses` WHERE (`puppetclasses`.`id` = 138) ORDER BY LOWER(puppetclasses.name)
  FactValue Columns (0.6ms)   SHOW FIELDS FROM `fact_values`
  FactValue Load (0.8ms)   SELECT value FROM `fact_values` INNER JOIN `fact_names` ON `fact_names`.id = `fact_values`.fact_name_id WHERE (`fact_names`.`name` = 'processorcount') ORDER BY LOWER(fact_values.value)
  FactValue Load (0.6ms)   SELECT value FROM `fact_values` INNER JOIN `fact_names` ON `fact_names`.id = `fact_values`.fact_name_id WHERE (`fact_names`.`name` = 'manufacturer') ORDER BY LOWER(fact_values.value)
  FactValue Load (0.5ms)   SELECT value FROM `fact_values` INNER JOIN `fact_names` ON `fact_names`.id = `fact_values`.fact_name_id WHERE (`fact_names`.`name` = 'memorysize') ORDER BY LOWER(fact_values.value)
  FactValue Load (0.5ms)   SELECT value FROM `fact_values` INNER JOIN `fact_names` ON `fact_names`.id = `fact_values`.fact_name_id WHERE (`fact_names`.`name` = 'memoryfree') ORDER BY LOWER(fact_values.value)
  FactValue Load (0.6ms)   SELECT value FROM `fact_values` INNER JOIN `fact_names` ON `fact_names`.id = `fact_values`.fact_name_id WHERE (`fact_names`.`name` = 'swapsize') ORDER BY LOWER(fact_values.value)
Unknown string
Rendering template within layouts/application
Rendered home/_topbar (1.1ms)
  user_notices Columns (0.5ms)   SHOW FIELDS FROM `user_notices`
  Notice Load (0.2ms)   SELECT * FROM `notices` INNER JOIN `user_notices` ON `notices`.id = `user_notices`.notice_id WHERE (`user_notices`.user_id = 1 ) 
  Bookmark Load (0.3ms)   SELECT * FROM `bookmarks` ORDER BY name
  Bookmark Columns (0.6ms)   SHOW FIELDS FROM `bookmarks`
Rendered bookmarks/_list (0.7ms)
Rendered bookmarks/_list (2.1ms)
Rendered bookmarks/_list (0.4ms)
Rendered bookmarks/_list (0.1ms)
Rendered bookmarks/_list (0.1ms)
Rendered bookmarks/_list (0.1ms)
Rendered home/_settings (3.0ms)
Rendered home/_menu (16.2ms)
Completed in 557ms (View: 23, DB: 22) | 200 OK [https://<omitted>/statistics]

#3 Updated by Tim Speetjens over 7 years ago

I think the reason for this failure is an old version of facter, which does not add a space between 64 and M.

I reproduced the error by updating the fact value with plain SQL commands.

I didn't try any facter other than version 1.6.0, but I never had the '64.00M' value, always '\d\d\.\d\d [GM]B'

#4 Updated by Tim Speetjens over 7 years ago

  • Status changed from New to Closed
  • % Done changed from 0 to 100

#5 Updated by Ohad Levy over 7 years ago

  • Assignee set to Tim Speetjens
  • Target version set to 0.4

#6 Updated by Trey Dockendorf over 7 years ago

Sorry for delayed response, but that host was a Mac using facter 1.5.8. It was a test, and destroyed it's record in Foreman which solved the problem.

- Trey

Also available in: Atom PDF