Skip to content

Commit

Permalink
fix: Enhanced Zebra printers support
Browse files Browse the repository at this point in the history
  • Loading branch information
g-bougard committed Nov 10, 2023
1 parent a760efb commit a340906
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 5 deletions.
1 change: 1 addition & 0 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ netdiscovery/netinventory:
* Enhanced CheckPoint devices support
* Enhanced Cisco devices support
* Enhanced Citrix devices support
* Enhanced Zebra printers support
* PR #500: Enhanced Synology NAS support with drives & storages support
* Use Parallel::ForkManager for netdiscovery & netinventory tasks
* Preload mibsupport as optimization
Expand Down
57 changes: 52 additions & 5 deletions lib/GLPI/Agent/SNMP/MibSupport/Zebra.pm
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,21 @@ use constant model2 => esi . '.6.2.3.2.1.15.1' ;
use constant serial => esi . '.1.5.0' ;
use constant fw2 => esi . '.1.9.0' ;

# See ZEBRA-MIB

use constant zebra => '.1.3.6.1.4.1.10642' ;
use constant zbrGeneralInfo => zebra . '.1' ;

use constant zbrGeneralModel => zbrGeneralInfo . '.1' ;
use constant zbrGeneralFirmwareVersion => zbrGeneralInfo . '.2.0' ;
use constant zbrGeneralName => zbrGeneralInfo . '.4.0' ;
use constant zbrGeneralUniqueId => zbrGeneralInfo . '.9.0' ;
use constant zbrGeneralCompanyName => zbrGeneralInfo . '.11.0' ;
use constant zbrGeneralLINKOSVersion => zbrGeneralInfo . '.18.0' ;

# See ZEBRA-QL-MIB

use constant zebra => '.1.3.6.1.4.1.10642' ;
use constant model1 => zebra . '.1.1.0' ;
use constant fw1 => zebra . '.1.2.0' ;
use constant model1 => zbrGeneralModel . '.0' ;

use constant zql_zebra_ql => zebra . '.200' ;
use constant model3 => zql_zebra_ql . '.19.7.0' ;
Expand All @@ -29,14 +39,30 @@ our $mibSupport = [
{
name => "zebra-printer",
sysobjectid => getRegexpOidMatch(esi)
},
{
name => "zebra-printer-zt",
sysobjectid => getRegexpOidMatch(zbrGeneralModel)
}
];

sub getSnmpHostname {
my ($self) = @_;

return getCanonicalString($self->get(zbrGeneralName));
}

sub getManufacturer {
my ($self) = @_;

return getCanonicalString($self->get(zbrGeneralCompanyName)) || 'Zebra Technologies';
}

sub getSerial {
my ($self) = @_;

# serial3 is more accurate than serial on GK420 & ZE500
return hex2char($self->get(serial3) || $self->get(serial));
return getCanonicalString($self->get(zbrGeneralUniqueId)) || hex2char($self->get(serial3) || $self->get(serial));
}

sub getModel {
Expand All @@ -48,7 +74,28 @@ sub getModel {
sub getFirmware {
my ($self) = @_;

return hex2char($self->get(fw1) || $self->get(fw2));
return hex2char($self->get(zbrGeneralFirmwareVersion) || $self->get(fw2));
}

sub run {
my ($self) = @_;

my $device = $self->device
or return;

my $manufacturer = $self->getManufacturer()
or return;

my $linkos_version = $self->get(zbrGeneralLINKOSVersion);
unless (empty($linkos_version)) {
$device->addFirmware({
NAME => "$manufacturer LinkOS",
DESCRIPTION => "$manufacturer LinkOS firmware",
TYPE => "system",
VERSION => getCanonicalString($linkos_version),
MANUFACTURER => $manufacturer
});
}
}

1;
Expand Down

0 comments on commit a340906

Please sign in to comment.