InfotelGLPI / printercounters

Plugin Printercounters for GLPI
http://blogglpi.infotel.com
GNU General Public License v2.0
14 stars 9 forks source link

Counters don't appear + sql error #32

Open ejaecker opened 6 years ago

ejaecker commented 6 years ago

Hi, Just installed and configured this plugin (on a fresh vanilla glpi 9.2) snmp seems to work after a immediate record as toner levels show well
image

and counters are well stored on table glpi_plugin_printercounters_counters image

but i just don't figure out how to see counters... Printers/Records/record History i still empty...no historical...

also clickin on Add a manual record or Add a lower record seems somewhat inefective.

should it be of some help here is a backtrace :

  *** PHP Notice(8): Trying to get property 'num_rows' of non-object
  Backtrace :
  inc\dbmysql.class.php:275                          
  plugins\printercounters\inc\search.class.php:655   DBmysql->numrows()
  plugins\printercounters\inc\search.class.php:74    PluginPrintercountersSearch->getHistoryFromDB()
  plugins\printercounters\inc\search.class.php:320   PluginPrintercountersSearch->manageHistoryGetValues()
  ...ntercounters\inc\item_recordmodel.class.php:218 PluginPrintercountersSearch->showSearch()
  ...ntercounters\inc\item_recordmodel.class.php:179 PluginPrintercountersItem_Recordmodel->showForItem()
  inc\commonglpi.class.php:482                       PluginPrintercountersItem_Recordmodel::displayTabContentForItem()
  ajax\common.tabs.php:96                            CommonGLPI::displayStandardTab()

