glpi-project / glpi-agent

GLPI Agent
GNU General Public License v2.0
212 stars 51 forks source link

update Hardware.pm for Canon & Ricoh MFP #574

Closed TheRoby closed 6 months ago

TheRoby commented 6 months ago

Bug reporting acknowledgment

Yes, I read it

Professional support

Yes, I know

Describe the bug

Add and update value for Canon and Ricoh MFP

To reproduce

if i update the file, it doesn't change anything

Expected behavior

Hi,

I noticed that the printer counters on my Canon were more colorful than those on my Ricoh, but at Canon it seems mixed to me. They are a bit specific in having an A3 and an A4 counter, that complicates everything... For Ricoh I only have the total counter going up. While searching, I found some things in the Hardware.pm file but if I edit it manually, it doesn't seem to be taken into account. For Canon, I don't know how to add A4 and A3... (it seems to be managed for COPY but I didn't want to try on PRINT)

here is what I have found :

Canon : N/B A3 .1.3.6.1.4.1.1602.1.11.1.3.1.4.112 Black large (print+copy) N/B A4 .1.3.6.1.4.1.1602.1.11.1.3.1.4.113 Black small (print+copy) Couleur A3 .1.3.6.1.4.1.1602.1.11.1.3.1.4.122 Color large (print+copy) Couleur A4 .1.3.6.1.4.1.1602.1.11.1.3.1.4.123 Color small (print+copy) Total A4 .1.3.6.1.4.1.1602.1.11.1.3.1.4.101 copy total (print+copy) (using the .301 is on error on some Canon) Scan .1.3.6.1.4.1.1602.1.11.1.3.1.4.501 Scan + copy

Ricoh : N/B A4 .1.3.6.1.4.1.367.3.2.1.2.19.5.1.9.22 black (print+copy) Couleur A4 .1.3.6.1.4.1.367.3.2.1.2.19.5.1.9.21 Color (print+copy) Total A4 .1.3.6.1.4.1.367.3.2.1.2.19.5.1.9.1 copy total (print+copy)

If you need more information or testing, don't hesitate :)

the orignal file on my agent (linux 1.7.1)

# printer-specific page counter variables
my %printer_pagecounters_variables = (
    TOTAL      => {
        oid   => [
            '.1.3.6.1.4.1.1347.43.10.1.1.12.1.1', #Kyocera specific counter for printers and MF
                                                  # If you were really keen you could calculate misfeed rates
                                                  # based on the difference between this and the default OID
                                                  # value and use it to flag a call out of service techs.
                                                  # Hint: Increasing rate = bad paper pickup roller types.
            '.1.3.6.1.2.1.43.10.2.1.4.1.1'        #Default Value
            ]
    },
    BLACK      => {
        oid   => '.1.3.6.1.4.1.1347.42.2.2.1.1.3.1.1' #Kyocera specific non-MFP counter
    },
    COLOR      => {
        oid   => '.1.3.6.1.4.1.1347.42.2.1.1.1.8.1.1' #Kyocera specific non-MFP counter
    },
    RECTOVERSO => { },
    SCANNED    => {
        oid   => [
            '.1.3.6.1.4.1.1347.46.10.1.1.5.3',    #Kyocera MFP specific counter ( total scan counter)
            '.1.3.6.1.4.1.1602.1.11.1.3.1.4.501'  #Canon specific counter
        ]
    },
    PRINTTOTAL => {
        oid   => [
            '.1.3.6.1.4.1.1347.42.3.1.1.1.1.1',   #Kyocera MFP specific counter
            '.1.3.6.1.4.1.1602.1.11.1.3.1.4.301'  #Canon specific counter
        ]
    },
    PRINTBLACK => {
        oid   => '.1.3.6.1.4.1.1347.42.3.1.2.1.1.1.1' #Kyocera MFP specific counter
    },
    PRINTCOLOR => {
        oid   => '.1.3.6.1.4.1.1347.42.3.1.2.1.1.1.3' #Kyocera MFP specific counter
    },
    COPYTOTAL  => {
        oid   => [
            '.1.3.6.1.4.1.1347.42.3.1.1.1.1.2',   #Kyocera MFP specific counter
            '.1.3.6.1.4.1.1602.1.11.1.3.1.4.101'  #Canon specific counter
        ]
    },
    COPYBLACK  => {
        oid   => [
            '.1.3.6.1.4.1.1347.42.3.1.2.1.1.2.1', #Kyocera MFP specific counter
            '.1.3.6.1.4.1.1602.1.11.1.3.1.4.113'  #Canon specific counter
        ]
    },
    COPYBLACK_A3  => {
        oid   => '.1.3.6.1.4.1.1602.1.11.1.3.1.4.112' #Canon specific counter
    },
    COPYCOLOR  => {
        oid   => [
            '.1.3.6.1.4.1.1347.42.3.1.2.1.1.2.3', #Kyocera MFP specific counter
            '.1.3.6.1.4.1.1602.1.11.1.3.1.4.123'  #Canon specific counter
        ]
    },
    COPYCOLOR_A3  => {
        oid   => '.1.3.6.1.4.1.1602.1.11.1.3.1.4.122' #Canon specific counter
    },
    FAXTOTAL   => {
        oid   => '.1.3.6.1.4.1.1347.42.3.1.1.1.1.4'  #Kyocera MFP specific counter
    }
);

Operating system

Linux

GLPI Agent version

1.7

GLPI version

10.0.11

GLPIInventory plugin or FusionInventory for GLPI plugin version

GLPI Inventory v1.3.4

Additional context

Agent 1.7.1

g-bougard commented 6 months ago

Hi @TheRoby

indeed, you find the right place to add page counters. But you also make me find some are not supported in GLPI. And if you add PRINTBLACK_A3 and PRINTCOLOR_A3, they will appear in the submitted XML inventory but won't be integrated in GLPI.

Actually COPYBLACK_A3 and COPYCOLOR_A3 are not integrated. I verified with a Canon iR-ADV C5535 inventory I can generate from a SNMP walk.

Indeed, we have a mapping for page counters here in glpi: https://github.com/glpi-project/glpi/blob/c04505d39afe4fe06f614c2df93d026c70f15205/src/Inventory/Asset/Printer.php#L86

And this mapping doesn't support COPYBLACK_A3 and COPYCOLOR_A3. And you can guess PRINTBLACK_A3 and PRINTCOLOR_A3 won't be supported too.

That kind of counters are clearly not supported in GLPI.

@stonebuzz @trasher can you check if we can add such kind of counters in GLPI ? To me, only COPYBLACK_A3, COPYCOLOR_A3, PRINTBLACK_A3 and PRINTCOLOR_A3 should be added... but maybe this is like opening the Pandora's box.

Maybe we should indeed better aggregate A4 & A3 counters in the same one. But I guess it make sens to you to follow A3 pages resources.

P.S.: As discussed with @TheRoby, I fixed the problem in agent so no change in GLPI is required to support new counters by now.

g-bougard commented 6 months ago

Indeed, I don't think you need PRINTBLACK_A3 and PRINTCOLOR_A3 regarding your OID list: all the Canon's OID are still included and 2 of them concerns COPYBLACK_A3 and COPYCOLOR_A3.

So for your OID list, we only miss the Ricoh's one in the agent. And this is only related to A4 format. I will still include them so you can test with a nightly build.

TheRoby commented 6 months ago

Hi :) i don't really want to follow A3 pages ... in my parc, Canon is the only manufacturer with A3 and A4 counter ... I only want the "all" copy ;) (so i vote for aggregate A4+A3 (maybe A4+2xA3, Canon charges me like that :) Ricoh too

