mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Miscellaneous fixes, mostly undefined variables (#14432)
* Miscellaneous fixes, mostly undefined variables * Update phpstan-baseline.neon
This commit is contained in:
@@ -140,7 +140,7 @@ class QueryBuilderFluentParser extends QueryBuilderParser
|
|||||||
$op = $rule['operator'];
|
$op = $rule['operator'];
|
||||||
|
|
||||||
$value = $rule['value'];
|
$value = $rule['value'];
|
||||||
if (! is_array($value) && Str::startsWith($value, '`') && Str::endsWith($value, '`')) {
|
if (! is_array($value) && is_string($value) && Str::startsWith($value, '`') && Str::endsWith($value, '`')) {
|
||||||
$value = DB::raw($this->expandMacro(trim($value, '`')));
|
$value = DB::raw($this->expandMacro(trim($value, '`')));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -171,8 +171,12 @@ class QueryBuilderParser implements \JsonSerializable
|
|||||||
$split = array_chunk(preg_split('/(&&|\|\|)/', $query, -1, PREG_SPLIT_DELIM_CAPTURE), 2);
|
$split = array_chunk(preg_split('/(&&|\|\|)/', $query, -1, PREG_SPLIT_DELIM_CAPTURE), 2);
|
||||||
|
|
||||||
foreach ($split as $chunk) {
|
foreach ($split as $chunk) {
|
||||||
if (count($chunk) < 2 && empty($chunk[0])) {
|
if (count($chunk) < 2) {
|
||||||
continue; // likely the ending && or ||
|
if (empty($chunk[0])) {
|
||||||
|
continue; // likely the ending && or ||
|
||||||
|
}
|
||||||
|
|
||||||
|
$chunk[1] = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
@[$rule_text, $rule_operator] = $chunk;
|
@[$rule_text, $rule_operator] = $chunk;
|
||||||
@@ -181,8 +185,11 @@ class QueryBuilderParser implements \JsonSerializable
|
|||||||
$condition = ($rule_operator == '||' ? 'OR' : 'AND');
|
$condition = ($rule_operator == '||' ? 'OR' : 'AND');
|
||||||
}
|
}
|
||||||
|
|
||||||
@[$field, $op, $value] = preg_split('/ *([!=<>~]{1,2}) */', trim($rule_text), 2, PREG_SPLIT_DELIM_CAPTURE);
|
$rule_split = preg_split('/ *([!=<>~]{1,2}) */', trim($rule_text), 2, PREG_SPLIT_DELIM_CAPTURE);
|
||||||
$field = ltrim($field, '%');
|
|
||||||
|
$field = ltrim($rule_split[0], '%');
|
||||||
|
$op = $rule_split[1] ?? null;
|
||||||
|
$value = $rule_split[2] ?? null;
|
||||||
|
|
||||||
// for rules missing values just use '= 1'
|
// for rules missing values just use '= 1'
|
||||||
$operator = isset(self::$legacy_operators[$op]) ? self::$legacy_operators[$op] : 'equal';
|
$operator = isset(self::$legacy_operators[$op]) ? self::$legacy_operators[$op] : 'equal';
|
||||||
|
@@ -187,7 +187,7 @@ class SSOAuthorizer extends MysqlAuthorizer
|
|||||||
public function authSSOParseGroups()
|
public function authSSOParseGroups()
|
||||||
{
|
{
|
||||||
// Parse a delimited group list
|
// Parse a delimited group list
|
||||||
$groups = explode(Config::get('sso.group_delimiter', ';'), $this->authSSOGetAttr(Config::get('sso.group_attr')));
|
$groups = explode(Config::get('sso.group_delimiter', ';'), $this->authSSOGetAttr(Config::get('sso.group_attr')) ?? '');
|
||||||
|
|
||||||
$valid_groups = [];
|
$valid_groups = [];
|
||||||
|
|
||||||
|
@@ -114,7 +114,9 @@ class Config
|
|||||||
private static function loadUserConfigFile(&$config)
|
private static function loadUserConfigFile(&$config)
|
||||||
{
|
{
|
||||||
// Load user config file
|
// Load user config file
|
||||||
@include base_path('config.php');
|
if (is_file(base_path('config.php'))) {
|
||||||
|
@include base_path('config.php');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -412,10 +414,10 @@ class Config
|
|||||||
isset($_SERVER['HTTPS']) ||
|
isset($_SERVER['HTTPS']) ||
|
||||||
(isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')
|
(isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')
|
||||||
) {
|
) {
|
||||||
self::set('base_url', preg_replace('/^http:/', 'https:', self::get('base_url')));
|
self::set('base_url', preg_replace('/^http:/', 'https:', self::get('base_url', '')));
|
||||||
}
|
}
|
||||||
|
|
||||||
self::set('base_url', Str::finish(self::get('base_url'), '/'));
|
self::set('base_url', Str::finish(self::get('base_url', ''), '/'));
|
||||||
|
|
||||||
if (! self::get('email_from')) {
|
if (! self::get('email_from')) {
|
||||||
self::set('email_from', '"' . self::get('project_name') . '" <' . self::get('email_user') . '@' . php_uname('n') . '>');
|
self::set('email_from', '"' . self::get('project_name') . '" <' . self::get('email_user') . '@' . php_uname('n') . '>');
|
||||||
|
@@ -43,7 +43,9 @@ class Graphite extends BaseDatastore
|
|||||||
$host = Config::get('graphite.host');
|
$host = Config::get('graphite.host');
|
||||||
$port = Config::get('graphite.port', 2003);
|
$port = Config::get('graphite.port', 2003);
|
||||||
try {
|
try {
|
||||||
$this->connection = $socketFactory->createClient("$host:$port");
|
if (self::isEnabled() && $host && $port) {
|
||||||
|
$this->connection = $socketFactory->createClient("$host:$port");
|
||||||
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
d_echo($e->getMessage());
|
d_echo($e->getMessage());
|
||||||
}
|
}
|
||||||
|
@@ -42,7 +42,9 @@ class OpenTSDB extends BaseDatastore
|
|||||||
$host = Config::get('opentsdb.host');
|
$host = Config::get('opentsdb.host');
|
||||||
$port = Config::get('opentsdb.port', 2181);
|
$port = Config::get('opentsdb.port', 2181);
|
||||||
try {
|
try {
|
||||||
$this->connection = $socketFactory->createClient("$host:$port");
|
if (self::isEnabled() && $host && $port) {
|
||||||
|
$this->connection = $socketFactory->createClient("$host:$port");
|
||||||
|
}
|
||||||
} catch (\Socket\Raw\Exception $e) {
|
} catch (\Socket\Raw\Exception $e) {
|
||||||
Log::debug('OpenTSDB Error: ' . $e->getMessage());
|
Log::debug('OpenTSDB Error: ' . $e->getMessage());
|
||||||
}
|
}
|
||||||
|
@@ -198,19 +198,19 @@ class Core implements Module
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($key == 'sysObjectID') {
|
if ($key == 'sysObjectID') {
|
||||||
if (Str::startsWith($device['sysObjectID'], $value) == $check) {
|
if (Str::startsWith($device['sysObjectID'] ?? '', $value) == $check) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} elseif ($key == 'sysDescr') {
|
} elseif ($key == 'sysDescr') {
|
||||||
if (Str::contains($device['sysDescr'], $value) == $check) {
|
if (Str::contains($device['sysDescr'] ?? '', $value) == $check) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} elseif ($key == 'sysDescr_regex') {
|
} elseif ($key == 'sysDescr_regex') {
|
||||||
if (preg_match_any($device['sysDescr'], $value) == $check) {
|
if (preg_match_any($device['sysDescr'] ?? '', $value) == $check) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} elseif ($key == 'sysObjectID_regex') {
|
} elseif ($key == 'sysObjectID_regex') {
|
||||||
if (preg_match_any($device['sysObjectID'], $value) == $check) {
|
if (preg_match_any($device['sysObjectID'] ?? '', $value) == $check) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} elseif ($key == 'snmpget') {
|
} elseif ($key == 'snmpget') {
|
||||||
|
@@ -44,7 +44,7 @@ class ThreeCom extends OS implements OSDiscovery
|
|||||||
|
|
||||||
$device->hardware = str_replace('3Com ', '', $device->sysDescr);
|
$device->hardware = str_replace('3Com ', '', $device->sysDescr);
|
||||||
// Old Stack Units
|
// Old Stack Units
|
||||||
if (Str::startsWith($device->sysObjectID, '.1.3.6.1.4.1.43.10.27.4.1.')) {
|
if (Str::startsWith($device->sysObjectID ?? '', '.1.3.6.1.4.1.43.10.27.4.1.')) {
|
||||||
$oids = ['stackUnitDesc.1', 'stackUnitPromVersion.1', 'stackUnitSWVersion.1', 'stackUnitSerialNumber.1', 'stackUnitCapabilities.1'];
|
$oids = ['stackUnitDesc.1', 'stackUnitPromVersion.1', 'stackUnitSWVersion.1', 'stackUnitSerialNumber.1', 'stackUnitCapabilities.1'];
|
||||||
$data = snmp_get_multi($this->getDeviceArray(), $oids, ['-OQUs', '--hexOutputLength=0'], 'A3COM0352-STACK-CONFIG');
|
$data = snmp_get_multi($this->getDeviceArray(), $oids, ['-OQUs', '--hexOutputLength=0'], 'A3COM0352-STACK-CONFIG');
|
||||||
$device->hardware = trim($device->hardware . ' ' . ($data[1]['stackUnitDesc'] ?? ''));
|
$device->hardware = trim($device->hardware . ' ' . ($data[1]['stackUnitDesc'] ?? ''));
|
||||||
|
@@ -59,7 +59,7 @@ class Trap
|
|||||||
$this->hostname = array_shift($lines);
|
$this->hostname = array_shift($lines);
|
||||||
|
|
||||||
$line = array_shift($lines);
|
$line = array_shift($lines);
|
||||||
if (preg_match('/\[([0-9.:a-fA-F]+)\]/', $line, $matches)) {
|
if ($line && preg_match('/\[([0-9.:a-fA-F]+)\]/', $line, $matches)) {
|
||||||
$this->ip = $matches[1];
|
$this->ip = $matches[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -44,8 +44,8 @@ class Compare
|
|||||||
{
|
{
|
||||||
// handle PHP8 change to implicit casting
|
// handle PHP8 change to implicit casting
|
||||||
if (is_numeric($a) || is_numeric($b)) {
|
if (is_numeric($a) || is_numeric($b)) {
|
||||||
$a = cast_number($a);
|
$a = Number::cast($a);
|
||||||
$b = is_array($b) ? $b : cast_number($b);
|
$b = is_array($b) ? $b : Number::cast($b);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ($comparison) {
|
switch ($comparison) {
|
||||||
|
@@ -35,6 +35,9 @@ class Dns implements Geocoder
|
|||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->resolver = new \Net_DNS2_Resolver();
|
$this->resolver = new \Net_DNS2_Resolver();
|
||||||
|
// Workaround for strlen() null
|
||||||
|
// https://github.com/mikepultz/netdns2/blob/master/Net/DNS2/Socket.php#L132
|
||||||
|
$this->resolver->local_host = '0';
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function lookupIp(Device $device): ?string
|
public static function lookupIp(Device $device): ?string
|
||||||
|
@@ -535,7 +535,7 @@ class ModuleTestHelper
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Remove existing device in case it didn't get removed previously
|
// Remove existing device in case it didn't get removed previously
|
||||||
if ($existing_device = device_by_name($snmpsim->getIp())) {
|
if (($existing_device = device_by_name($snmpsim->getIp())) && isset($existing_device['device_id'])) {
|
||||||
delete_device($existing_device['device_id']);
|
delete_device($existing_device['device_id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -38,7 +38,7 @@ $divisor = 1;
|
|||||||
|
|
||||||
// Adva Network Port dBm
|
// Adva Network Port dBm
|
||||||
foreach ($pre_cache['adva_fsp150_ports'] as $index => $entry) {
|
foreach ($pre_cache['adva_fsp150_ports'] as $index => $entry) {
|
||||||
if ($entry['cmEthernetNetPortMediaType'] == 'fiber') {
|
if (isset($entry['cmEthernetNetPortMediaType']) && $entry['cmEthernetNetPortMediaType'] == 'fiber') {
|
||||||
// Discover receive power level
|
// Discover receive power level
|
||||||
$oidRx = '.1.3.6.1.4.1.2544.1.12.5.1.5.1.34.' . $index . '.3';
|
$oidRx = '.1.3.6.1.4.1.2544.1.12.5.1.5.1.34.' . $index . '.3';
|
||||||
$oidTx = '.1.3.6.1.4.1.2544.1.12.5.1.5.1.33.' . $index . '.3';
|
$oidTx = '.1.3.6.1.4.1.2544.1.12.5.1.5.1.33.' . $index . '.3';
|
||||||
@@ -94,7 +94,7 @@ foreach ($pre_cache['adva_fsp150_ports'] as $index => $entry) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Adva Access Ports dBm
|
// Adva Access Ports dBm
|
||||||
if ($entry['cmEthernetAccPortMediaType'] == 'fiber') {
|
if (isset($entry['cmEthernetAccPortMediaType']) && $entry['cmEthernetAccPortMediaType'] == 'fiber') {
|
||||||
//Discover receive power level
|
//Discover receive power level
|
||||||
$oidRx = '.1.3.6.1.4.1.2544.1.12.5.1.1.1.34.' . $index . '.3';
|
$oidRx = '.1.3.6.1.4.1.2544.1.12.5.1.1.1.34.' . $index . '.3';
|
||||||
$oidTx = '.1.3.6.1.4.1.2544.1.12.5.1.1.1.33.' . $index . '.3';
|
$oidTx = '.1.3.6.1.4.1.2544.1.12.5.1.1.1.33.' . $index . '.3';
|
||||||
@@ -151,7 +151,7 @@ foreach ($pre_cache['adva_fsp150_ports'] as $index => $entry) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Adva Traffic Port dBm
|
// Adva Traffic Port dBm
|
||||||
if ($entry['cmEthernetTrafficPortMediaType'] == 'fiber') {
|
if (isset($entry['cmEthernetTrafficPortMediaType']) && $entry['cmEthernetTrafficPortMediaType'] == 'fiber') {
|
||||||
//Discover receivn power level
|
//Discover receivn power level
|
||||||
$oidRx = '.1.3.6.1.4.1.2544.1.12.5.1.21.1.34.' . $index . '.3';
|
$oidRx = '.1.3.6.1.4.1.2544.1.12.5.1.21.1.34.' . $index . '.3';
|
||||||
$oidTx = '.1.3.6.1.4.1.2544.1.12.5.1.21.1.33.' . $index . '.3';
|
$oidTx = '.1.3.6.1.4.1.2544.1.12.5.1.21.1.33.' . $index . '.3';
|
||||||
|
@@ -20,6 +20,7 @@
|
|||||||
$pre_cache['adva_fsp150'] = snmpwalk_cache_multi_oid($device, 'cmEntityObjects', [], 'CM-ENTITY-MIB', null, '-OQUbs');
|
$pre_cache['adva_fsp150'] = snmpwalk_cache_multi_oid($device, 'cmEntityObjects', [], 'CM-ENTITY-MIB', null, '-OQUbs');
|
||||||
$pre_cache['adva_erp'] = snmpwalk_cache_multi_oid($device, 'f3ErpConfigObjects', [], 'F3-ERP-MIB', null, '-OQUbs');
|
$pre_cache['adva_erp'] = snmpwalk_cache_multi_oid($device, 'f3ErpConfigObjects', [], 'F3-ERP-MIB', null, '-OQUbs');
|
||||||
$pre_cache['adva_fsp150_perfs'] = [];
|
$pre_cache['adva_fsp150_perfs'] = [];
|
||||||
|
$pre_cache['adva_fsp150_ports'] = [];
|
||||||
|
|
||||||
$neType = $pre_cache['adva_fsp150'][1]['neType'];
|
$neType = $pre_cache['adva_fsp150'][1]['neType'];
|
||||||
$pre_cache['adva_fsp150_ifName'] = snmpwalk_cache_multi_oid($device, 'ifName', [], 'IF-MIB', null, '-OQUbs');
|
$pre_cache['adva_fsp150_ifName'] = snmpwalk_cache_multi_oid($device, 'ifName', [], 'IF-MIB', null, '-OQUbs');
|
||||||
@@ -32,6 +33,7 @@ if ($neType == 'ccxg116pro' || $neType == 'ccxg116proH' || $neType == 'ccxg120pr
|
|||||||
$pre_cache['adva_fsp150_perfs'] = snmpwalk_cache_multi_oid($device, 'cmEthernetTrafficPortStatsTemp', $pre_cache['adva_fsp150_perfs'], 'CM-PERFORMANCE-MIB', null, '-OQUbs');
|
$pre_cache['adva_fsp150_perfs'] = snmpwalk_cache_multi_oid($device, 'cmEthernetTrafficPortStatsTemp', $pre_cache['adva_fsp150_perfs'], 'CM-PERFORMANCE-MIB', null, '-OQUbs');
|
||||||
} else {
|
} else {
|
||||||
$pre_cache['adva_fsp150_ports'] = snmpwalk_cache_multi_oid($device, 'cmEthernetNetPortTable', $pre_cache['adva_fsp150_ports'], 'CM-FACILITY-MIB', null, '-OQUbs');
|
$pre_cache['adva_fsp150_ports'] = snmpwalk_cache_multi_oid($device, 'cmEthernetNetPortTable', $pre_cache['adva_fsp150_ports'], 'CM-FACILITY-MIB', null, '-OQUbs');
|
||||||
|
|
||||||
$pre_cache['adva_fsp150_perfs'] = snmpwalk_cache_multi_oid($device, 'cmEthernetNetPortStatsLBC', $pre_cache['adva_fsp150_perfs'], 'CM-PERFORMANCE-MIB', null, '-OQUbs');
|
$pre_cache['adva_fsp150_perfs'] = snmpwalk_cache_multi_oid($device, 'cmEthernetNetPortStatsLBC', $pre_cache['adva_fsp150_perfs'], 'CM-PERFORMANCE-MIB', null, '-OQUbs');
|
||||||
$pre_cache['adva_fsp150_perfs'] = snmpwalk_cache_multi_oid($device, 'cmEthernetNetPortStatsOPR', $pre_cache['adva_fsp150_perfs'], 'CM-PERFORMANCE-MIB', null, '-OQUbs');
|
$pre_cache['adva_fsp150_perfs'] = snmpwalk_cache_multi_oid($device, 'cmEthernetNetPortStatsOPR', $pre_cache['adva_fsp150_perfs'], 'CM-PERFORMANCE-MIB', null, '-OQUbs');
|
||||||
$pre_cache['adva_fsp150_perfs'] = snmpwalk_cache_multi_oid($device, 'cmEthernetNetPortStatsOPT', $pre_cache['adva_fsp150_perfs'], 'CM-PERFORMANCE-MIB', null, '-OQUbs');
|
$pre_cache['adva_fsp150_perfs'] = snmpwalk_cache_multi_oid($device, 'cmEthernetNetPortStatsOPT', $pre_cache['adva_fsp150_perfs'], 'CM-PERFORMANCE-MIB', null, '-OQUbs');
|
||||||
|
@@ -5,7 +5,7 @@ $stack_left = snmp_walk($device, 'chasFreeSlots', '-OQUse', 'ALCATEL-IND1-CHASSI
|
|||||||
$stack_role = snmp_walk($device, 'alaStackMgrChasRole', '-OQUse', 'ALCATEL-IND1-STACK-MANAGER-MIB', 'nokia');
|
$stack_role = snmp_walk($device, 'alaStackMgrChasRole', '-OQUse', 'ALCATEL-IND1-STACK-MANAGER-MIB', 'nokia');
|
||||||
$stack_alone = substr($stack_role, strpos($stack_role, '=') + 1);
|
$stack_alone = substr($stack_role, strpos($stack_role, '=') + 1);
|
||||||
$stack_left = substr($stack_left, strpos($stack_left, '=') + 1);
|
$stack_left = substr($stack_left, strpos($stack_left, '=') + 1);
|
||||||
$true_stacking = (7 - $stack_left);
|
//$true_stacking = (7 - $stack_left);
|
||||||
$stacking = '7';
|
$stacking = '7';
|
||||||
$stacking_non = '4';
|
$stacking_non = '4';
|
||||||
$aos6_fan_oids = snmpwalk_cache_multi_oid($device, 'alaChasEntPhysFanTable', [], 'ALCATEL-IND1-CHASSIS-MIB', 'aos6', '-OQUse');
|
$aos6_fan_oids = snmpwalk_cache_multi_oid($device, 'alaChasEntPhysFanTable', [], 'ALCATEL-IND1-CHASSIS-MIB', 'aos6', '-OQUse');
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
$oids = snmpwalk_cache_oid($device, 'sensorProbeTempTable', [], 'SPAGENT-MIB');
|
$oids = snmpwalk_cache_oid($device, 'sensorProbeTempTable', [], 'SPAGENT-MIB');
|
||||||
d_echo($oids . "\n");
|
|
||||||
|
|
||||||
foreach ($oids as $index => $entry) {
|
foreach ($oids as $index => $entry) {
|
||||||
if ($entry['sensorProbeTempOnline'] == 'online') {
|
if ($entry['sensorProbeTempOnline'] == 'online') {
|
||||||
|
@@ -88,7 +88,7 @@
|
|||||||
foreach (array_keys($pre_cache['adva_fsp150']) as $index) {
|
foreach (array_keys($pre_cache['adva_fsp150']) as $index) {
|
||||||
foreach ($sensors_adva as $entry) {
|
foreach ($sensors_adva as $entry) {
|
||||||
$sensor_name = $entry['sensor_name'];
|
$sensor_name = $entry['sensor_name'];
|
||||||
if ($pre_cache['adva_fsp150'][$index][$sensor_name]) {
|
if (isset($pre_cache['adva_fsp150'][$index][$sensor_name])) {
|
||||||
$oid = $entry['sensor_oid'] . '.' . $index;
|
$oid = $entry['sensor_oid'] . '.' . $index;
|
||||||
$rrd_filename = $pre_cache['adva_fsp150'][$index]['slotCardUnitName'] . '-' . $pre_cache['adva_fsp150'][$index]['slotIndex'];
|
$rrd_filename = $pre_cache['adva_fsp150'][$index]['slotCardUnitName'] . '-' . $pre_cache['adva_fsp150'][$index]['slotIndex'];
|
||||||
$descr = $pre_cache['adva_fsp150'][$index]['slotCardUnitName'] . ' [#' . $pre_cache['adva_fsp150'][$index]['slotIndex'] . ']';
|
$descr = $pre_cache['adva_fsp150'][$index]['slotCardUnitName'] . ' [#' . $pre_cache['adva_fsp150'][$index]['slotIndex'] . ']';
|
||||||
|
@@ -34,7 +34,7 @@ foreach ($vlans as $vlan_id => $vlan) {
|
|||||||
|
|
||||||
$vlanstype = snmpwalk_group($device, 'vpaType', 'ALCATEL-IND1-VLAN-MGR-MIB', 0, [], 'nokia');
|
$vlanstype = snmpwalk_group($device, 'vpaType', 'ALCATEL-IND1-VLAN-MGR-MIB', 0, [], 'nokia');
|
||||||
|
|
||||||
foreach ($vlanstype['vpaType'] as $vlan_id => $data) {
|
foreach ($vlanstype['vpaType'] ?? [] as $vlan_id => $data) {
|
||||||
foreach ($data as $portidx => $porttype) {
|
foreach ($data as $portidx => $porttype) {
|
||||||
$per_vlan_data[$vlan_id][$portidx]['untagged'] = ($porttype == 1 ? 1 : 0);
|
$per_vlan_data[$vlan_id][$portidx]['untagged'] = ($porttype == 1 ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
@@ -7,7 +7,7 @@ $vlans = snmpwalk_cache_oid($device, 'vlanDescription', [], 'ALCATEL-IND1-VLAN-M
|
|||||||
|
|
||||||
foreach ($vlans as $vlan_id => $vlan) {
|
foreach ($vlans as $vlan_id => $vlan) {
|
||||||
d_echo(" $vlan_id");
|
d_echo(" $vlan_id");
|
||||||
if (is_array($vlans_db[$vtpdomain_id][$vlan_id])) {
|
if (isset($vlans_db[$vtpdomain_id][$vlan_id]) && is_array($vlans_db[$vtpdomain_id][$vlan_id])) {
|
||||||
$vlan_data = $vlans_db[$vtpdomain_id][$vlan_id];
|
$vlan_data = $vlans_db[$vtpdomain_id][$vlan_id];
|
||||||
if ($vlan_data['vlan_name'] != $vlan['vlanDescription']) {
|
if ($vlan_data['vlan_name'] != $vlan['vlanDescription']) {
|
||||||
$vlan_upd['vlan_name'] = $vlan['vlanDescription'];
|
$vlan_upd['vlan_name'] = $vlan['vlanDescription'];
|
||||||
|
@@ -213,7 +213,7 @@ if (Config::get('enable_vrfs')) {
|
|||||||
|
|
||||||
echo "\n [VRF $vrf_name] OID - $vrf_oid";
|
echo "\n [VRF $vrf_name] OID - $vrf_oid";
|
||||||
echo "\n [VRF $vrf_name] RD - $vrf_rd";
|
echo "\n [VRF $vrf_name] RD - $vrf_rd";
|
||||||
echo "\n [VRF $vrf_name] DESC - $vrf_desc";
|
//echo "\n [VRF $vrf_name] DESC - $vrf_desc";
|
||||||
|
|
||||||
$vrfs = [
|
$vrfs = [
|
||||||
'vrf_oid' => $vrf_oid,
|
'vrf_oid' => $vrf_oid,
|
||||||
@@ -225,16 +225,16 @@ if (Config::get('enable_vrfs')) {
|
|||||||
];
|
];
|
||||||
|
|
||||||
if (dbFetchCell('SELECT COUNT(*) FROM vrfs WHERE device_id = ? AND `vrf_oid`=?', [$device['device_id'], $vrf_oid])) {
|
if (dbFetchCell('SELECT COUNT(*) FROM vrfs WHERE device_id = ? AND `vrf_oid`=?', [$device['device_id'], $vrf_oid])) {
|
||||||
dbUpdate(['vrf_name' => $vrf_name, 'bgpLocalAs' => $vrf_as, 'mplsVpnVrfRouteDistinguisher' => $vrf_rd, 'mplsVpnVrfDescription' => $vrf_desc], 'vrfs', 'device_id=? AND vrf_oid=?', [$device['device_id'], $vrf_oid]);
|
dbUpdate(['vrf_name' => $vrf_name, 'bgpLocalAs' => $vrf_as, 'mplsVpnVrfRouteDistinguisher' => $vrf_rd, 'mplsVpnVrfDescription' => null], 'vrfs', 'device_id=? AND vrf_oid=?', [$device['device_id'], $vrf_oid]);
|
||||||
} else {
|
} else {
|
||||||
dbInsert($vrfs, 'vrfs');
|
dbInsert($vrfs, 'vrfs');
|
||||||
}
|
}
|
||||||
} //end foreach
|
} //end foreach
|
||||||
|
|
||||||
echo "\n [VRF $vrf_name] PORTS - ";
|
|
||||||
foreach ($aristaVrfIfTable as $if_index => $if_data) {
|
foreach ($aristaVrfIfTable as $if_index => $if_data) {
|
||||||
try {
|
try {
|
||||||
$ifVrfName = $if_data['aristaVrfIfMembership'];
|
$ifVrfName = $if_data['aristaVrfIfMembership'];
|
||||||
|
echo "\n [VRF $ifVrfName] PORTS - ";
|
||||||
$vrf_id = dbFetchCell('SELECT vrf_id FROM vrfs WHERE device_id = ? AND `vrf_oid`=?', [$device['device_id'], $ifVrfName]);
|
$vrf_id = dbFetchCell('SELECT vrf_id FROM vrfs WHERE device_id = ? AND `vrf_oid`=?', [$device['device_id'], $ifVrfName]);
|
||||||
$valid_vrf[$vrf_id] = 1;
|
$valid_vrf[$vrf_id] = 1;
|
||||||
$interface = dbFetchRow('SELECT * FROM `ports` WHERE `device_id` = ? AND `ifIndex` = ?', [$device['device_id'], $if_index]);
|
$interface = dbFetchRow('SELECT * FROM `ports` WHERE `device_id` = ? AND `ifIndex` = ?', [$device['device_id'], $if_index]);
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
$vars = \LibreNMS\Util\Url::parseLegacyPathVars($_SERVER['REQUEST_URI']);
|
$vars = \LibreNMS\Util\Url::parseLegacyPathVars($_SERVER['REQUEST_URI'] ?? null);
|
||||||
|
|
||||||
foreach ($_GET as $name => $value) {
|
foreach ($_GET as $name => $value) {
|
||||||
$vars[$name] = strip_tags($value);
|
$vars[$name] = strip_tags($value);
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
* the source code distribution for details.
|
* the source code distribution for details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (! is_array($aix_cache['aixFileSystem'])) {
|
if (! isset($aix_cache) || ! is_array($aix_cache['aixFileSystem'])) {
|
||||||
$aix_cache['aixFileSystem'] = snmpwalk_cache_oid($device, 'aixFsTableEntry', [], 'IBM-AIX-MIB');
|
$aix_cache['aixFileSystem'] = snmpwalk_cache_oid($device, 'aixFsTableEntry', [], 'IBM-AIX-MIB');
|
||||||
d_echo($aix_cache);
|
d_echo($aix_cache);
|
||||||
}
|
}
|
||||||
|
@@ -915,11 +915,6 @@ parameters:
|
|||||||
count: 1
|
count: 1
|
||||||
path: LibreNMS/Alerting/QueryBuilderFilter.php
|
path: LibreNMS/Alerting/QueryBuilderFilter.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Call to function is_null\\(\\) with string will always evaluate to false\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: LibreNMS/Alerting/QueryBuilderParser.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Property LibreNMS\\\\Alerting\\\\QueryBuilderParser\\:\\:\\$builder has no type specified\\.$#"
|
message: "#^Property LibreNMS\\\\Alerting\\\\QueryBuilderParser\\:\\:\\$builder has no type specified\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
|
Reference in New Issue
Block a user