Skip to content

Commit c887d36

Browse files
committed
fix: Updated Lexmark printers support
1 parent 03af48e commit c887d36

File tree

3 files changed

+109
-1
lines changed

3 files changed

+109
-1
lines changed

Changes

+1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ netdiscovery/netinventory:
4949
* Added Raritan PDU devices support
5050
* Updated sysobject.ids
5151
* Added Avaya J100 series IP Phones support
52+
* Updated Lexmark printers support
5253

5354
deploy:
5455
* Fix checks on command run and clarify reason of success or failure. This fixes

lib/GLPI/Agent/SNMP/Device.pm

-1
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,6 @@ sub setSerial {
269269
'.1.3.6.1.4.1.248.14.1.1.9.1.10.1', # Hirschman MIB
270270
'.1.3.6.1.4.1.253.8.53.3.2.1.3.1', # Xerox-MIB
271271
'.1.3.6.1.4.1.367.3.2.1.2.1.4.0', # Ricoh-MIB
272-
'.1.3.6.1.4.1.641.2.1.2.1.6.1', # Lexmark-MIB
273272
'.1.3.6.1.4.1.1602.1.2.1.4.0', # Canon-MIB
274273
'.1.3.6.1.4.1.2435.2.3.9.4.2.1.5.5.1.0', # Brother-MIB
275274
'.1.3.6.1.4.1.318.1.1.4.1.5.0', # MasterSwitch-MIB
+108
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
package GLPI::Agent::SNMP::MibSupport::Lexmark;
2+
3+
use strict;
4+
use warnings;
5+
6+
use parent 'GLPI::Agent::SNMP::MibSupportTemplate';
7+
8+
use GLPI::Agent::Tools;
9+
use GLPI::Agent::Tools::SNMP;
10+
11+
use constant enterprises => '.1.3.6.1.4.1';
12+
13+
# LEXMARK-ROOT-MIB
14+
use constant lexmark => enterprises . '.641';
15+
16+
# LEXMARK-PVT-MIB
17+
use constant printer => lexmark . '.2';
18+
19+
use constant prtgenInfoEntry => printer . '1.2.1';
20+
21+
use constant prtgenPrinterName => prtgenInfoEntry . '.2.1' ;
22+
use constant prtgenCodeRevision => prtgenInfoEntry . '.4.1' ;
23+
use constant prtgenSerialNo => prtgenInfoEntry . '.6.1' ;
24+
25+
# LEXMARK-MPS-MIB
26+
use constant mps => lexmark . '.6' ;
27+
28+
use constant device => mps . '.2';
29+
use constant inventory => mps . '.3';
30+
31+
# OID name for the 2 following are extrapolated
32+
use constant deviceModel => device . '.3.1.4.1';
33+
use constant deviceSerial => device . '.3.1.5.1';
34+
35+
use constant hwInventorySerialNumber => inventory . '.1.1.7.1.1';
36+
use constant swInventoryRevision => inventory . '.3.1.7.1.1' ;
37+
38+
# Printer-MIB
39+
use constant prtGeneralSerialNumber => '.1.3.6.1.2.1.43.5.1.1.17.1';
40+
41+
# HOST-RESOURCES-MIB
42+
use constant hrDeviceDescr => '.1.3.6.1.2.1.25.3.2.1.3.1';
43+
44+
our $mibSupport = [
45+
{
46+
name => "lexmark-printer",
47+
sysobjectid => getRegexpOidMatch(lexmark)
48+
}
49+
];
50+
51+
sub getModel {
52+
my ($self) = @_;
53+
54+
my $model;
55+
foreach my $oid (deviceModel, prtgenPrinterName) {
56+
$model = getCanonicalString($self->get($oid))
57+
and last;
58+
}
59+
60+
unless ($model) {
61+
$model = getCanonicalString($self->get(hrDeviceDescr))
62+
or return;
63+
($model) = $model =~ /^(Lexmark\s+\S+)/;
64+
}
65+
66+
return unless $model;
67+
68+
# Strip manufacturer
69+
$model =~ s/^Lexmark\s+//i;
70+
71+
return $model;
72+
}
73+
74+
sub getFirmware {
75+
my ($self) = @_;
76+
77+
my $firmware;
78+
foreach my $oid (swInventoryRevision, prtgenCodeRevision) {
79+
$firmware = getCanonicalString($self->get($oid))
80+
and last;
81+
}
82+
83+
return $firmware;
84+
}
85+
86+
sub getSerial {
87+
my ($self) = @_;
88+
89+
my $serial;
90+
foreach my $oid (prtGeneralSerialNumber, deviceSerial, prtgenSerialNo) {
91+
$serial = getCanonicalString($self->get($oid))
92+
and last;
93+
}
94+
95+
return $serial;
96+
}
97+
98+
1;
99+
100+
__END__
101+
102+
=head1 NAME
103+
104+
GLPI::Agent::SNMP::MibSupport::Lexmark - Inventory module for Lexmark Printers
105+
106+
=head1 DESCRIPTION
107+
108+
The module enhances Lexmark printers devices support.

0 commit comments

Comments
 (0)