mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Implement OS specific information discovery (#11446)
* Implement OS specific information discovery That way it doesn't have to be fetched during polling Also improve discovery process, os is only detected once, in the core module. EXA is the test os, a couple improvements there. * Use local variable, then unset it so we don't pollute. * fix style issues * test and other fixes * attribute update fixes * Update exa data, need new source data * null missing "os" values * fix ftos odd character * fix ftos odd character * only null for new style or we will reset to null every discovery * Move device observer to own class * Handle location, relocate event logging * update exa e7-2 data * update ird test data, apparently unicode is now working. * update Linux ntc, now uses correct icon * Only load all os on the web, also, we can't load existing the the database isn't connected. * only for devices that have a location * revert ftos test data apparently * revert ird
This commit is contained in:
41
LibreNMS/Interfaces/Discovery/OSDetection.php
Normal file
41
LibreNMS/Interfaces/Discovery/OSDetection.php
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* OSDetection.php
|
||||||
|
*
|
||||||
|
* Used to detect the os of a device. Primarily this should be done via yaml.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* @package LibreNMS
|
||||||
|
* @link http://librenms.org
|
||||||
|
* @copyright 2020 Tony Murray
|
||||||
|
* @author Tony Murray <murraytony@gmail.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace LibreNMS\Interfaces\Discovery;
|
||||||
|
|
||||||
|
use App\Models\Device;
|
||||||
|
|
||||||
|
interface OSDetection
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Check if the give device is this OS.
|
||||||
|
* $device->sysObjectID and $device->sysDescr will be pre-populated
|
||||||
|
* Please avoid additional snmp queries if possible
|
||||||
|
*
|
||||||
|
* @param Device $device
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public static function detectOS(Device $device): bool;
|
||||||
|
}
|
||||||
36
LibreNMS/Interfaces/Discovery/OSDiscovery.php
Normal file
36
LibreNMS/Interfaces/Discovery/OSDiscovery.php
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* OsDiscovery.php
|
||||||
|
*
|
||||||
|
* Discovers information about an OS and updates it in the database
|
||||||
|
* Examples of things that should be updated: version, hardware, features, serial
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* @package LibreNMS
|
||||||
|
* @link http://librenms.org
|
||||||
|
* @copyright 2020 Tony Murray
|
||||||
|
* @author Tony Murray <murraytony@gmail.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace LibreNMS\Interfaces\Discovery;
|
||||||
|
|
||||||
|
interface OSDiscovery
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Discover additional information about the OS.
|
||||||
|
* Primarily this is just version, hardware, features, serial, but could be anything
|
||||||
|
*/
|
||||||
|
public function discoverOS(): void;
|
||||||
|
}
|
||||||
35
LibreNMS/Interfaces/Polling/OSPolling.php
Normal file
35
LibreNMS/Interfaces/Polling/OSPolling.php
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* OSPolling.php
|
||||||
|
*
|
||||||
|
* Custom OS polling data, this could be anything including custom graphs
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* @package LibreNMS
|
||||||
|
* @link http://librenms.org
|
||||||
|
* @copyright 2020 Tony Murray
|
||||||
|
* @author Tony Murray <murraytony@gmail.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace LibreNMS\Interfaces\Polling;
|
||||||
|
|
||||||
|
interface OSPolling
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Poll additional OS data.
|
||||||
|
* Data must be manually saved within this method.
|
||||||
|
*/
|
||||||
|
public function pollOS();
|
||||||
|
}
|
||||||
116
LibreNMS/Modules/OS.php
Normal file
116
LibreNMS/Modules/OS.php
Normal file
@@ -0,0 +1,116 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* OS.php
|
||||||
|
*
|
||||||
|
* -Description-
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* @package LibreNMS
|
||||||
|
* @link http://librenms.org
|
||||||
|
* @copyright 2020 Tony Murray
|
||||||
|
* @author Tony Murray <murraytony@gmail.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace LibreNMS\Modules;
|
||||||
|
|
||||||
|
use LibreNMS\Config;
|
||||||
|
use LibreNMS\Interfaces\Discovery\OSDiscovery;
|
||||||
|
use LibreNMS\Interfaces\Module;
|
||||||
|
use LibreNMS\Interfaces\Polling\OSPolling;
|
||||||
|
use LibreNMS\Util\Url;
|
||||||
|
|
||||||
|
class OS implements Module
|
||||||
|
{
|
||||||
|
public function discover(\LibreNMS\OS $os)
|
||||||
|
{
|
||||||
|
if ($os instanceof OSDiscovery) {
|
||||||
|
// null out values in case they aren't filled.
|
||||||
|
$os->getDeviceModel()->fill([
|
||||||
|
'hardware' => null,
|
||||||
|
'version' => null,
|
||||||
|
'features' => null,
|
||||||
|
'serial' => null,
|
||||||
|
'icon' => null,
|
||||||
|
// 'location_id' => null, // TODO set location
|
||||||
|
]);
|
||||||
|
|
||||||
|
$os->discoverOS();
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->handleChanges($os);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function poll(\LibreNMS\OS $os)
|
||||||
|
{
|
||||||
|
$deviceModel = $os->getDeviceModel();
|
||||||
|
if ($os instanceof OSPolling) {
|
||||||
|
$os->pollOS();
|
||||||
|
} else {
|
||||||
|
// legacy poller files
|
||||||
|
$device = $os->getDevice();
|
||||||
|
if (is_file(base_path('/includes/polling/os/' . $device['os'] . '.inc.php'))) {
|
||||||
|
// OS Specific
|
||||||
|
include base_path('/includes/polling/os/' . $device['os'] . '.inc.php');
|
||||||
|
} elseif ($device['os_group'] && base_path('/includes/polling/os/' . $device['os_group'] . '.inc.php')) {
|
||||||
|
// OS Group Specific
|
||||||
|
include base_path('/includes/polling/os/' . $device['os_group'] . '.inc.php');
|
||||||
|
} else {
|
||||||
|
echo "Generic :(\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
// handle legacy variables, sometimes they are false
|
||||||
|
$deviceModel->version = ($version ?? $deviceModel->version) ?: null;
|
||||||
|
$deviceModel->hardware = ($hardware ?? $deviceModel->hardware) ?: null;
|
||||||
|
$deviceModel->features = ($features ?? $deviceModel->features) ?: null;
|
||||||
|
$deviceModel->serial = ($serial ?? $deviceModel->serial) ?: null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->updateLocation($os, $location ?? null);
|
||||||
|
$this->handleChanges($os);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function cleanup(\LibreNMS\OS $os)
|
||||||
|
{
|
||||||
|
// no cleanup needed?
|
||||||
|
}
|
||||||
|
|
||||||
|
private function handleChanges(\LibreNMS\OS $os)
|
||||||
|
{
|
||||||
|
$device = $os->getDeviceModel();
|
||||||
|
|
||||||
|
$device->icon = basename(Url::findOsImage($device->os, $device->features, null, 'images/os/'));
|
||||||
|
|
||||||
|
echo trans("device.attributes.location") . ": $device->location\n";
|
||||||
|
foreach (['hardware', 'version', 'features', 'serial'] as $attribute) {
|
||||||
|
echo \App\Observers\DeviceObserver::attributeChangedMessage($attribute, $device->$attribute, $device->getOriginal($attribute)) . PHP_EOL;
|
||||||
|
}
|
||||||
|
|
||||||
|
$device->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
private function updateLocation(\LibreNMS\OS $os, $altLocation = null)
|
||||||
|
{
|
||||||
|
$device = $os->getDeviceModel();
|
||||||
|
if ($device->override_sysLocation == 0) {
|
||||||
|
$device->setLocation($altLocation ?? snmp_get($os->getDevice(), 'sysLocation.0', '-Ovq', 'SNMPv2-MIB'));
|
||||||
|
}
|
||||||
|
|
||||||
|
// make sure the location has coordinates
|
||||||
|
if (Config::get('geoloc.latlng', true) && $device->location && !$device->location->hasCoordinates()) {
|
||||||
|
$device->location->lookupCoordinates();
|
||||||
|
$device->location->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -26,6 +26,7 @@
|
|||||||
namespace LibreNMS;
|
namespace LibreNMS;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use DeviceCache;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
use LibreNMS\Device\WirelessSensor;
|
use LibreNMS\Device\WirelessSensor;
|
||||||
use LibreNMS\Device\YamlDiscovery;
|
use LibreNMS\Device\YamlDiscovery;
|
||||||
@@ -44,7 +45,6 @@ class OS implements ProcessorDiscovery
|
|||||||
}
|
}
|
||||||
|
|
||||||
private $device; // annoying use of references to make sure this is in sync with global $device variable
|
private $device; // annoying use of references to make sure this is in sync with global $device variable
|
||||||
private $device_model;
|
|
||||||
private $cache; // data cache
|
private $cache; // data cache
|
||||||
private $pre_cache; // pre-fetch data cache
|
private $pre_cache; // pre-fetch data cache
|
||||||
|
|
||||||
@@ -84,11 +84,7 @@ class OS implements ProcessorDiscovery
|
|||||||
*/
|
*/
|
||||||
public function getDeviceModel()
|
public function getDeviceModel()
|
||||||
{
|
{
|
||||||
if (is_null($this->device_model)) {
|
return DeviceCache::get($this->getDeviceId());
|
||||||
$this->device_model = Device::find($this->getDeviceId());
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->device_model;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function preCache()
|
public function preCache()
|
||||||
|
|||||||
50
LibreNMS/OS/Exa.php
Normal file
50
LibreNMS/OS/Exa.php
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Exa.php
|
||||||
|
*
|
||||||
|
* Calix EXA OS
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* @package LibreNMS
|
||||||
|
* @link http://librenms.org
|
||||||
|
* @copyright 2020 Tony Murray
|
||||||
|
* @author Tony Murray <murraytony@gmail.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace LibreNMS\OS;
|
||||||
|
|
||||||
|
use LibreNMS\Interfaces\Discovery\OSDiscovery;
|
||||||
|
use LibreNMS\OS;
|
||||||
|
|
||||||
|
class Exa extends OS implements OSDiscovery
|
||||||
|
{
|
||||||
|
public function discoverOS(): void
|
||||||
|
{
|
||||||
|
$device = $this->getDeviceModel();
|
||||||
|
$info = snmp_getnext_multi($this->getDevice(), 'e7CardSoftwareVersion e7CardSerialNumber', '-OQUs', 'E7-Calix-MIB');
|
||||||
|
$device->version = $info['e7CardSoftwareVersion'];
|
||||||
|
$device->serial = $info['e7CardSerialNumber'];
|
||||||
|
$device->hardware = "Calix " . $device->sysDescr;
|
||||||
|
|
||||||
|
$cards = explode("\n", snmp_walk($this->getDevice(), 'e7CardProvType', '-OQv', 'E7-Calix-MIB'));
|
||||||
|
$card_count = [];
|
||||||
|
foreach ($cards as $card) {
|
||||||
|
$card_count[$card] = ($card_count[$card] ?? 0) + 1;
|
||||||
|
}
|
||||||
|
$device->features = implode(', ', array_map(function ($card) use ($card_count) {
|
||||||
|
return ($card_count[$card] > 1 ? $card_count[$card] . 'x ' : '') . $card;
|
||||||
|
}, array_keys($card_count)));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -25,10 +25,12 @@
|
|||||||
|
|
||||||
namespace LibreNMS\Util;
|
namespace LibreNMS\Util;
|
||||||
|
|
||||||
|
use App\Facades\DeviceCache;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
use LibreNMS\Config;
|
use LibreNMS\Config;
|
||||||
use LibreNMS\Exceptions\FileNotFoundException;
|
use LibreNMS\Exceptions\FileNotFoundException;
|
||||||
use LibreNMS\Exceptions\InvalidModuleException;
|
use LibreNMS\Exceptions\InvalidModuleException;
|
||||||
|
use LibreNMS\OS;
|
||||||
use Symfony\Component\Yaml\Yaml;
|
use Symfony\Component\Yaml\Yaml;
|
||||||
|
|
||||||
class ModuleTestHelper
|
class ModuleTestHelper
|
||||||
@@ -517,6 +519,7 @@ class ModuleTestHelper
|
|||||||
try {
|
try {
|
||||||
Config::set('snmp.community', [$this->file_name]);
|
Config::set('snmp.community', [$this->file_name]);
|
||||||
$device_id = addHost($snmpsim->getIp(), 'v2c', $snmpsim->getPort());
|
$device_id = addHost($snmpsim->getIp(), 'v2c', $snmpsim->getPort());
|
||||||
|
DeviceCache::setPrimary($device_id);
|
||||||
|
|
||||||
// disable to block normal pollers
|
// disable to block normal pollers
|
||||||
dbUpdate(['disabled' => 1], 'devices', 'device_id=?', [$device_id]);
|
dbUpdate(['disabled' => 1], 'devices', 'device_id=?', [$device_id]);
|
||||||
|
|||||||
@@ -26,6 +26,7 @@
|
|||||||
namespace LibreNMS\Util;
|
namespace LibreNMS\Util;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Config;
|
||||||
|
|
||||||
class Rewrite
|
class Rewrite
|
||||||
{
|
{
|
||||||
@@ -208,6 +209,36 @@ class Rewrite
|
|||||||
return $device['hardware'];
|
return $device['hardware'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function location($location)
|
||||||
|
{
|
||||||
|
$location = str_replace(["\n", '"'], '', $location);
|
||||||
|
|
||||||
|
if (is_array(Config::get('location_map_regex'))) {
|
||||||
|
foreach (Config::get('location_map_regex') as $reg => $val) {
|
||||||
|
if (preg_match($reg, $location)) {
|
||||||
|
$location = $val;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_array(Config::get('location_map_regex_sub'))) {
|
||||||
|
foreach (Config::get('location_map_regex_sub') as $reg => $val) {
|
||||||
|
if (preg_match($reg, $location)) {
|
||||||
|
$location = preg_replace($reg, $val, $location);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Config::has("location_map.$location")) {
|
||||||
|
$location = Config::get("location_map.$location");
|
||||||
|
}
|
||||||
|
|
||||||
|
return $location;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static function vmwareGuest($guest_id)
|
public static function vmwareGuest($guest_id)
|
||||||
{
|
{
|
||||||
$guests = [
|
$guests = [
|
||||||
|
|||||||
@@ -7,15 +7,15 @@ use Fico7489\Laravel\Pivot\Traits\PivotEventTrait;
|
|||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||||
use Illuminate\Database\Query\JoinClause;
|
use Illuminate\Database\Query\JoinClause;
|
||||||
use Illuminate\Support\Collection;
|
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
use LibreNMS\DB\Schema;
|
use LibreNMS\DB\Eloquent;
|
||||||
use LibreNMS\Exceptions\InvalidIpException;
|
use LibreNMS\Exceptions\InvalidIpException;
|
||||||
use LibreNMS\Util\IP;
|
use LibreNMS\Util\IP;
|
||||||
use LibreNMS\Util\IPv4;
|
use LibreNMS\Util\IPv4;
|
||||||
use LibreNMS\Util\IPv6;
|
use LibreNMS\Util\IPv6;
|
||||||
use LibreNMS\Util\Url;
|
use LibreNMS\Util\Rewrite;
|
||||||
use LibreNMS\Util\Time;
|
use LibreNMS\Util\Time;
|
||||||
|
use LibreNMS\Util\Url;
|
||||||
use Permissions;
|
use Permissions;
|
||||||
|
|
||||||
class Device extends BaseModel
|
class Device extends BaseModel
|
||||||
@@ -24,7 +24,7 @@ class Device extends BaseModel
|
|||||||
|
|
||||||
public $timestamps = false;
|
public $timestamps = false;
|
||||||
protected $primaryKey = 'device_id';
|
protected $primaryKey = 'device_id';
|
||||||
protected $fillable = ['hostname', 'ip', 'status', 'status_reason'];
|
protected $fillable = ['hostname', 'ip', 'status', 'status_reason', 'sysName', 'sysDescr', 'sysObjectID', 'hardware', 'version', 'features', 'serial', 'icon'];
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
'last_polled' => 'datetime',
|
'last_polled' => 'datetime',
|
||||||
'status' => 'boolean',
|
'status' => 'boolean',
|
||||||
@@ -36,67 +36,9 @@ class Device extends BaseModel
|
|||||||
public static function boot()
|
public static function boot()
|
||||||
{
|
{
|
||||||
parent::boot();
|
parent::boot();
|
||||||
if (Schema::isCurrent()) {
|
if (!app()->runningInConsole()) {
|
||||||
self::loadAllOs(true);
|
self::loadAllOs(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static::deleting(function (Device $device) {
|
|
||||||
// delete related data
|
|
||||||
$device->ports()->delete();
|
|
||||||
$device->syslogs()->delete();
|
|
||||||
$device->eventlogs()->delete();
|
|
||||||
$device->applications()->delete();
|
|
||||||
|
|
||||||
// handle device dependency updates
|
|
||||||
$device->children->each->updateMaxDepth($device->device_id);
|
|
||||||
});
|
|
||||||
|
|
||||||
// handle device dependency updates
|
|
||||||
static::updated(function (Device $device) {
|
|
||||||
if ($device->isDirty('max_depth')) {
|
|
||||||
$device->children->each->updateMaxDepth();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
static::pivotAttached(function (Device $device, $relationName, $pivotIds, $pivotIdsAttributes) {
|
|
||||||
if ($relationName == 'parents') {
|
|
||||||
// a parent attached to this device
|
|
||||||
|
|
||||||
// update the parent's max depth incase it used to be standalone
|
|
||||||
Device::whereIn('device_id', $pivotIds)->get()->each->validateStandalone();
|
|
||||||
|
|
||||||
// make sure this device's max depth is updated
|
|
||||||
$device->updateMaxDepth();
|
|
||||||
} elseif ($relationName == 'children') {
|
|
||||||
// a child device attached to this device
|
|
||||||
|
|
||||||
// if this device used to be standalone, we need to udpate max depth
|
|
||||||
$device->validateStandalone();
|
|
||||||
|
|
||||||
// make sure the child's max depth is updated
|
|
||||||
Device::whereIn('device_id', $pivotIds)->get()->each->updateMaxDepth();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
static::pivotDetached(function (Device $device, $relationName, $pivotIds) {
|
|
||||||
if ($relationName == 'parents') {
|
|
||||||
// this device detached from a parent
|
|
||||||
|
|
||||||
// update this devices max depth
|
|
||||||
$device->updateMaxDepth();
|
|
||||||
|
|
||||||
// parent may now be standalone, update old parent
|
|
||||||
Device::whereIn('device_id', $pivotIds)->get()->each->validateStandalone();
|
|
||||||
} elseif ($relationName == 'children') {
|
|
||||||
// a child device detached from this device
|
|
||||||
|
|
||||||
// update the detached child's max_depth
|
|
||||||
Device::whereIn('device_id', $pivotIds)->get()->each->updateMaxDepth();
|
|
||||||
|
|
||||||
// this device may be standalone, update it
|
|
||||||
$device->validateStandalone();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---- Helper Functions ----
|
// ---- Helper Functions ----
|
||||||
@@ -262,7 +204,7 @@ class Device extends BaseModel
|
|||||||
\LibreNMS\Config::set('os', array_replace_recursive($os_defs, \LibreNMS\Config::get('os')));
|
\LibreNMS\Config::set('os', array_replace_recursive($os_defs, \LibreNMS\Config::get('os')));
|
||||||
} else {
|
} else {
|
||||||
// load from yaml
|
// load from yaml
|
||||||
if ($existing) {
|
if ($existing && Eloquent::isConnected()) {
|
||||||
$os_list = [];
|
$os_list = [];
|
||||||
foreach (self::distinct('os')->get('os')->toArray() as $os) {
|
foreach (self::distinct('os')->get('os')->toArray() as $os) {
|
||||||
$os_list[] = $install_dir . '/includes/definitions/' . $os['os'] . '.yaml';
|
$os_list[] = $install_dir . '/includes/definitions/' . $os['os'] . '.yaml';
|
||||||
@@ -451,6 +393,17 @@ class Device extends BaseModel
|
|||||||
return $this->attribs->pluck('attrib_value', 'attrib_type')->toArray();
|
return $this->attribs->pluck('attrib_value', 'attrib_type')->toArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setLocation($location_text)
|
||||||
|
{
|
||||||
|
$location_text = $location_text ? Rewrite::location($location_text) : null;
|
||||||
|
|
||||||
|
$this->location_id = null;
|
||||||
|
if ($location_text) {
|
||||||
|
$location = Location::firstOrCreate(['location' => $location_text]);
|
||||||
|
$this->location()->associate($location);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ---- Accessors/Mutators ----
|
// ---- Accessors/Mutators ----
|
||||||
|
|
||||||
public function getIconAttribute($icon)
|
public function getIconAttribute($icon)
|
||||||
|
|||||||
87
app/Observers/DeviceObserver.php
Normal file
87
app/Observers/DeviceObserver.php
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Observers;
|
||||||
|
|
||||||
|
use App\Models\Device;
|
||||||
|
|
||||||
|
class DeviceObserver
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Handle the device "updated" event.
|
||||||
|
*
|
||||||
|
* @param \App\Models\Device $device
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function updated(Device $device)
|
||||||
|
{
|
||||||
|
// handle device dependency updates
|
||||||
|
if ($device->isDirty('max_depth')) {
|
||||||
|
$device->children->each->updateMaxDepth();
|
||||||
|
}
|
||||||
|
|
||||||
|
// key attribute changes
|
||||||
|
foreach (['os', 'sysName', 'version', 'hardware', 'features', 'serial', 'icon'] as $attribute) {
|
||||||
|
if ($device->isDirty($attribute)) {
|
||||||
|
\Log::event(self::attributeChangedMessage($attribute, $device->$attribute, $device->getOriginal($attribute)), $device, 'system', 3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($device->isDirty('location_id')) {
|
||||||
|
\Log::event(self::attributeChangedMessage('location', (string)$device->location, null), $device, 'system', 3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle the device "deleting" event.
|
||||||
|
*
|
||||||
|
* @param \App\Models\Device $device
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function deleting(Device $device)
|
||||||
|
{
|
||||||
|
// delete related data
|
||||||
|
$device->ports()->delete();
|
||||||
|
$device->syslogs()->delete();
|
||||||
|
$device->eventlogs()->delete();
|
||||||
|
$device->applications()->delete();
|
||||||
|
|
||||||
|
// handle device dependency updates
|
||||||
|
$device->children->each->updateMaxDepth($device->device_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle the device "Pivot Attached" event.
|
||||||
|
*
|
||||||
|
* @param \App\Models\Device $device
|
||||||
|
* @param string $relationName parents or children
|
||||||
|
* @param array $pivotIds list of pivot ids
|
||||||
|
* @param array $pivotIdsAttributes additional pivot attributes
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function pivotAttached(Device $device, $relationName, $pivotIds, $pivotIdsAttributes)
|
||||||
|
{
|
||||||
|
if ($relationName == 'parents') {
|
||||||
|
// a parent attached to this device
|
||||||
|
|
||||||
|
// update the parent's max depth incase it used to be standalone
|
||||||
|
Device::whereIn('device_id', $pivotIds)->get()->each->validateStandalone();
|
||||||
|
|
||||||
|
// make sure this device's max depth is updated
|
||||||
|
$device->updateMaxDepth();
|
||||||
|
} elseif ($relationName == 'children') {
|
||||||
|
// a child device attached to this device
|
||||||
|
|
||||||
|
// if this device used to be standalone, we need to udpate max depth
|
||||||
|
$device->validateStandalone();
|
||||||
|
|
||||||
|
// make sure the child's max depth is updated
|
||||||
|
Device::whereIn('device_id', $pivotIds)->get()->each->updateMaxDepth();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function attributeChangedMessage($attribute, $value, $previous)
|
||||||
|
{
|
||||||
|
return trans("device.attributes.$attribute") . ': '
|
||||||
|
. (($previous && $previous != $value) ? "$previous -> " : '')
|
||||||
|
. $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,12 +2,11 @@
|
|||||||
|
|
||||||
namespace App\Providers;
|
namespace App\Providers;
|
||||||
|
|
||||||
use App\Facades\DeviceCache;
|
use App\Models\Sensor;
|
||||||
use Illuminate\Database\Eloquent\Relations\Relation;
|
use Illuminate\Database\Eloquent\Relations\Relation;
|
||||||
use Illuminate\Support\Facades\Blade;
|
use Illuminate\Support\Facades\Blade;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
use Illuminate\Support\ServiceProvider;
|
use Illuminate\Support\ServiceProvider;
|
||||||
use App\Models\Sensor;
|
|
||||||
use LibreNMS\Config;
|
use LibreNMS\Config;
|
||||||
use LibreNMS\Permissions;
|
use LibreNMS\Permissions;
|
||||||
use LibreNMS\Util\IP;
|
use LibreNMS\Util\IP;
|
||||||
@@ -47,6 +46,7 @@ class AppServiceProvider extends ServiceProvider
|
|||||||
$this->bootCustomBladeDirectives();
|
$this->bootCustomBladeDirectives();
|
||||||
$this->bootCustomValidators();
|
$this->bootCustomValidators();
|
||||||
$this->configureMorphAliases();
|
$this->configureMorphAliases();
|
||||||
|
$this->bootObservers();
|
||||||
}
|
}
|
||||||
|
|
||||||
private function bootCustomBladeDirectives()
|
private function bootCustomBladeDirectives()
|
||||||
@@ -120,6 +120,11 @@ class AppServiceProvider extends ServiceProvider
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function bootObservers()
|
||||||
|
{
|
||||||
|
\App\Models\Device::observe(\App\Observers\DeviceObserver::class);
|
||||||
|
}
|
||||||
|
|
||||||
private function bootCustomValidators()
|
private function bootCustomValidators()
|
||||||
{
|
{
|
||||||
Validator::extend('alpha_space', function ($attribute, $value) {
|
Validator::extend('alpha_space', function ($attribute, $value) {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
os: exa
|
os: exa
|
||||||
text: Calix E7
|
text: Calix EXA
|
||||||
type: network
|
type: network
|
||||||
ifname: true
|
ifname: true
|
||||||
empty_ifdescr: true
|
empty_ifdescr: true
|
||||||
|
|||||||
@@ -1,24 +1,39 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use LibreNMS\Config;
|
||||||
|
use LibreNMS\OS;
|
||||||
|
|
||||||
$snmpdata = snmp_get_multi_oid($device, ['sysName.0', 'sysObjectID.0', 'sysDescr.0'], '-OUQn', 'SNMPv2-MIB');
|
$snmpdata = snmp_get_multi_oid($device, ['sysName.0', 'sysObjectID.0', 'sysDescr.0'], '-OUQn', 'SNMPv2-MIB');
|
||||||
|
|
||||||
$core_update = array(
|
$deviceModel = DeviceCache::getPrimary();
|
||||||
'sysObjectID' => $snmpdata['.1.3.6.1.2.1.1.2.0'],
|
$deviceModel->fill([
|
||||||
'sysName' => strtolower(trim($snmpdata['.1.3.6.1.2.1.1.5.0'])),
|
'sysObjectID' => $snmpdata['.1.3.6.1.2.1.1.2.0'] ?? null,
|
||||||
'sysDescr' => $snmpdata['.1.3.6.1.2.1.1.1.0'],
|
'sysName' => strtolower(trim($snmpdata['.1.3.6.1.2.1.1.5.0'] ?? '')),
|
||||||
);
|
'sysDescr' => isset($snmpdata['.1.3.6.1.2.1.1.1.0']) ? str_replace(chr(218), "\n", $snmpdata['.1.3.6.1.2.1.1.1.0']) : null,
|
||||||
|
]);
|
||||||
|
|
||||||
foreach ($core_update as $item => $value) {
|
foreach ($deviceModel->getDirty() as $attribute => $value) {
|
||||||
if ($device[$item] != $value) {
|
Log::event($value . ' -> ' . $deviceModel->$attribute, $deviceModel, 'system', 3);
|
||||||
$device[$item] = $value; // update the device array
|
$device[$attribute] = $value; // update device array
|
||||||
log_event("$item -> $value", $device, 'system', 3);
|
|
||||||
} else {
|
|
||||||
unset($core_update[$item]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($core_update)) {
|
// detect OS
|
||||||
dbUpdate($core_update, 'devices', 'device_id=?', array($device['device_id']));
|
$deviceModel->os = getHostOS($device, false);
|
||||||
|
|
||||||
|
if ($deviceModel->isDirty('os')) {
|
||||||
|
Log::event('Device OS changed: ' . $deviceModel->getOriginal('os') . ' -> ' . $deviceModel->os, $deviceModel, 'system', 3);
|
||||||
|
$device['os'] = $deviceModel->os;
|
||||||
|
|
||||||
|
echo "Changed ";
|
||||||
}
|
}
|
||||||
|
|
||||||
unset($core_update, $snmpdata);
|
$deviceModel->save();
|
||||||
|
load_os($device);
|
||||||
|
load_discovery($device);
|
||||||
|
$os = OS::make($device);
|
||||||
|
|
||||||
|
echo "OS: " . Config::getOsSetting($device['os'], 'text') . " ({$device['os']})\n\n";
|
||||||
|
|
||||||
|
register_mibs($device, Config::getOsSetting($device['os'], 'register_mibs', []), 'includes/discovery/os/' . $device['os'] . '.inc.php');
|
||||||
|
|
||||||
|
unset($snmpdata, $attribute, $value, $deviceModel);
|
||||||
|
|||||||
@@ -140,24 +140,6 @@ function discover_device(&$device, $force_module = false)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($device['os'] == 'generic') {
|
|
||||||
// verify if OS has changed from generic
|
|
||||||
$device['os'] = getHostOS($device);
|
|
||||||
|
|
||||||
if ($device['os'] != 'generic') {
|
|
||||||
echo "\nDevice os was updated to " . $device['os'] . '!';
|
|
||||||
dbUpdate(array('os' => $device['os']), 'devices', '`device_id` = ?', array($device['device_id']));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
load_os($device);
|
|
||||||
load_discovery($device);
|
|
||||||
register_mibs($device, Config::getOsSetting($device['os'], 'register_mibs', array()), 'includes/discovery/os/' . $device['os'] . '.inc.php');
|
|
||||||
|
|
||||||
$os = OS::make($device);
|
|
||||||
|
|
||||||
echo "\n";
|
|
||||||
|
|
||||||
$discovery_devices = Config::get('discovery_modules', array());
|
$discovery_devices = Config::get('discovery_modules', array());
|
||||||
$discovery_devices = array('core' => true) + $discovery_devices;
|
$discovery_devices = array('core' => true) + $discovery_devices;
|
||||||
|
|
||||||
|
|||||||
@@ -1,22 +1,3 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use LibreNMS\Config;
|
(new \LibreNMS\Modules\OS())->discover($os);
|
||||||
use LibreNMS\OS;
|
|
||||||
|
|
||||||
$os_name = getHostOS($device);
|
|
||||||
|
|
||||||
if ($os_name != $device['os']) {
|
|
||||||
log_event('Device OS changed ' . $device['os'] . " => $os_name", $device, 'system', 3);
|
|
||||||
$device['os'] = $os_name;
|
|
||||||
$sql = dbUpdate(array('os' => $os_name), 'devices', 'device_id=?', array($device['device_id']));
|
|
||||||
|
|
||||||
load_os($device);
|
|
||||||
load_discovery($device);
|
|
||||||
$os = OS::make($device);
|
|
||||||
|
|
||||||
echo "Changed ";
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "OS: " . Config::getOsSetting($os_name, 'text') . " ($os_name)\n";
|
|
||||||
|
|
||||||
update_device_logo($device);
|
|
||||||
|
|||||||
@@ -162,12 +162,16 @@ function logfile($string)
|
|||||||
* Detect the os of the given device.
|
* Detect the os of the given device.
|
||||||
*
|
*
|
||||||
* @param array $device device to check
|
* @param array $device device to check
|
||||||
|
* @param bool $fetch fetch sysDescr and sysObjectID fresh from the device
|
||||||
* @return string the name of the os
|
* @return string the name of the os
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
function getHostOS($device)
|
function getHostOS($device, $fetch = true)
|
||||||
{
|
{
|
||||||
$device['sysDescr'] = snmp_get($device, "SNMPv2-MIB::sysDescr.0", "-Ovq");
|
if ($fetch) {
|
||||||
$device['sysObjectID'] = snmp_get($device, "SNMPv2-MIB::sysObjectID.0", "-Ovqn");
|
$device['sysDescr'] = snmp_get($device, "SNMPv2-MIB::sysDescr.0", "-Ovq");
|
||||||
|
$device['sysObjectID'] = snmp_get($device, "SNMPv2-MIB::sysObjectID.0", "-Ovqn");
|
||||||
|
}
|
||||||
|
|
||||||
d_echo("| {$device['sysDescr']} | {$device['sysObjectID']} | \n");
|
d_echo("| {$device['sysDescr']} | {$device['sysObjectID']} | \n");
|
||||||
|
|
||||||
|
|||||||
@@ -16,14 +16,13 @@ use LibreNMS\Config;
|
|||||||
use LibreNMS\RRD\RrdDefinition;
|
use LibreNMS\RRD\RrdDefinition;
|
||||||
use LibreNMS\Util\Time;
|
use LibreNMS\Util\Time;
|
||||||
|
|
||||||
$snmpdata = snmp_get_multi_oid($device, ['sysUpTime.0', 'sysLocation.0', 'sysContact.0', 'sysName.0', 'sysObjectID.0', 'sysDescr.0'], '-OQnUt', 'SNMPv2-MIB');
|
$snmpdata = snmp_get_multi_oid($device, ['sysUpTime.0', 'sysContact.0', 'sysName.0', 'sysObjectID.0', 'sysDescr.0'], '-OQnUt', 'SNMPv2-MIB');
|
||||||
|
|
||||||
$poll_device['sysUptime'] = $snmpdata['.1.3.6.1.2.1.1.3.0'];
|
$poll_device['sysUptime'] = $snmpdata['.1.3.6.1.2.1.1.3.0'];
|
||||||
$poll_device['sysLocation'] = str_replace("\n", '', $snmpdata['.1.3.6.1.2.1.1.6.0']);
|
|
||||||
$poll_device['sysContact'] = str_replace("\n", '', $snmpdata['.1.3.6.1.2.1.1.4.0']);
|
$poll_device['sysContact'] = str_replace("\n", '', $snmpdata['.1.3.6.1.2.1.1.4.0']);
|
||||||
$poll_device['sysName'] = str_replace("\n", '', strtolower($snmpdata['.1.3.6.1.2.1.1.5.0']));
|
$poll_device['sysName'] = str_replace("\n", '', strtolower($snmpdata['.1.3.6.1.2.1.1.5.0']));
|
||||||
$poll_device['sysObjectID'] = $snmpdata['.1.3.6.1.2.1.1.2.0'];
|
$poll_device['sysObjectID'] = $snmpdata['.1.3.6.1.2.1.1.2.0'];
|
||||||
$poll_device['sysDescr'] = $snmpdata['.1.3.6.1.2.1.1.1.0'];
|
$poll_device['sysDescr'] = str_replace(chr(218), "\n", $snmpdata['.1.3.6.1.2.1.1.1.0']);
|
||||||
|
|
||||||
if (!empty($agent_data['uptime'])) {
|
if (!empty($agent_data['uptime'])) {
|
||||||
list($uptime) = explode(' ', $agent_data['uptime']);
|
list($uptime) = explode(' ', $agent_data['uptime']);
|
||||||
@@ -58,8 +57,6 @@ if ($uptime != 0 && Config::get("os.{$device['os']}.bad_uptime") !== true) {
|
|||||||
$device['uptime'] = $uptime;
|
$device['uptime'] = $uptime;
|
||||||
}//end if
|
}//end if
|
||||||
|
|
||||||
set_device_location($poll_device['sysLocation'], $device, $update_array);
|
|
||||||
|
|
||||||
$poll_device['sysContact'] = str_replace('"', '', $poll_device['sysContact']);
|
$poll_device['sysContact'] = str_replace('"', '', $poll_device['sysContact']);
|
||||||
|
|
||||||
if ($poll_device['sysContact'] == 'not set') {
|
if ($poll_device['sysContact'] == 'not set') {
|
||||||
|
|||||||
@@ -784,41 +784,3 @@ function data_flatten($array, $prefix = '', $joiner = '_')
|
|||||||
|
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $sysLocation location override (instead of sysLocation.0)
|
|
||||||
* @param &$device
|
|
||||||
* @param &$update_array
|
|
||||||
*/
|
|
||||||
function set_device_location($sysLocation, &$device, &$update_array)
|
|
||||||
{
|
|
||||||
$sysLocation = str_replace('"', '', $sysLocation);
|
|
||||||
|
|
||||||
// Rewrite sysLocation if there is a mapping array (database too?)
|
|
||||||
if (!empty($sysLocation) && (is_array(Config::get('location_map')) || is_array(Config::get('location_map_regex')) || is_array(Config::get('location_map_regex_sub')))) {
|
|
||||||
$sysLocation = rewrite_location($sysLocation);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($sysLocation == 'not set') {
|
|
||||||
$sysLocation = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($device['override_sysLocation'] == 0 && $sysLocation) {
|
|
||||||
/** @var Location $location */
|
|
||||||
$location = Location::firstOrCreate(['location' => $sysLocation]);
|
|
||||||
|
|
||||||
if ($device['location_id'] != $location->id) {
|
|
||||||
$device['location_id'] = $location->id;
|
|
||||||
$update_array['location_id'] = $location->id;
|
|
||||||
log_event('Location -> ' . $location->location, $device, 'system', 3);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// make sure the location has coordinates
|
|
||||||
if (Config::get('geoloc.latlng', true) && ($location || $location = Location::find($device['location_id']))) {
|
|
||||||
if (!$location->hasCoordinates()) {
|
|
||||||
$location->lookupCoordinates();
|
|
||||||
$location->save();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,42 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
if (is_file(\LibreNMS\Config::get('install_dir') . '/includes/polling/os/' . $device['os'] . '.inc.php')) {
|
use LibreNMS\OS;
|
||||||
// OS Specific
|
|
||||||
include \LibreNMS\Config::get('install_dir') . '/includes/polling/os/' . $device['os'] . '.inc.php';
|
|
||||||
} elseif ($device['os_group'] && is_file(\LibreNMS\Config::get('install_dir') . '/includes/polling/os/' . $device['os_group'] . '.inc.php')) {
|
|
||||||
// OS Group Specific
|
|
||||||
include \LibreNMS\Config::get('install_dir') . '/includes/polling/os/' . $device['os_group'] . '.inc.php';
|
|
||||||
} else {
|
|
||||||
echo "Generic :(\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($device['version'] != $version) {
|
if (!$os instanceof OS) {
|
||||||
$update_array['version'] = $version;
|
$os = OS::make($device);
|
||||||
log_event('OS Version -> ' . $version, $device, 'system', 3);
|
|
||||||
}
|
}
|
||||||
|
(new \LibreNMS\Modules\OS())->poll($os);
|
||||||
if ($features != $device['features']) {
|
|
||||||
$update_array['features'] = $features;
|
|
||||||
log_event('OS Features -> ' . $features, $device, 'system', 3);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($hardware != $device['hardware']) {
|
|
||||||
$update_array['hardware'] = $hardware;
|
|
||||||
log_event('Hardware -> ' . $hardware, $device, 'system', 3);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($serial != $device['serial']) {
|
|
||||||
$update_array['serial'] = $serial;
|
|
||||||
log_event('Serial -> ' . $serial, $device, 'system', 3);
|
|
||||||
}
|
|
||||||
|
|
||||||
update_device_logo($device);
|
|
||||||
if (!empty($location)) {
|
|
||||||
set_device_location($location, $device, $update_array);
|
|
||||||
}
|
|
||||||
|
|
||||||
echo 'Location: ' . $location . PHP_EOL;
|
|
||||||
echo 'Hardware: ' . $hardware . PHP_EOL;
|
|
||||||
echo 'Version: ' . $version . PHP_EOL;
|
|
||||||
echo 'Features: ' . $features . PHP_EOL;
|
|
||||||
echo 'Serial: ' . $serial . PHP_EOL;
|
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
// Device might not have a card 1 (or even card2 if it is an E7-20)
|
|
||||||
$version = strtok(snmp_walk($device, "e7CardSoftwareVersion.1", "-OQv", "E7-Calix-MIB"), PHP_EOL);
|
|
||||||
$hardware = "Calix " . $device['sysDescr'];
|
|
||||||
$features = str_replace(PHP_EOL, ', ', snmp_walk($device, "e7CardProvType", "-OQv", "E7-Calix-MIB"));
|
|
||||||
$serial = str_replace(PHP_EOL, ', ', snmp_walk($device, "e7CardSerialNumber", "-OQv", "E7-Calix-MIB"));
|
|
||||||
@@ -5,29 +5,7 @@ use LibreNMS\Util\Rewrite;
|
|||||||
|
|
||||||
function rewrite_location($location)
|
function rewrite_location($location)
|
||||||
{
|
{
|
||||||
if (is_array(Config::get('location_map_regex'))) {
|
return \LibreNMS\Util\Rewrite::location($location);
|
||||||
foreach (Config::get('location_map_regex') as $reg => $val) {
|
|
||||||
if (preg_match($reg, $location)) {
|
|
||||||
$location = $val;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_array(Config::get('location_map_regex_sub'))) {
|
|
||||||
foreach (Config::get('location_map_regex_sub') as $reg => $val) {
|
|
||||||
if (preg_match($reg, $location)) {
|
|
||||||
$location = preg_replace($reg, $val, $location);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Config::has("location_map.$location")) {
|
|
||||||
$location = Config::get("location_map.$location");
|
|
||||||
}
|
|
||||||
|
|
||||||
return $location;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -106,6 +106,24 @@ CALIX-PRODUCT-MIB DEFINITIONS ::= BEGIN
|
|||||||
"The E7-20 product."
|
"The E7-20 product."
|
||||||
::= { e7Devices 4 }
|
::= { e7Devices 4 }
|
||||||
|
|
||||||
|
e3x48 OBJECT-IDENTITY
|
||||||
|
STATUS current
|
||||||
|
DESCRIPTION
|
||||||
|
"The E3-48 product."
|
||||||
|
::= { e7Devices 5 }
|
||||||
|
|
||||||
|
e5x48 OBJECT-IDENTITY
|
||||||
|
STATUS current
|
||||||
|
DESCRIPTION
|
||||||
|
"The E5-48 product."
|
||||||
|
::= { e7Devices 6 }
|
||||||
|
|
||||||
|
e3x8g OBJECT-IDENTITY
|
||||||
|
STATUS current
|
||||||
|
DESCRIPTION
|
||||||
|
"The E3-8g product."
|
||||||
|
::= { e7Devices 7 }
|
||||||
|
|
||||||
e5x100 OBJECT-IDENTITY
|
e5x100 OBJECT-IDENTITY
|
||||||
STATUS current
|
STATUS current
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
|
|||||||
@@ -6,25 +6,28 @@ E7-Calix-MIB DEFINITIONS ::= BEGIN
|
|||||||
|
|
||||||
IMPORTS
|
IMPORTS
|
||||||
Integer32,
|
Integer32,
|
||||||
-- not used yet
|
|
||||||
Counter64,
|
Counter64,
|
||||||
IpAddress,
|
IpAddress,
|
||||||
mib-2
|
mib-2
|
||||||
FROM SNMPv2-SMI
|
FROM SNMPv2-SMI
|
||||||
RowStatus,
|
RowStatus,
|
||||||
-- not used yet
|
|
||||||
DisplayString,
|
DisplayString,
|
||||||
-- not used yet
|
|
||||||
MacAddress
|
MacAddress
|
||||||
FROM SNMPv2-TC
|
FROM SNMPv2-TC
|
||||||
|
InterfaceIndex,
|
||||||
ifIndex FROM IF-MIB
|
ifIndex FROM IF-MIB
|
||||||
e7, e7Modules
|
e7, e7Modules
|
||||||
FROM CALIX-PRODUCT-MIB
|
FROM CALIX-PRODUCT-MIB
|
||||||
E7AdminStatus,
|
E7AdminStatus,
|
||||||
E7CardType,
|
E7CardType,
|
||||||
E7PowerLevel,
|
E7PowerLevel,
|
||||||
E7SnmpVers
|
E7SnmpVers,
|
||||||
FROM E7-TC;
|
E7EtherType,
|
||||||
|
E7Pbit,
|
||||||
|
E7BondedInterfaceIndex
|
||||||
|
E7OperStatus
|
||||||
|
E7XdslGrpOperStatus
|
||||||
|
FROM E7-TC;
|
||||||
|
|
||||||
e7ResourceModule MODULE-IDENTITY
|
e7ResourceModule MODULE-IDENTITY
|
||||||
LAST-UPDATED "201304030000Z"
|
LAST-UPDATED "201304030000Z"
|
||||||
@@ -47,11 +50,15 @@ IMPORTS
|
|||||||
|
|
||||||
-- really old regions (E5-8 era) can be reused
|
-- really old regions (E5-8 era) can be reused
|
||||||
e7Resource OBJECT IDENTIFIER ::= { e7 2 }
|
e7Resource OBJECT IDENTIFIER ::= { e7 2 }
|
||||||
e7NodeResource OBJECT IDENTIFIER ::= { e7Resource 1 }
|
e7NodeResource OBJECT IDENTIFIER ::= { e7Resource 1 }
|
||||||
e7CardGroup OBJECT IDENTIFIER ::= { e7NodeResource 6 }
|
e7CraftGroup OBJECT IDENTIFIER ::= { e7NodeResource 4 }
|
||||||
e7SystemGroup OBJECT IDENTIFIER ::= { e7NodeResource 7 }
|
e7CraftUserGroup OBJECT IDENTIFIER ::= { e7NodeResource 5 }
|
||||||
e7TrapDestGroup OBJECT IDENTIFIER ::= { e7NodeResource 8 }
|
e7CardGroup OBJECT IDENTIFIER ::= { e7NodeResource 6 }
|
||||||
|
e7SystemGroup OBJECT IDENTIFIER ::= { e7NodeResource 7 }
|
||||||
e7PortGroup OBJECT IDENTIFIER ::= { e7NodeResource 9 }
|
e7PortGroup OBJECT IDENTIFIER ::= { e7NodeResource 9 }
|
||||||
|
e7OntGroup OBJECT IDENTIFIER ::= { e7NodeResource 10 }
|
||||||
|
e7LaserGroup OBJECT IDENTIFIER ::= { e7NodeResource 14 }
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Calix enterprise-specific management objects
|
-- Calix enterprise-specific management objects
|
||||||
@@ -61,8 +68,6 @@ IMPORTS
|
|||||||
-- Card data
|
-- Card data
|
||||||
--
|
--
|
||||||
|
|
||||||
-- ZZZ note that only line cards are being implemented for now, as
|
|
||||||
-- ZZZ E5-2 mods has no SCs
|
|
||||||
e7CardTable OBJECT-TYPE
|
e7CardTable OBJECT-TYPE
|
||||||
SYNTAX SEQUENCE OF E7CardEntry
|
SYNTAX SEQUENCE OF E7CardEntry
|
||||||
MAX-ACCESS not-accessible
|
MAX-ACCESS not-accessible
|
||||||
@@ -92,7 +97,6 @@ E7CardEntry ::= SEQUENCE {
|
|||||||
e7CardPartNumber OCTET STRING,
|
e7CardPartNumber OCTET STRING,
|
||||||
e7CardStartMacRange OCTET STRING,
|
e7CardStartMacRange OCTET STRING,
|
||||||
e7CardEndMacRange OCTET STRING,
|
e7CardEndMacRange OCTET STRING,
|
||||||
e7CardHardwareRevision OCTET STRING
|
|
||||||
}
|
}
|
||||||
|
|
||||||
e7CardBank OBJECT-TYPE
|
e7CardBank OBJECT-TYPE
|
||||||
@@ -188,19 +192,219 @@ e7CardEndMacRange OBJECT-TYPE
|
|||||||
DESCRIPTION "End of MAC range (ascii)"
|
DESCRIPTION "End of MAC range (ascii)"
|
||||||
::= { e7CardEntry 13 }
|
::= { e7CardEntry 13 }
|
||||||
|
|
||||||
e7CardHardwareRevision OBJECT-TYPE
|
--
|
||||||
SYNTAX OCTET STRING
|
-- Card ODN status
|
||||||
|
--
|
||||||
|
|
||||||
|
e7OltPonPortTable OBJECT-TYPE
|
||||||
|
SYNTAX SEQUENCE OF E7OltPonPortEntry
|
||||||
|
MAX-ACCESS not-accessible
|
||||||
|
STATUS current
|
||||||
|
DESCRIPTION "Contains OLT ODN port entries"
|
||||||
|
::= { e7CardGroup 2 }
|
||||||
|
|
||||||
|
e7OltPonPortEntry OBJECT-TYPE
|
||||||
|
SYNTAX E7OltPonPortEntry
|
||||||
|
MAX-ACCESS not-accessible
|
||||||
|
STATUS current
|
||||||
|
DESCRIPTION "List of attributes related to OLT ODN port"
|
||||||
|
INDEX { e7OltPonPortShelf, e7OltPonPortSlot, e7OltPonPortId }
|
||||||
|
::= { e7OltPonPortTable 1 }
|
||||||
|
|
||||||
|
E7OltPonPortEntry ::= SEQUENCE {
|
||||||
|
e7OltPonPortShelf Integer32,
|
||||||
|
e7OltPonPortSlot Integer32,
|
||||||
|
e7OltPonPortId Integer32,
|
||||||
|
e7OltPonPortStatus INTEGER,
|
||||||
|
e7OltPonPortTemperature Integer32,
|
||||||
|
e7OltPonPortTxBias Integer32,
|
||||||
|
e7OltPonPortTxPower Integer32,
|
||||||
|
e7OltPonPortRxPower Integer32,
|
||||||
|
e7OltPonPortVoltage Integer32
|
||||||
|
}
|
||||||
|
e7OltPonPortShelf OBJECT-TYPE
|
||||||
|
SYNTAX Integer32
|
||||||
|
MAX-ACCESS not-accessible
|
||||||
|
STATUS current
|
||||||
|
DESCRIPTION "Shelf number"
|
||||||
|
::= { e7OltPonPortEntry 1 }
|
||||||
|
|
||||||
|
e7OltPonPortSlot OBJECT-TYPE
|
||||||
|
SYNTAX Integer32
|
||||||
|
MAX-ACCESS not-accessible
|
||||||
|
STATUS current
|
||||||
|
DESCRIPTION "Slot number"
|
||||||
|
::= { e7OltPonPortEntry 2 }
|
||||||
|
|
||||||
|
e7OltPonPortId OBJECT-TYPE
|
||||||
|
SYNTAX Integer32
|
||||||
|
MAX-ACCESS not-accessible
|
||||||
|
STATUS current
|
||||||
|
DESCRIPTION "Port number"
|
||||||
|
::= { e7OltPonPortEntry 3 }
|
||||||
|
|
||||||
|
e7OltPonPortStatus OBJECT-TYPE
|
||||||
|
SYNTAX INTEGER {
|
||||||
|
invalid(0),
|
||||||
|
linkUp(1),
|
||||||
|
linkDown(2)
|
||||||
|
}
|
||||||
MAX-ACCESS read-only
|
MAX-ACCESS read-only
|
||||||
STATUS current
|
STATUS current
|
||||||
DESCRIPTION "Hardware revision, dotted string notation"
|
DESCRIPTION "ODN-I operational status"
|
||||||
::= { e7CardEntry 14 }
|
::= { e7OltPonPortEntry 4 }
|
||||||
|
|
||||||
e7CardTableEnd OBJECT-TYPE
|
e7OltPonPortTemperature OBJECT-TYPE
|
||||||
SYNTAX Integer32
|
SYNTAX Integer32
|
||||||
MAX-ACCESS read-only
|
MAX-ACCESS read-only
|
||||||
STATUS current
|
STATUS current
|
||||||
DESCRIPTION "denotes the end of the e7CardTable (for getnext)"
|
DESCRIPTION "ODN-I laser temperature (degrees Celsius) "
|
||||||
::= { e7CardGroup 2 }
|
::= { e7OltPonPortEntry 5 }
|
||||||
|
|
||||||
|
e7OltPonPortTxBias OBJECT-TYPE
|
||||||
|
SYNTAX Integer32
|
||||||
|
MAX-ACCESS read-only
|
||||||
|
STATUS current
|
||||||
|
DESCRIPTION "ODN-I laser bias current (muA) "
|
||||||
|
::= { e7OltPonPortEntry 6 }
|
||||||
|
|
||||||
|
e7OltPonPortTxPower OBJECT-TYPE
|
||||||
|
SYNTAX Integer32
|
||||||
|
MAX-ACCESS read-only
|
||||||
|
STATUS current
|
||||||
|
DESCRIPTION "ODN-I Tx signal level ((value / 10000) = mW) "
|
||||||
|
::= { e7OltPonPortEntry 7 }
|
||||||
|
|
||||||
|
e7OltPonPortRxPower OBJECT-TYPE
|
||||||
|
SYNTAX Integer32
|
||||||
|
MAX-ACCESS read-only
|
||||||
|
STATUS current
|
||||||
|
DESCRIPTION "ODN-I Rx signal level ((value / 10000) = mW) "
|
||||||
|
::= { e7OltPonPortEntry 8 }
|
||||||
|
|
||||||
|
e7OltPonPortVoltage OBJECT-TYPE
|
||||||
|
SYNTAX Integer32
|
||||||
|
MAX-ACCESS read-only
|
||||||
|
STATUS current
|
||||||
|
DESCRIPTION "ODN-I voltage in mV "
|
||||||
|
::= { e7OltPonPortEntry 9 }
|
||||||
|
|
||||||
|
--
|
||||||
|
-- ONT data
|
||||||
|
--
|
||||||
|
|
||||||
|
e7OntTable OBJECT-TYPE
|
||||||
|
SYNTAX SEQUENCE OF E7OntEntry
|
||||||
|
MAX-ACCESS not-accessible
|
||||||
|
STATUS current
|
||||||
|
DESCRIPTION "Contains ONT entries"
|
||||||
|
::= { e7OntGroup 1 }
|
||||||
|
|
||||||
|
e7OntEntry OBJECT-TYPE
|
||||||
|
SYNTAX E7OntEntry
|
||||||
|
MAX-ACCESS not-accessible
|
||||||
|
STATUS current
|
||||||
|
DESCRIPTION "List of attributes related to ONT"
|
||||||
|
INDEX { e7OntUnitId }
|
||||||
|
::= { e7OntTable 1 }
|
||||||
|
|
||||||
|
E7OntEntry ::= SEQUENCE {
|
||||||
|
e7OntUnitId Integer32,
|
||||||
|
e7OntRowStatus RowStatus,
|
||||||
|
e7OntAdminStatus E7AdminStatus,
|
||||||
|
e7OntOperStatus INTEGER,
|
||||||
|
e7OntDyingGasp INTEGER,
|
||||||
|
e7OntRxOpticalLevel Integer32,
|
||||||
|
e7OntTxOpticalLevel Integer32,
|
||||||
|
e7OntFarEndRxOpticalLevel Integer32,
|
||||||
|
e7OntSoftwareVersion OCTET STRING,
|
||||||
|
e7OntCleiCode OCTET STRING
|
||||||
|
}
|
||||||
|
|
||||||
|
e7OntUnitId OBJECT-TYPE
|
||||||
|
SYNTAX Integer32
|
||||||
|
MAX-ACCESS not-accessible
|
||||||
|
STATUS current
|
||||||
|
DESCRIPTION "Unit identifier "
|
||||||
|
::= { e7OntEntry 1 }
|
||||||
|
|
||||||
|
e7OntRowStatus OBJECT-TYPE
|
||||||
|
SYNTAX RowStatus
|
||||||
|
MAX-ACCESS read-create
|
||||||
|
STATUS current
|
||||||
|
DESCRIPTION "Controls creation & deletion of table entries. Only
|
||||||
|
active(get), createAndGo(set), and destroy(set) are
|
||||||
|
supported."
|
||||||
|
::= { e7OntEntry 2 }
|
||||||
|
|
||||||
|
e7OntAdminStatus OBJECT-TYPE
|
||||||
|
SYNTAX E7AdminStatus
|
||||||
|
MAX-ACCESS read-create
|
||||||
|
STATUS current
|
||||||
|
DESCRIPTION "Administrative status"
|
||||||
|
::= { e7OntEntry 3 }
|
||||||
|
|
||||||
|
e7OntOperStatus OBJECT-TYPE
|
||||||
|
SYNTAX INTEGER {
|
||||||
|
invalid(0),
|
||||||
|
enabled(1),
|
||||||
|
degraded(2),
|
||||||
|
systemDisabled(3),
|
||||||
|
userDisabled(4),
|
||||||
|
waitRegistration(5)
|
||||||
|
}
|
||||||
|
MAX-ACCESS read-only
|
||||||
|
STATUS current
|
||||||
|
DESCRIPTION "Operational status"
|
||||||
|
::= { e7OntEntry 4 }
|
||||||
|
|
||||||
|
e7OntDyingGasp OBJECT-TYPE
|
||||||
|
SYNTAX INTEGER {
|
||||||
|
no(0),
|
||||||
|
yes(1)
|
||||||
|
}
|
||||||
|
MAX-ACCESS read-only
|
||||||
|
STATUS current
|
||||||
|
DESCRIPTION "Ont dying gasp status "
|
||||||
|
::= { e7OntEntry 5 }
|
||||||
|
|
||||||
|
e7OntRxOpticalLevel OBJECT-TYPE
|
||||||
|
SYNTAX Integer32
|
||||||
|
UNITS "0.002 dBm"
|
||||||
|
MAX-ACCESS read-only
|
||||||
|
STATUS current
|
||||||
|
DESCRIPTION "ONT Rx signal level (mW) "
|
||||||
|
::= { e7OntEntry 6 }
|
||||||
|
|
||||||
|
e7OntTxOpticalLevel OBJECT-TYPE
|
||||||
|
SYNTAX Integer32
|
||||||
|
UNITS "0.002 dBm"
|
||||||
|
MAX-ACCESS read-only
|
||||||
|
STATUS current
|
||||||
|
DESCRIPTION "ONT Tx signal level (mW) "
|
||||||
|
::= { e7OntEntry 7 }
|
||||||
|
|
||||||
|
e7OntFarEndRxOpticalLevel OBJECT-TYPE
|
||||||
|
SYNTAX Integer32
|
||||||
|
UNITS "0.002 dBm"
|
||||||
|
MAX-ACCESS read-only
|
||||||
|
STATUS current
|
||||||
|
DESCRIPTION "OLT Rx signal level (mW) "
|
||||||
|
::= { e7OntEntry 8 }
|
||||||
|
|
||||||
|
e7OntSoftwareVersion OBJECT-TYPE
|
||||||
|
SYNTAX OCTET STRING
|
||||||
|
MAX-ACCESS read-only
|
||||||
|
STATUS current
|
||||||
|
DESCRIPTION "Running software version, dotted string notation"
|
||||||
|
::= { e7OntEntry 9 }
|
||||||
|
|
||||||
|
e7OntCleiCode OBJECT-TYPE
|
||||||
|
SYNTAX OCTET STRING
|
||||||
|
MAX-ACCESS read-only
|
||||||
|
STATUS current
|
||||||
|
DESCRIPTION "Hardware CLEI code "
|
||||||
|
::= { e7OntEntry 10 }
|
||||||
|
|
||||||
--
|
--
|
||||||
--system
|
--system
|
||||||
@@ -279,7 +483,7 @@ e7SystemTimezone OBJECT-TYPE
|
|||||||
::= {e7SystemGroup 9}
|
::= {e7SystemGroup 9}
|
||||||
|
|
||||||
e7SystemChassisSerialNumber OBJECT-TYPE
|
e7SystemChassisSerialNumber OBJECT-TYPE
|
||||||
SYNTAX DisplayString
|
SYNTAX OCTET STRING
|
||||||
MAX-ACCESS read-create
|
MAX-ACCESS read-create
|
||||||
STATUS current
|
STATUS current
|
||||||
DESCRIPTION "Chassis serial number"
|
DESCRIPTION "Chassis serial number"
|
||||||
@@ -306,97 +510,6 @@ e7SystemDate OBJECT-TYPE
|
|||||||
DESCRIPTION "system date"
|
DESCRIPTION "system date"
|
||||||
::= {e7SystemGroup 13}
|
::= {e7SystemGroup 13}
|
||||||
|
|
||||||
-- ZZZ leaving chassis for different object class, as there may be several
|
|
||||||
-- ZZZ instances in the future
|
|
||||||
|
|
||||||
--
|
|
||||||
--e7TrapDestGroup
|
|
||||||
--
|
|
||||||
|
|
||||||
e7TrapDestTable OBJECT-TYPE
|
|
||||||
SYNTAX SEQUENCE OF E7TrapDestEntry
|
|
||||||
MAX-ACCESS not-accessible
|
|
||||||
STATUS current
|
|
||||||
DESCRIPTION "Contains SNMP Trap Dest entries"
|
|
||||||
::= { e7TrapDestGroup 1 }
|
|
||||||
|
|
||||||
e7TrapDestEntry OBJECT-TYPE
|
|
||||||
SYNTAX E7TrapDestEntry
|
|
||||||
MAX-ACCESS not-accessible
|
|
||||||
STATUS current
|
|
||||||
DESCRIPTION "List of attributes related to SNMP Trap Dest"
|
|
||||||
INDEX { e7TrapDestIndex }
|
|
||||||
::= { e7TrapDestTable 1 }
|
|
||||||
|
|
||||||
E7TrapDestEntry ::= SEQUENCE {
|
|
||||||
e7TrapDestIndex Integer32,
|
|
||||||
e7TrapDestRowStatus RowStatus,
|
|
||||||
e7TrapDestAdminStatus E7AdminStatus,
|
|
||||||
e7TrapDestIpAddress IpAddress,
|
|
||||||
e7TrapDestPortNumber Integer32,
|
|
||||||
e7TrapDestSnmpVers E7SnmpVers,
|
|
||||||
e7TrapDestV3User OCTET STRING,
|
|
||||||
e7TrapDestCommunity OCTET STRING
|
|
||||||
}
|
|
||||||
|
|
||||||
e7TrapDestIndex OBJECT-TYPE
|
|
||||||
SYNTAX Integer32
|
|
||||||
MAX-ACCESS not-accessible
|
|
||||||
STATUS current
|
|
||||||
DESCRIPTION "trap index"
|
|
||||||
::= { e7TrapDestEntry 1 }
|
|
||||||
|
|
||||||
e7TrapDestRowStatus OBJECT-TYPE
|
|
||||||
SYNTAX RowStatus
|
|
||||||
MAX-ACCESS read-create
|
|
||||||
STATUS current
|
|
||||||
DESCRIPTION "Controls creation & deletion of table entries. Only
|
|
||||||
active(get), createAndGo(set), and destroy(set) are
|
|
||||||
supported."
|
|
||||||
::= { e7TrapDestEntry 2 }
|
|
||||||
|
|
||||||
e7TrapDestAdminStatus OBJECT-TYPE
|
|
||||||
SYNTAX E7AdminStatus
|
|
||||||
MAX-ACCESS read-create
|
|
||||||
STATUS current
|
|
||||||
DESCRIPTION "Administrative status"
|
|
||||||
::= { e7TrapDestEntry 3 }
|
|
||||||
|
|
||||||
e7TrapDestIpAddress OBJECT-TYPE
|
|
||||||
SYNTAX IpAddress
|
|
||||||
MAX-ACCESS read-create
|
|
||||||
STATUS current
|
|
||||||
DESCRIPTION "destination IP address"
|
|
||||||
::= { e7TrapDestEntry 4 }
|
|
||||||
|
|
||||||
e7TrapDestPortNumber OBJECT-TYPE
|
|
||||||
SYNTAX Integer32
|
|
||||||
MAX-ACCESS read-create
|
|
||||||
STATUS current
|
|
||||||
DESCRIPTION "destination UDP port number"
|
|
||||||
::= { e7TrapDestEntry 5 }
|
|
||||||
|
|
||||||
e7TrapDestSnmpVers OBJECT-TYPE
|
|
||||||
SYNTAX E7SnmpVers
|
|
||||||
MAX-ACCESS read-create
|
|
||||||
STATUS current
|
|
||||||
DESCRIPTION "v2c or v3 trap type"
|
|
||||||
::= { e7TrapDestEntry 6 }
|
|
||||||
|
|
||||||
e7TrapDestV3User OBJECT-TYPE
|
|
||||||
SYNTAX OCTET STRING
|
|
||||||
MAX-ACCESS read-create
|
|
||||||
STATUS current
|
|
||||||
DESCRIPTION "user used in v3 traps"
|
|
||||||
::= { e7TrapDestEntry 7 }
|
|
||||||
|
|
||||||
e7TrapDestCommunity OBJECT-TYPE
|
|
||||||
SYNTAX OCTET STRING
|
|
||||||
MAX-ACCESS read-create
|
|
||||||
STATUS current
|
|
||||||
DESCRIPTION "community string used in v2c traps"
|
|
||||||
::= { e7TrapDestEntry 8 }
|
|
||||||
|
|
||||||
--
|
--
|
||||||
--e7PortGroup
|
--e7PortGroup
|
||||||
--
|
--
|
||||||
@@ -690,7 +803,8 @@ E7VdslPortCfgEntry ::= SEQUENCE {
|
|||||||
e7VdslPortCfgUsMaxSnr Integer32,
|
e7VdslPortCfgUsMaxSnr Integer32,
|
||||||
e7VdslPortCfgUsTargetSnr Integer32,
|
e7VdslPortCfgUsTargetSnr Integer32,
|
||||||
e7VdslPortCfgPsdMask INTEGER,
|
e7VdslPortCfgPsdMask INTEGER,
|
||||||
e7VdslPortCfgLastTemplate DisplayString
|
e7VdslPortCfgLastTemplate DisplayString,
|
||||||
|
e7VdslPortCfgBondedInterface E7BondedInterfaceIndex
|
||||||
}
|
}
|
||||||
|
|
||||||
e7VdslPortCfgServiceType OBJECT-TYPE
|
e7VdslPortCfgServiceType OBJECT-TYPE
|
||||||
@@ -719,7 +833,7 @@ e7VdslPortCfgPathLatency OBJECT-TYPE
|
|||||||
SYNTAX INTEGER {
|
SYNTAX INTEGER {
|
||||||
none(0),
|
none(0),
|
||||||
fast(1),
|
fast(1),
|
||||||
interleaved(2),
|
interleaved(2)
|
||||||
}
|
}
|
||||||
MAX-ACCESS read-write
|
MAX-ACCESS read-write
|
||||||
STATUS current
|
STATUS current
|
||||||
@@ -975,6 +1089,15 @@ e7VdslPortCfgLastTemplate OBJECT-TYPE
|
|||||||
"VDSL port configured last template name. "
|
"VDSL port configured last template name. "
|
||||||
::= { e7VdslPortCfgEntry 19 }
|
::= { e7VdslPortCfgEntry 19 }
|
||||||
|
|
||||||
|
e7VdslPortCfgBondedInterface OBJECT-TYPE
|
||||||
|
SYNTAX E7BondedInterfaceIndex
|
||||||
|
MAX-ACCESS read-create
|
||||||
|
STATUS current
|
||||||
|
DESCRIPTION
|
||||||
|
"VDSL port configured as a member of a DSL bonded interface.
|
||||||
|
If the DSL bonded interface attribute is not set, value reported will be 0."
|
||||||
|
::= { e7VdslPortCfgEntry 20 }
|
||||||
|
|
||||||
e7VdslPortCfgTemplateTable OBJECT-TYPE
|
e7VdslPortCfgTemplateTable OBJECT-TYPE
|
||||||
SYNTAX SEQUENCE OF E7VdslPortCfgTemplateEntry
|
SYNTAX SEQUENCE OF E7VdslPortCfgTemplateEntry
|
||||||
MAX-ACCESS not-accessible
|
MAX-ACCESS not-accessible
|
||||||
@@ -1056,7 +1179,7 @@ e7VdslPortCfgTemplatePathLatency OBJECT-TYPE
|
|||||||
SYNTAX INTEGER {
|
SYNTAX INTEGER {
|
||||||
none(0),
|
none(0),
|
||||||
fast(1),
|
fast(1),
|
||||||
interleaved(2),
|
interleaved(2)
|
||||||
}
|
}
|
||||||
MAX-ACCESS read-write
|
MAX-ACCESS read-write
|
||||||
STATUS current
|
STATUS current
|
||||||
@@ -1358,4 +1481,139 @@ e7VdslPortPerfIntervalUAS OBJECT-TYPE
|
|||||||
"VDSL port performance interval unavailable seconds. "
|
"VDSL port performance interval unavailable seconds. "
|
||||||
::= { e7VdslPortPerfIntervalEntry 3 }
|
::= { e7VdslPortPerfIntervalEntry 3 }
|
||||||
|
|
||||||
|
e7VdslBondedInterfaceTable OBJECT-TYPE
|
||||||
|
SYNTAX SEQUENCE OF E7VdslBondedInterfaceEntry
|
||||||
|
MAX-ACCESS not-accessible
|
||||||
|
STATUS current
|
||||||
|
DESCRIPTION "Contains DSL bonded interface entries"
|
||||||
|
::= { e7VdslPortGroup 7 }
|
||||||
|
|
||||||
|
e7VdslBondedInterfaceEntry OBJECT-TYPE
|
||||||
|
SYNTAX E7VdslBondedInterfaceEntry
|
||||||
|
MAX-ACCESS not-accessible
|
||||||
|
STATUS current
|
||||||
|
DESCRIPTION "List of attributes related to DSL bonded interface entries"
|
||||||
|
INDEX { e7VdslBondedInterfaceIndex }
|
||||||
|
::= { e7VdslBondedInterfaceTable 1 }
|
||||||
|
|
||||||
|
E7VdslBondedInterfaceEntry ::= SEQUENCE {
|
||||||
|
e7VdslBondedInterfaceIndex E7BondedInterfaceIndex,
|
||||||
|
e7VdslBondedInterfaceName DisplayString
|
||||||
|
e7VdslBondedInterfaceAdminStatus E7AdminStatus
|
||||||
|
e7VdslBondedInterfaceOperStatus E7OperStatus
|
||||||
|
e7VdslBondedInterfaceBondState E7XdslGrpOperStatus
|
||||||
|
e7VdslBondedInterfaceDSRate Integer32
|
||||||
|
e7VdslBondedInterfaceUSRate Integer32
|
||||||
|
e7VdslBondedInterfaceActPorts DisplayString
|
||||||
|
e7VdslBondedInterfaceInActPorts DisplayString
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
e7VdslBondedInterfaceIndex OBJECT-TYPE
|
||||||
|
SYNTAX E7BondedInterfaceIndex
|
||||||
|
MAX-ACCESS not-accessible
|
||||||
|
STATUS current
|
||||||
|
DESCRIPTION "DSL bonded interface index."
|
||||||
|
::= { e7VdslBondedInterfaceEntry 1 }
|
||||||
|
|
||||||
|
e7VdslBondedInterfaceName OBJECT-TYPE
|
||||||
|
SYNTAX DisplayString
|
||||||
|
MAX-ACCESS read-only
|
||||||
|
STATUS current
|
||||||
|
DESCRIPTION "The textual name of the DSL bonded interface."
|
||||||
|
::= { e7VdslBondedInterfaceEntry 2 }
|
||||||
|
|
||||||
|
e7VdslBondedInterfaceAdminStatus OBJECT-TYPE
|
||||||
|
SYNTAX E7AdminStatus
|
||||||
|
MAX-ACCESS read-only
|
||||||
|
STATUS current
|
||||||
|
DESCRIPTION "The admin status of the DSL bonded interface."
|
||||||
|
::= { e7VdslBondedInterfaceEntry 3 }
|
||||||
|
|
||||||
|
e7VdslBondedInterfaceOperStatus OBJECT-TYPE
|
||||||
|
SYNTAX E7OperStatus
|
||||||
|
MAX-ACCESS read-only
|
||||||
|
STATUS current
|
||||||
|
DESCRIPTION "The operator status of the DSL bonded interface."
|
||||||
|
::= { e7VdslBondedInterfaceEntry 4 }
|
||||||
|
|
||||||
|
e7VdslBondedInterfaceBondState OBJECT-TYPE
|
||||||
|
SYNTAX E7XdslGrpOperStatus
|
||||||
|
MAX-ACCESS read-only
|
||||||
|
STATUS current
|
||||||
|
DESCRIPTION "The bonding status of the DSL bonded interface."
|
||||||
|
::= { e7VdslBondedInterfaceEntry 5 }
|
||||||
|
|
||||||
|
e7VdslBondedInterfaceDSRate OBJECT-TYPE
|
||||||
|
SYNTAX Integer32
|
||||||
|
MAX-ACCESS read-only
|
||||||
|
STATUS current
|
||||||
|
DESCRIPTION "The Downstream rate of the DSL bonded interface."
|
||||||
|
::= { e7VdslBondedInterfaceEntry 6 }
|
||||||
|
|
||||||
|
e7VdslBondedInterfaceUSRate OBJECT-TYPE
|
||||||
|
SYNTAX Integer32
|
||||||
|
MAX-ACCESS read-only
|
||||||
|
STATUS current
|
||||||
|
DESCRIPTION "The Upstream rate of the DSL bonded interface."
|
||||||
|
::= { e7VdslBondedInterfaceEntry 7 }
|
||||||
|
|
||||||
|
e7VdslBondedInterfaceActPorts OBJECT-TYPE
|
||||||
|
SYNTAX DisplayString
|
||||||
|
MAX-ACCESS read-only
|
||||||
|
STATUS current
|
||||||
|
DESCRIPTION "The active ports of the DSL bonded interface."
|
||||||
|
::= { e7VdslBondedInterfaceEntry 8 }
|
||||||
|
|
||||||
|
e7VdslBondedInterfaceInActPorts OBJECT-TYPE
|
||||||
|
SYNTAX DisplayString
|
||||||
|
MAX-ACCESS read-only
|
||||||
|
STATUS current
|
||||||
|
DESCRIPTION "The inactive ports of the DSL bonded interface."
|
||||||
|
::= { e7VdslBondedInterfaceEntry 9 }
|
||||||
|
|
||||||
|
e7VdslStackTable OBJECT-TYPE
|
||||||
|
SYNTAX SEQUENCE OF E7VdslStackEntry
|
||||||
|
MAX-ACCESS not-accessible
|
||||||
|
STATUS current
|
||||||
|
DESCRIPTION "Contains DSL bonded interface member entries"
|
||||||
|
::= { e7VdslPortGroup 8 }
|
||||||
|
|
||||||
|
e7VdslStackEntry OBJECT-TYPE
|
||||||
|
SYNTAX E7VdslStackEntry
|
||||||
|
MAX-ACCESS not-accessible
|
||||||
|
STATUS current
|
||||||
|
DESCRIPTION "List of attributes related to DSL bonded interface member entries"
|
||||||
|
INDEX { e7VdslStackBondedInterfaceIndex, e7VdslStackVdslPort }
|
||||||
|
::= { e7VdslStackTable 1 }
|
||||||
|
|
||||||
|
E7VdslStackEntry ::= SEQUENCE {
|
||||||
|
e7VdslStackBondedInterfaceIndex E7BondedInterfaceIndex,
|
||||||
|
e7VdslStackVdslPort InterfaceIndex,
|
||||||
|
e7VdslStackStatus RowStatus
|
||||||
|
}
|
||||||
|
|
||||||
|
e7VdslStackBondedInterfaceIndex OBJECT-TYPE
|
||||||
|
SYNTAX E7BondedInterfaceIndex
|
||||||
|
MAX-ACCESS not-accessible
|
||||||
|
STATUS current
|
||||||
|
DESCRIPTION "DSL bonded interface index."
|
||||||
|
::= { e7VdslStackEntry 1 }
|
||||||
|
|
||||||
|
e7VdslStackVdslPort OBJECT-TYPE
|
||||||
|
SYNTAX InterfaceIndex
|
||||||
|
MAX-ACCESS not-accessible
|
||||||
|
STATUS current
|
||||||
|
DESCRIPTION "The ifIndex of VDSL Port."
|
||||||
|
::= { e7VdslStackEntry 2 }
|
||||||
|
|
||||||
|
e7VdslStackStatus OBJECT-TYPE
|
||||||
|
SYNTAX RowStatus
|
||||||
|
MAX-ACCESS read-only
|
||||||
|
STATUS current
|
||||||
|
DESCRIPTION
|
||||||
|
"The status of the relationship between a DSL bonded interface and a VDSL port.
|
||||||
|
Only 'active' is appropriate for this object."
|
||||||
|
::= { e7VdslStackEntry 3 }
|
||||||
|
|
||||||
END
|
END
|
||||||
|
|||||||
14
resources/lang/en/device.php
Normal file
14
resources/lang/en/device.php
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
'attributes' => [
|
||||||
|
'features' => 'OS Features',
|
||||||
|
'hardware' => 'Hardware',
|
||||||
|
'icon' => 'Icon',
|
||||||
|
'location' => 'Location',
|
||||||
|
'os' => 'Device OS',
|
||||||
|
'serial' => 'Serial',
|
||||||
|
'sysName' => 'sysName',
|
||||||
|
'version' => 'OS Version',
|
||||||
|
],
|
||||||
|
];
|
||||||
@@ -26,8 +26,8 @@
|
|||||||
"sysDescr": "E7-2",
|
"sysDescr": "E7-2",
|
||||||
"sysContact": null,
|
"sysContact": null,
|
||||||
"version": null,
|
"version": null,
|
||||||
"hardware": null,
|
"hardware": "Calix E7-2",
|
||||||
"features": null,
|
"features": "",
|
||||||
"os": "exa",
|
"os": "exa",
|
||||||
"type": "network",
|
"type": "network",
|
||||||
"serial": null,
|
"serial": null,
|
||||||
@@ -45,7 +45,7 @@
|
|||||||
"sysContact": "<private>",
|
"sysContact": "<private>",
|
||||||
"version": null,
|
"version": null,
|
||||||
"hardware": "Calix E7-2",
|
"hardware": "Calix E7-2",
|
||||||
"features": null,
|
"features": "",
|
||||||
"os": "exa",
|
"os": "exa",
|
||||||
"type": "network",
|
"type": "network",
|
||||||
"serial": null,
|
"serial": null,
|
||||||
|
|||||||
@@ -7,12 +7,12 @@
|
|||||||
"sysObjectID": ".1.3.6.1.4.1.6321.1.2.2.5.3",
|
"sysObjectID": ".1.3.6.1.4.1.6321.1.2.2.5.3",
|
||||||
"sysDescr": "E7-2",
|
"sysDescr": "E7-2",
|
||||||
"sysContact": null,
|
"sysContact": null,
|
||||||
"version": null,
|
"version": "3.1.50.1",
|
||||||
"hardware": null,
|
"hardware": "Calix E7-2",
|
||||||
"features": null,
|
"features": "tenge4, gpon4",
|
||||||
"os": "exa",
|
"os": "exa",
|
||||||
"type": "network",
|
"type": "network",
|
||||||
"serial": null,
|
"serial": "80394580923",
|
||||||
"icon": "calix.svg",
|
"icon": "calix.svg",
|
||||||
"location": null
|
"location": null
|
||||||
}
|
}
|
||||||
@@ -30,7 +30,7 @@
|
|||||||
"features": "tenge4, gpon4",
|
"features": "tenge4, gpon4",
|
||||||
"os": "exa",
|
"os": "exa",
|
||||||
"type": "network",
|
"type": "network",
|
||||||
"serial": "80394580923, 19845092849",
|
"serial": "80394580923",
|
||||||
"icon": "calix.svg",
|
"icon": "calix.svg",
|
||||||
"location": "<private>"
|
"location": "<private>"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
"os": "linux",
|
"os": "linux",
|
||||||
"type": "server",
|
"type": "server",
|
||||||
"serial": null,
|
"serial": null,
|
||||||
"icon": "linux.svg",
|
"icon": "centos.svg",
|
||||||
"location": "<private>"
|
"location": "<private>"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user