but, for me COPYBLACK is for "photocopie" and PRINTBLACK for "print" no ? so for me the OID Canon are in the wrong section no ?

thank you :)

g-bougard commented 6 months ago

Hi @TheRoby

I made an update for Ricoh yesterday. You can install and test it with the latest nightly build: https://nightly.glpi-project.org/glpi-agent/

I didn't use the OIDs you provided as is. As I still have Rixoh snmp walk, I checked and also checked the Ricoh private mib I found. I understood we still first need to check the type of counters to select which one can be used for. I hope it works it your case. Actually it seems to work well for the 5 or 6 walks I have. And all uses different OIDs for counters under the .1.3.6.1.4.1.367.3.2.1.2.19.5.1 one.

If you vote for an aggregation of A4 & A3 Canon counters, I think this the best choice. And this will only require an update on the agent. As we only count prints or copy, I won't implement a A4+2xA3 algoritm, just A4+A3.

TheRoby commented 6 months ago

Re, I tried the latest nightly build, it seems to work :) i think i have graphical issue because i have only one point with the new value and some with only the total (the point is not on 05/01/2024) i waiting next week to see the evolution ;) Thank you :) image

For the A4+A3, don't you think that there will be a difference with the page total? On Ricoh when you print A3, the A4 counter increase of 2 ... I need to try again on Canon ;)

