centreon / centreon-plugins

Collection of standard plugins to discover and gather cloud-to-edge metrics and status across your whole IT infrastructure.
https://www.centreon.com
Apache License 2.0
311 stars 274 forks source link

[hardware::printers::standard::rfc3805::plugin] Filter Problem #4754

Closed ermurenz closed 11 months ago

ermurenz commented 11 months ago

Hello guys, I have a possible problem with the plugin in question. I would like to diversify the control by specifying, for example, only toners or cartridges. Yet it seems that whatever regex I use, the check excludes all the components or none. Or it filters out the wrong one. Maybe I'm doing something wrong and I apologize in advance if this is the case.

These are two example commands::

/usr/lib/centreon/plugins/centreon_printers_generic_snmp.pl --plugin=hardware::printers::standard::rfc3805::plugin --mode=markersupply-usage --hostname=xxxxx --snmp-community='xxxxxx' --snmp-version='2c' --warning '30:' --critical '20:' --verbose --filter='TK-7225'

OK: Marker supply usages are ok. Skipping marker supply 'TK-7225' (instance: 1.1): filter. Marker supply 'Waste Toner Box': no level but some space remaining.

In this case I wanted it to select 'TK-7225' but resulted skipped. I tried:

--filter='TK-7225'
--filter='.*TK-7225.*'

And /usr/lib/centreon/plugins/centreon-pack/centreon_plugins.pl --plugin hardware::printers::standard::rfc3805::plugin --mode=markersupply-usage --hostname=xxxxx--snmp-community='xxxxxx' --snmp-version='1' --warning '25:' --critical '15:' --verbose --filter '.*Cartr.*'

OK: Marker supply usages are ok. | Skipping marker supply 'Black Toner Cartridge S/N:CRUM-23021310496' (instance: 1.1): filter. Skipping marker supply 'Fuser' (instance: 1.2): filter. Skipping marker supply 'Transfer Roller' (instance: 1.3): filter. Skipping marker supply 'MP Roller' (instance: 1.4): filter. Skipping marker supply 'MP Retard Roller' (instance: 1.5): filter. Skipping marker supply 'Tray 1 Roller' (instance: 1.6): filter. Marker supply 'Tray 1 Retard Roller': no level but some space remaining.

Similar situation here.I wanted it to select 'Cartridge' but resulted skipped.I tried

--filter '.*Cartr.*'
--filter '.*Cartridge.*'
--filter  ^(?!.*Cart.*)$

no avail. I apologize for my bad English Thanks in advance.

ermurenz commented 11 months ago

The solution seems to be:

--filter '1.1$|1.2$|1.3$'

It would be great if it worked the other way too but the important thing is that it does its job. I hope it is useful to someone.