Closed mantis closed 1 year ago
the "AI solution" to this code is the following approach, which works for me is:
diff --git a/check_snmp_printer b/check_snmp_printer
index 42db74c..bfc6e32 100755
--- a/check_snmp_printer
+++ b/check_snmp_printer
@@ -568,7 +568,8 @@ sub get_consumables {
my @split = split(' ',$consumable = $name);
foreach my $rconsumable (@split) {
if ($rconsumable =~ m/Toner/) {
- ($consumable) = $name =~ /(?<=Toner )(\w+)/;
+ ($consumable) = $name =~ /(?:Toner\s+(\w+))|(?:(\w+)\s+Toner)/;
+ $consumable = $1 || $2 if (defined $1 || defined $2);
} else {
next;
}
Hi -
Thanks for the snmpwalk information that was helpful. The AI solution is the correct fix and has been included in the next release.
wow, I'm impressed at the AI "Apprentice" then - like any apprentice you work with, it needed a bit of encouragement to get to that solution - as the first version... well... It confidently got wrong :)
Hi Tylan,
Can you check out the below when you get a chance - toner names are not displayed?