diff --git a/json/SnmpDiscoveryCollector.json b/json/SnmpDiscoveryCollector.json index 61b5d87..c05350a 100644 --- a/json/SnmpDiscoveryCollector.json +++ b/json/SnmpDiscoveryCollector.json @@ -261,6 +261,13 @@ "update_policy": "master_locked", "finalclass": "SynchroAttribute" }, + { + "attcode": "snmp_sysUptime", + "update": "1", + "reconcile": "0", + "update_policy": "master_locked", + "finalclass": "SynchroAttribute" + }, { "attcode": "snmpcredentials_id", "update": "1", diff --git a/module.snmp-discovery-collector.php b/module.snmp-discovery-collector.php index 2c243e0..9efdc64 100755 --- a/module.snmp-discovery-collector.php +++ b/module.snmp-discovery-collector.php @@ -7,6 +7,6 @@ SetupWebPage::AddModule( __FILE__, // Path to the current file, all other file names are relative to the directory containing this file - 'snmp-discovery-collector/1.3.2', + 'snmp-discovery-collector/1.4.0', [] ); diff --git a/src/SnmpDiscoveryCollector.class.inc.php b/src/SnmpDiscoveryCollector.class.inc.php index d464ac8..88bd946 100644 --- a/src/SnmpDiscoveryCollector.class.inc.php +++ b/src/SnmpDiscoveryCollector.class.inc.php @@ -27,7 +27,7 @@ public function Init(): void parent::Init(); // Check if modules are installed - Utils::CheckModuleInstallation('sv-snmp-discovery', true); + Utils::CheckModuleInstallation('sv-snmp-discovery/1.2.0', true); // Load SNMP discovery application settings $this->LoadApplicationSettings(); @@ -122,6 +122,7 @@ protected function HeaderIsAllowed(string $sHeader): bool 'snmp_sysdescr', 'snmp_syslocation', 'snmp_syscontact', + 'snmp_sysuptime', ])) return true; /** @@ -347,8 +348,9 @@ protected static function LoadSnmpCredentials(int $iKey): SnmpCredentials * snmp_last_discovery: string, * snmp_sysname: string, * snmp_sysdescr: string, - * snmp_syscontact: string, * snmp_syslocation: string, + * snmp_syscontact: string, + * snmp_sysuptime: int, * }|null * @throws Exception */ @@ -402,11 +404,13 @@ protected function DiscoverDeviceByIP(int $iKey): ?array // Load system table info [ '.1.3.6.1.2.1.1.1.0' => $sSysDescr, + '.1.3.6.1.2.1.1.3.0' => $sSysUptime, '.1.3.6.1.2.1.1.4.0' => $sSysContact, '.1.3.6.1.2.1.1.5.0' => $sSysName, '.1.3.6.1.2.1.1.6.0' => $sSysLocation, ] = @$oSNMP->get([ /* SNMPv2-MIB::sysDescr */ '.1.3.6.1.2.1.1.1.0', + /* SNMPv2-MIB::sysUptime */ '1.3.6.1.2.1.1.3.0', /* SNMPv2-MIB::sysContact */ '.1.3.6.1.2.1.1.4.0', /* SNMPv2-MIB::sysName */ '.1.3.6.1.2.1.1.5.0', /* SNMPv2-MIB::sysLocation */ '.1.3.6.1.2.1.1.6.0', @@ -426,8 +430,9 @@ protected function DiscoverDeviceByIP(int $iKey): ?array 'snmp_last_discovery' => date(Utils::GetConfigurationValue('date_format', 'Y-m-d H:i:s')), 'snmp_sysname' => $sSysName, 'snmp_sysdescr' => trim($sSysDescr), - 'snmp_syscontact' => $sSysContact, 'snmp_syslocation' => $sSysLocation, + 'snmp_syscontact' => $sSysContact, + 'snmp_sysuptime' => (int) round($sSysUptime/100), ]; } }