InfotelGLPI / printercounters

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

Error on Actions menu #98

Open alberto772 opened 1 year ago

alberto772 commented 1 year ago

The actions menu have a bug that includes a doubleslash and not permit the plugin to works fine. The issues is described below

alberto772 commented 1 year ago

after a long check i found that the version present in marketplace is different from the one in git. the one in marketplace have ths code in "item_recordmodel.class.php" $ma->setRedirect(PLUGIN_PRINTERCOUNTERS_WEBDIR.'//front/record.form.php?initAjaxMassiveAction=1'); the code is corret in the GIT version. afther using the git version the update error still persit A

alberto772 commented 1 year ago

evry time that i try to make any action this log was registered in PHP-errors.log: [2023-07-03 12:23:36] glpiphplog.WARNING: *** PHP Warning (2): Trying to access array offset on value of type bool in /var/www/html/glpi/marketplace/printercounters/inc/erroritem.class.php at line 214 Backtrace : ...place/printercounters/inc/process.class.php:167 PluginPrintercountersErrorItem->isInError() ...tplace/printercounters/inc/record.class.php:673 PluginPrintercountersProcess->getIPAddressesForProcess() ...place/printercounters/inc/record.class.php:1203 PluginPrintercountersRecord->initRecord() ...tercounters/inc/item_recordmodel.class.php:1100 PluginPrintercountersRecord->immediateRecord() marketplace/printercounters/ajax/record.php:90 PluginPrintercountersItem_Recordmodel->doMassiveActionProcess() public/index.php:73 require()

alberto772 commented 1 year ago

final comment before closing maketplace plugin have two issues: 1) in /.../glpi/marketplace/printercounters/inc the file item_recordmodel.form.php there is an error in file item_recordmodel.class.php remove de double // in setRedirect(PLUGIN_PRINTERCOUNTERS_WEBDIR.'//front/record.form.php?initAjaxMassiveAction=1'); 2) in /glpi/marketplace/printercounters/scripts the base location is broken the correct is include GLPI_ROOT."/inc/based_config.php";

Also you need to install php-snmp and enable it

Migrate all the Automatic actions fom PHP execution to CLI execution and put the following linex in crontab: _/5 9-18 php /var/www/html/glpi/marketplace/printercounters/scripts/run.php --sonprocessnbr=4 --itemtype=Printer &>/dev/null /1 php /var/www/html/glpi/front/cron.php &>/dev/null 0 6 /bin/glpi-agent --tasks=NetInventory &>/dev/null 0 /6 /bin/glpi-agent --tasks=NetDiscovery &>/dev/null

Don't forgot to create SNMP auth for the printer community string (used in netinventory) and the SNMP aut string for the plugin (in plugin configuration). In case you need it don't forgot to create the counter types and relative oid (in plugin configuration) you must poulate record model (in plugin config) and poulate with oid and printers

Afther this all your printer counter vill be populated (not only this) but sill persist an error in printer proprierties in record tab "Error items. Number of errors : 1" and when you set immediate record you obtain a reply in red: "No printers to search"