and a slq-errors.log wich is fired upon accessing printer object

  *** MySQL query error:
  SQL: SELECT `glpi_plugin_printercounters_records`.`id` AS `ITEM_0`,  `glpi_plugin_printercounters_records`.`date` AS `ITEM_1`,   `glpi_plugin_printercounters_recordmodels_0`.`name` AS `ITEM_2`,
                        `glpi_plugin_printercounters_recordmodels_0`.`id` AS `ITEM_2_id`,
                         `glpi_entities`.`name` AS `ITEM_3`,
                        `glpi_entities`.`id` AS `ITEM_3_id`,
                         GROUP_CONCAT(DISTINCT CONCAT(IFNULL(`glpi_plugin_printercounters_countertypes`.`name`, \'__NULL__\'),
                                               \'$$\',`glpi_plugin_printercounters_countertypes`.`id`) SEPARATOR \'$$$$\')
                              AS `ITEM_4`,

                   GROUP_CONCAT(DISTINCT CONCAT(IFNULL(`glpi_plugin_printercounters_counters`.`value`, \'__NULL__\'),
                                               \'$$\',`glpi_plugin_printercounters_counters`.`id`) SEPARATOR \'$$$$\')
                              AS `ITEM_5`,

                  `glpi_plugin_printercounters_records`.`record_type` AS `ITEM_6`,  `glpi_plugin_printercounters_records`.`result` AS `ITEM_7`,   `glpi_locations`.`completename` AS `ITEM_8`,
                        `glpi_locations`.`id` AS `ITEM_8_id`,
                         `glpi_plugin_printercounters_budgets_0`.`name` AS `ITEM_9`,
                        `glpi_plugin_printercounters_budgets_0`.`id` AS `ITEM_9_id`,
                        `glpi_printers_0`.`name` AS `ITEM_10`,  `glpi_printers_0`.`id` AS `ITEM_11`,  `glpi_printermodels`.`name` AS `ITEM_12`,  `glpi_plugin_printercounters_records`.`last_recordmodels_id` AS `ITEM_13`,   GROUP_CONCAT(DISTINCT CONCAT(IFNULL(`glpi_plugin_printercounters_countertypes`.`id`, \'__NULL__\'),
                                               \'$$\',`glpi_plugin_printercounters_countertypes`.`id`) SEPARATOR \'$$$$\')
                              AS `ITEM_14`,

                  `glpi_plugin_printercounters_items_recordmodels`.`id` AS `ITEM_15`,  `glpi_entities`.`id` AS `ITEM_16`,  `glpi_plugin_printercounters_records`.`id` AS id  FROM `glpi_plugin_printercounters_records`LEFT JOIN `glpi_plugin_printercounters_recordmodels` 
                                          ON (`glpi_plugin_printercounters_records`.`last_recordmodels_id` = `glpi_plugin_printercounters_recordmodels`.`id`
                                              )LEFT JOIN `glpi_entities` 
                                          ON (`glpi_plugin_printercounters_records`.`entities_id` = `glpi_entities`.`id`
                                              ) LEFT JOIN `glpi_plugin_printercounters_counters`  AS glpi_plugin_printercounters_counters
                                             ON (`glpi_plugin_printercounters_records`.`id` = `glpi_plugin_printercounters_counters`.`plugin_printercounters_records_id`
                                                 )LEFT JOIN `glpi_plugin_printercounters_countertypes_recordmodels`  AS glpi_plugin_printercounters_countertypes_recordmodels
                                          ON (`glpi_plugin_printercounters_counters`.`plugin_printercounters_countertypes_recordmodels_id` = `glpi_plugin_printercounters_countertypes_recordmodels`.`id`
                                              )LEFT JOIN `glpi_plugin_printercounters_countertypes`  AS glpi_plugin_printercounters_countertypes
                                          ON (`glpi_plugin_printercounters_countertypes_recordmodels`.`plugin_printercounters_countertypes_id` = `glpi_plugin_printercounters_countertypes`.`id`
                                              )LEFT JOIN `glpi_plugin_printercounters_items_recordmodels` 
                                          ON (`glpi_plugin_printercounters_records`.`plugin_printercounters_items_recordmodels_id` = `glpi_plugin_printercounters_items_recordmodels`.`id`
                                              )LEFT JOIN `glpi_printers`  AS glpi_printers
                                          ON (`glpi_plugin_printercounters_items_recordmodels`.`items_id` = `glpi_printers`.`id`
                                              )LEFT JOIN `glpi_locations`  AS glpi_locations
                                          ON (`glpi_printers`.`locations_id` = `glpi_locations`.`id`
                                              )LEFT JOIN `glpi_plugin_printercounters_budgets`  AS glpi_plugin_printercounters_budgets
                                          ON (`glpi_plugin_printercounters_records`.`entities_id` = `glpi_plugin_printercounters_budgets`.`id`
                                              AND `glpi_plugin_printercounters_budgets`.`begin_date` <= `glpi_plugin_printercounters_records`.`date` AND `glpi_plugin_printercounters_budgets`.`end_date` >= `glpi_plugin_printercounters_records`.`date` )LEFT JOIN `glpi_printermodels`  AS glpi_printermodels
                                          ON (`glpi_printers`.`printermodels_id` = `glpi_printermodels`.`id`
                                              ) WHERE 1 AND   (`glpi_plugin_printercounters_records`.`id` <> \'\') AND (`glpi_printers`.`id` = 1)  GROUP BY glpi_plugin_printercounters_records.`id` ORDER BY ITEM_1 DESC  LIMIT 0,20
  Error: Unknown column 'glpi_plugin_printercounters_recordmodels_0.name' in 'field list'
  Backtrace :
  plugins\printercounters\inc\search.class.php:653   
  plugins\printercounters\inc\search.class.php:74    PluginPrintercountersSearch->getHistoryFromDB()
  plugins\printercounters\inc\search.class.php:320   PluginPrintercountersSearch->manageHistoryGetValues()
  ...ntercounters\inc\item_recordmodel.class.php:218 PluginPrintercountersSearch->showSearch()
  ...ntercounters\inc\item_recordmodel.class.php:179 PluginPrintercountersItem_Recordmodel->showForItem()
  inc\commonglpi.class.php:482                       PluginPrintercountersItem_Recordmodel::displayTabContentForItem()
  ajax\common.tabs.php:96                            CommonGLPI::displayStandardTab()

thanks in advance for any help.

amma35 commented 6 years ago

Hi,

Do you have the TAG plugin to install on your GLPI instance?

ejaecker commented 6 years ago

Thanks for replying. No, i don't have this plugin installed, is it a preqequisite to printercounters ?

amma35 commented 6 years ago

No but there is a conflict between these two plugins and it generates SQL errors of the same type as the one reported.

amma35 commented 6 years ago

Can you put a screenshot of the "Item records" page by putting yourself in debug mode?

ejaecker commented 6 years ago

here is the screen shot you asked for : image

amma35 commented 6 years ago

What plugins have you installed? Because we tried with a blank instance and no problems when consulting the history.

ejaecker commented 6 years ago

No other plugin installed. As i said on OP this is a Fresh 9.2 install with only Printercounters plugin.

My config is :

Operating system: Windows NT SRV2K16AZURE 10.0 build 14393 (Windows Server 2016) AMD64
PHP 7.2.2 cgi-fcgi (Core, PDO, Phar, Reflection, SPL, SimpleXML, Zend OPcache, bcmath, calendar, cgi-fcgi, ctype, curl, date,
    dom, fileinfo, filter, gd, hash, iconv, imap, json, ldap, libxml, mbstring, mysqli, mysqlnd, pcre, readline, session, snmp,
    standard, tokenizer, wddx, xml, xmlreader, xmlrpc, xmlwriter, zip, zlib) 
Setup: max_execution_time="300" memory_limit="128M" post_max_size="8M" safe_mode="" session.save_handler="files"    upload_max_filesize="2M"  
Software: Microsoft-IIS/10.0    Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36 Edge/15.15063 
Server Software: MySQL Community Server (GPL)   Server Version: 5.7.19-log  Server SQL Mode:    Parameters: root@localhost/glpi92   Host info: localhost via TCP/IP
--

Perhaps should i try with 9.2.2....

amma35 commented 6 years ago

Hi, Can you test with the new release of the plugin to see if this problem is solved?