Thx for the suggestion but no, my printer is wireless networked and not a Canon but i spent some time looking into it this morning and came up with a script.
Basically using net-snmp.
It rough and ready but meh.
#!/usr/bin/env fish
# Fetch SNMP output
set snmp_output (snmpwalk -v 1 -c public 192.168.1.111)
# Initialize arrays to hold the processed data
set status_messages
set cartridge_levels
set cartridge_names
set max_levels
# Process and collect data
for line in $snmp_output
if echo $line | grep '2.43.18.1.1.8' > /dev/null
set status_messages $status_messages (echo $line | sed 's/.*STRING: //' | sed 's/"//g')
else if echo $line | grep '2.43.11.1.1.9' > /dev/null
set cartridge_levels $cartridge_levels (echo $line | sed 's/.*INTEGER: //')
else if echo $line | grep '2.43.11.1.1.6' > /dev/null
set cartridge_names $cartridge_names (echo $line | sed 's/.*STRING: //' | sed 's/"//g')
else if echo $line | grep '2.43.11.1.1.8' > /dev/null
set max_levels $max_levels (echo $line | grep -oE '[0-9]+$')
end
end
# Combine and output data with aligned columns and percentages
for i in (seq (count $cartridge_names))
set max_level $max_levels[$i]
if test -z "$max_level"
set max_level 100 # Default to 100 if no valid max level found
end
set level_percentage (math "$cartridge_levels[$i] * 100 / $max_level")
printf "%-20s Cartridge %-10s %-40s\n" "$cartridge_names[$i]" "$level_percentage%" "$status_messages[$i]"
end
Start it, e.g typing system-config-printer in konsole, and double-click on your printer then select “Ink/Toner Levels” tab, and check if it works or you get any error messages.