g-bougard commented 6 months ago

Yes, this seems like a graphical issue. Anyway this sounds promising.

The only snmp walk I have for a canon with some counters shows me we just need to do a simple add.

g-bougard commented 6 months ago

Hi @TheRoby next nightly build will also aggregate Canon counters.

TheRoby commented 5 months ago

Hi @g-bougard

Do you think you can add scan for Ricoh ? image I can send you walk if needed :)

and for Canon, here the graph in GLPI : image and (on the same printer, of course) : image

I think it's not possible to separate copy from print :( but i'm sure is not 100% copy ;)

Thanks :)

g-bougard commented 5 months ago

Hi @TheRoby

you can send me the snmpwalk output generated using the command reported here: https://glpi-agent.readthedocs.io/en/latest/bug-reporting.html#snmpwalk-output

Do you think you can also provide the printer mib you can download from the printer interface at the same time ? This may help to identify the right OID.

You can send them privately by email to: gbougard <at> teclib <dot> com

For the Canon, I don't see any dedicated counter for only print in your output. And I don't think it is provided and I don't see how to find it from the available counters. But do you think the number of prints are the "Total 1" less the "Lecture (Total 1)" ? So 128299-29330=98969 prints ? Have you check the counters in the XML are exact with the latest nightly build ? If you want, you can also provide the Canon snmpwalk output too so I can check it and add it to our private repository to guarantee its support won't evolved in the wrong way in the future.

TheRoby commented 5 months ago

I have a lot of MFP ;) Canon : Canon iR-ADV C3520 III Canon iR-ADV C3530 III Canon iR-ADV C356 III Canon iR-ADV C357 Canon iR-ADV C3830 Canon iR-ADV C5535 III Canon iR-ADV C5735 imageRunner 1643i

Ricoh : Aficio MP 301 Aficio MP C305 C352DN IM 350 IM C300 IM C3000 IM C3500 IM C4500 MP 2554 MP C2004ex MP C3003 MP C3004 MP C3004ex MP C4504ex P 800 P C600 Pro C5200S

You want the snmpwalk for each ? (i also have Xerox and Konica, if need)

g-bougard commented 5 months ago

More is better. I won't pass too much time on each, just check everything seems correct. Just tell me on which one you have scans to also inventory.

For Xerox & Konica printers, did you see any problem ?

TheRoby commented 5 months ago

Do you think you can also provide the printer mib you can download from the printer interface at the same time ? This may help to identify the right OID.

Hi, do you know what I should do for that? I do not find anything ...

For Xerox and Konica, i have only the Pages counter (like Ricoh before)

g-bougard commented 5 months ago

Thank you again @TheRoby for the walks.

I was able to add SCANNED counter support for Ricoh printers thanks to them.

Try it with next nightly build.