diff --git a/LibreNMS/Device/Sensor.php b/LibreNMS/Device/Sensor.php index 2f5c44474236..b6e3febefbe8 100644 --- a/LibreNMS/Device/Sensor.php +++ b/LibreNMS/Device/Sensor.php @@ -26,12 +26,14 @@ namespace LibreNMS\Device; use App\Models\Eventlog; +use Illuminate\Support\Facades\Log; use LibreNMS\Config; use LibreNMS\Enum\Severity; use LibreNMS\Interfaces\Discovery\DiscoveryModule; use LibreNMS\Interfaces\Polling\PollerModule; use LibreNMS\OS; use LibreNMS\RRD\RrdDefinition; +use LibreNMS\Util\Number; use LibreNMS\Util\StringHelpers; class Sensor implements DiscoveryModule, PollerModule @@ -136,7 +138,7 @@ public function __construct( $this->valid = is_numeric($this->current); } - d_echo('Discovered ' . get_called_class() . ' ' . print_r($sensor, true)); + Log::debug('Discovered ' . get_called_class() . ' ' . print_r($sensor, true)); } /** @@ -323,14 +325,14 @@ protected static function pollSensorType($os, $type, $sensors, $prefetch = []) // process data or run custom polling $typeInterface = static::getPollingInterface($type); if ($os instanceof $typeInterface) { - d_echo("Using OS polling for $type\n"); + Log::debug("Using OS polling for $type\n"); $function = static::getPollingMethod($type); $data = $os->$function($sensors); } else { $data = static::processSensorData($sensors, $prefetch); } - d_echo($data); + Log::debug($data); self::recordSensorData($os, $sensors, $data); } @@ -357,7 +359,7 @@ private static function fetchSnmpData($device, $sensors) array_walk($snmp_data, function (&$oid) { preg_match('/-?\d+(\.\d+)?(e-?\d+)?/i', $oid, $matches); if (isset($matches[0])) { - $oid = cast_number($matches[0]); + $oid = Number::cast($matches[0]); } else { $oid = trim('"', $oid); // allow string only values } @@ -409,11 +411,11 @@ protected static function processSensorValue(array $data, string $aggregator, in } if ($divisor && $sensor_value !== 0) { - $sensor_value = (cast_number($sensor_value) / $divisor); + $sensor_value = (Number::cast($sensor_value) / $divisor); } if ($multiplier) { - $sensor_value = (cast_number($sensor_value) * $multiplier); + $sensor_value = (Number::cast($sensor_value) * $multiplier); } return $sensor_value; diff --git a/LibreNMS/OS/Arubaos.php b/LibreNMS/OS/Arubaos.php index 824d70250c06..fc83c60aeb12 100644 --- a/LibreNMS/OS/Arubaos.php +++ b/LibreNMS/OS/Arubaos.php @@ -36,6 +36,7 @@ use LibreNMS\Interfaces\Discovery\Sensors\WirelessUtilizationDiscovery; use LibreNMS\Interfaces\Polling\Sensors\WirelessFrequencyPolling; use LibreNMS\OS; +use LibreNMS\Util\Number; use SnmpQuery; class Arubaos extends OS implements @@ -162,7 +163,7 @@ public function discoverWirelessPower() protected function decodeChannel($channel) { - return cast_number($channel) & 255; // mask off the channel width information + return Number::cast($channel) & 255; // mask off the channel width information } private function discoverInstantRadio($type, $oid, $desc = 'Radio %s') diff --git a/includes/discovery/functions.inc.php b/includes/discovery/functions.inc.php index ec5865ae7c1a..a778b90fd6d5 100644 --- a/includes/discovery/functions.inc.php +++ b/includes/discovery/functions.inc.php @@ -20,6 +20,7 @@ use App\Models\Ipv6Address; use App\Models\Ipv6Network; use App\Models\Port; +use Illuminate\Support\Facades\Log; use Illuminate\Support\Str; use LibreNMS\Config; use LibreNMS\Device\YamlDiscovery; @@ -30,6 +31,7 @@ use LibreNMS\Util\IP; use LibreNMS\Util\IPv4; use LibreNMS\Util\IPv6; +use LibreNMS\Util\Number; use LibreNMS\Util\UserFuncHelper; /** @@ -43,12 +45,12 @@ */ function discover_new_device($hostname, $device, $method, $interface = null) { - d_echo("discovering $hostname\n"); + Log::debug("discovering $hostname\n"); if (IP::isValid($hostname)) { $ip = $hostname; if (! Config::get('discovery_by_ip', false)) { - d_echo('Discovery by IP disabled, skipping ' . $hostname); + Log::debug('Discovery by IP disabled, skipping ' . $hostname); Eventlog::log("$method discovery of " . $hostname . ' failed - Discovery by IP disabled', $device['device_id'], 'discovery', Severity::Warning); return false; @@ -63,30 +65,30 @@ function discover_new_device($hostname, $device, $method, $interface = null) $ip = gethostbyname($hostname); if ($ip == $hostname) { - d_echo("name lookup of $hostname failed\n"); + Log::debug("name lookup of $hostname failed\n"); Eventlog::log("$method discovery of " . $hostname . ' failed - Check name lookup', $device['device_id'], 'discovery', Severity::Error); return false; } } else { - d_echo("Discovery failed: '$hostname' is not a valid ip or dns name\n"); + Log::debug("Discovery failed: '$hostname' is not a valid ip or dns name\n"); return false; } - d_echo("ip lookup result: $ip\n"); + Log::debug("ip lookup result: $ip\n"); $hostname = rtrim($hostname, '.'); // remove trailing dot $ip = IP::parse($ip, true); if ($ip->inNetworks(Config::get('autodiscovery.nets-exclude'))) { - d_echo("$ip in an excluded network - skipping\n"); + Log::debug("$ip in an excluded network - skipping\n"); return false; } if (! $ip->inNetworks(Config::get('nets'))) { - d_echo("$ip not in a matched network - skipping\n"); + Log::debug("$ip not in a matched network - skipping\n"); return false; } @@ -154,9 +156,9 @@ function discover_device(&$device, $force_module = false) foreach ($discovery_modules as $module => $module_status) { $os_module_status = Config::getOsSetting($device['os'], "discovery_modules.$module"); $device_module_status = DeviceCache::getPrimary()->getAttrib('discover_' . $module); - d_echo('Modules status: Global' . (isset($module_status) ? ($module_status ? '+ ' : '- ') : ' ')); - d_echo('OS' . (isset($os_module_status) ? ($os_module_status ? '+ ' : '- ') : ' ')); - d_echo('Device' . ($device_module_status !== null ? ($device_module_status ? '+ ' : '- ') : ' ')); + Log::debug('Modules status: Global' . (isset($module_status) ? ($module_status ? '+ ' : '- ') : ' ')); + Log::debug('OS' . (isset($os_module_status) ? ($os_module_status ? '+ ' : '- ') : ' ')); + Log::debug('Device' . ($device_module_status !== null ? ($device_module_status ? '+ ' : '- ') : ' ')); if ($force_module === true || $device_module_status || ($os_module_status && $device_module_status === null) || @@ -206,7 +208,7 @@ function discover_sensor($unused, $class, $device, $oid, $index, $type, $descr, $low_warn_limit = set_null($low_warn_limit); $warn_limit = set_null($warn_limit); $high_limit = set_null($high_limit); - $current = cast_number($current); + $current = Number::cast($current); if (! is_numeric($divisor)) { $divisor = 1; @@ -239,11 +241,11 @@ function discover_sensor($unused, $class, $device, $oid, $index, $type, $descr, function discover_juniAtmVp(&$valid, $device, $port_id, $vp_id, $vp_descr) { - d_echo("Discover Juniper ATM VP: $port_id, $vp_id, $vp_descr\n"); + Log::debug("Discover Juniper ATM VP: $port_id, $vp_id, $vp_descr\n"); if (dbFetchCell('SELECT COUNT(*) FROM `juniAtmVp` WHERE `port_id` = ? AND `vp_id` = ?', [$port_id, $vp_id]) == '0') { $inserted = dbInsert(['port_id' => $port_id, 'vp_id' => $vp_id, 'vp_descr' => $vp_descr], 'juniAtmVp'); - d_echo("( $inserted inserted )\n"); + Log::debug("( $inserted inserted )\n"); // FIXME vv no $device! Eventlog::log('Juniper ATM VP Added: port ' . $port_id . ' vp ' . $vp_id . ' descr' . $vp_descr, $device, 'juniAtmVp', 3, $inserted); @@ -260,7 +262,7 @@ function discover_link($local_port_id, $protocol, $remote_port_id, $remote_hostn { global $link_exists; - d_echo("Discover link: $local_port_id, $protocol, $remote_port_id, $remote_hostname, $remote_port, $remote_platform, $remote_version, $remote_device_id\n"); + Log::debug("Discover link: $local_port_id, $protocol, $remote_port_id, $remote_hostname, $remote_port, $remote_platform, $remote_version, $remote_device_id\n"); if (dbFetchCell( 'SELECT COUNT(*) FROM `links` WHERE `remote_hostname` = ? AND `local_port_id` = ? AND `protocol` = ? AND `remote_port` = ?', @@ -289,7 +291,7 @@ function discover_link($local_port_id, $protocol, $remote_port_id, $remote_hostn $inserted = dbInsert($insert_data, 'links'); echo '+'; - d_echo("( $inserted inserted )"); + Log::debug("( $inserted inserted )"); } else { $sql = 'SELECT `id`,`local_device_id`,`remote_platform`,`remote_version`,`remote_device_id`,`remote_port_id` FROM `links`'; $sql .= ' WHERE `remote_hostname` = ? AND `local_port_id` = ? AND `protocol` = ? AND `remote_port` = ?'; @@ -310,7 +312,7 @@ function discover_link($local_port_id, $protocol, $remote_port_id, $remote_hostn } else { $updated = dbUpdate($update_data, 'links', '`id` = ?', [$id]); echo 'U'; - d_echo("( $updated updated )"); + Log::debug("( $updated updated )"); }//end if }//end if $link_exists[$local_port_id][$remote_hostname][$remote_port] = 1; @@ -323,7 +325,7 @@ function discover_storage(&$valid, $device, $index, $type, $mib, $descr, $size, if (ignore_storage($device['os'], $descr)) { return; } - d_echo("Discover Storage: $index, $type, $mib, $descr, $size, $units, $used\n"); + Log::debug("Discover Storage: $index, $type, $mib, $descr, $size, $units, $used\n"); if ($descr && $size > '0') { $storage = dbFetchRow('SELECT * FROM `storage` WHERE `storage_index` = ? AND `device_id` = ? AND `storage_mib` = ?', [$index, $device['device_id'], $mib]); @@ -382,7 +384,7 @@ function discover_process_ipv6(&$valid, $ifIndex, $ipv6_address, $ipv6_prefixlen ])->value('port_id'); if ($port_id && $ipv6_prefixlen > '0' && $ipv6_prefixlen < '129' && $ipv6_compressed != '::1') { - d_echo('IPV6: Found port id: ' . $port_id); + Log::debug('IPV6: Found port id: ' . $port_id); $ipv6netDB = Ipv6Network::updateOrCreate([ 'ipv6_network' => $ipv6_network, @@ -391,13 +393,13 @@ function discover_process_ipv6(&$valid, $ifIndex, $ipv6_address, $ipv6_prefixlen ]); if ($ipv6netDB->wasChanged()) { - d_echo('IPV6: Update DB ipv6_networks'); + Log::debug('IPV6: Update DB ipv6_networks'); } $ipv6_network_id = Ipv6Network::where('ipv6_network', $ipv6_network)->where('context_name', $context_name)->value('ipv6_network_id'); if ($ipv6_network_id) { - d_echo('IPV6: Found network id: ' . $ipv6_network_id); + Log::debug('IPV6: Found network id: ' . $ipv6_network_id); $ipv6adrDB = Ipv6Address::updateOrCreate([ 'ipv6_address' => $ipv6_address, @@ -411,7 +413,7 @@ function discover_process_ipv6(&$valid, $ifIndex, $ipv6_address, $ipv6_prefixlen ]); if ($ipv6adrDB->wasChanged()) { - d_echo('IPV6: Update DB ipv6_addresses'); + Log::debug('IPV6: Update DB ipv6_addresses'); } $full_address = "$ipv6_address/$ipv6_prefixlen"; @@ -440,7 +442,7 @@ function discover_process_ipv4(&$valid_v4, $device, int $ifIndex, $ipv4_address, try { $ipv4 = new IPv4($ipv4_address . '/' . $cidr); } catch (InvalidIpException $e) { - d_echo('Invalid data: ' . $ipv4_address); + Log::debug('Invalid data: ' . $ipv4_address); return; } @@ -486,7 +488,7 @@ function discover_process_ipv4(&$valid_v4, $device, int $ifIndex, $ipv4_address, $full_address = $ipv4_address . '/' . $cidr . '|' . $ifIndex; $valid_v4[$full_address] = 1; } else { - d_echo('No port id found for ifindex: ' . $ifIndex . PHP_EOL); + Log::debug('No port id found for ifindex: ' . $ifIndex . PHP_EOL); } } } @@ -505,7 +507,7 @@ function check_entity_sensor($string, $device) foreach ($fringe as $bad) { if (preg_match($bad . 'i', $string)) { - d_echo("Ignored entity sensor: $bad : $string"); + Log::debug("Ignored entity sensor: $bad : $string"); return false; } @@ -598,7 +600,7 @@ function ignore_storage($os, $descr) { foreach (Config::getCombined($os, 'ignore_mount') as $im) { if ($im == $descr) { - d_echo("ignored $descr (matched: $im)\n"); + Log::debug("ignored $descr (matched: $im)\n"); return true; } @@ -606,7 +608,7 @@ function ignore_storage($os, $descr) foreach (Config::getCombined($os, 'ignore_mount_string') as $ims) { if (Str::contains($descr, $ims)) { - d_echo("ignored $descr (matched: $ims)\n"); + Log::debug("ignored $descr (matched: $ims)\n"); return true; } @@ -614,7 +616,7 @@ function ignore_storage($os, $descr) foreach (Config::getCombined($os, 'ignore_mount_regexp') as $imr) { if (preg_match($imr, $descr)) { - d_echo("ignored $descr (matched: $imr)\n"); + Log::debug("ignored $descr (matched: $imr)\n"); return true; } @@ -639,8 +641,8 @@ function discovery_process($os, $sensor_class, $pre_cache) $sensor_options = $discovery[$sensor_class]['options']; } - d_echo("Dynamic Discovery ($sensor_class): "); - d_echo($discovery[$sensor_class]); + Log::debug("Dynamic Discovery ($sensor_class): "); + Log::debug($discovery[$sensor_class]); foreach ($discovery[$sensor_class]['data'] as $data) { $tmp_name = $data['oid']; @@ -651,8 +653,8 @@ function discovery_process($os, $sensor_class, $pre_cache) $raw_data = (array) $pre_cache[$tmp_name]; - d_echo("Data $tmp_name: "); - d_echo($raw_data); + Log::debug("Data $tmp_name: "); + Log::debug($raw_data); $count = 0; foreach ($raw_data as $index => $snmp_data) { @@ -695,14 +697,14 @@ function discovery_process($os, $sensor_class, $pre_cache) try { $data['num_oid'] = YamlDiscovery::computeNumericalOID($os, $data); } catch (\Exception $e) { - d_echo('Error: We cannot find a numerical OID for ' . $data['value'] . '. Skipping this one...'); + Log::debug('Error: We cannot find a numerical OID for ' . $data['value'] . '. Skipping this one...'); $skippedFromYaml = true; // Because we don't have a num_oid, we have no way to add this sensor. } } if ($skippedFromYaml === false && is_numeric($value)) { - d_echo("Sensor fetched value: $value\n"); + Log::debug("Sensor fetched value: $value\n"); // process the oid (num_oid will contain index or str2num replacement calls) $oid = trim(YamlDiscovery::replaceValues('num_oid', $index, null, $data, [])); @@ -808,7 +810,7 @@ function sensors($types, $os, $pre_cache = []) function build_bgp_peers($device, $data, $peer2) { - d_echo("Peers : $data\n"); + Log::debug("Peers : $data\n"); $remove = [ 'ARISTA-BGP4V2-MIB::aristaBgp4V2PeerRemoteAs.1.', 'ALCATEL-IND1-BGP-MIB::alaBgpPeerAS.', @@ -849,7 +851,7 @@ function build_bgp_peers($device, $data, $peer2) //if ASN is negative -> overflow int32 -> original number is max(INT32) - min(INT32) + 1 + value $peer_as = 4294967296 + $peer_as; } - d_echo("Found peer $peer_ip (AS$peer_as)\n"); + Log::debug("Found peer $peer_ip (AS$peer_as)\n"); $peerlist[] = [ 'ip' => $peer_ip, 'as' => $peer_as, @@ -864,8 +866,8 @@ function build_bgp_peers($device, $data, $peer2) function build_cbgp_peers($device, $peer, $af_data, $peer2) { - d_echo('afi data :: '); - d_echo($af_data); + Log::debug('afi data :: '); + Log::debug($af_data); $af_list = []; foreach ($af_data as $k => $v) { @@ -873,7 +875,7 @@ function build_cbgp_peers($device, $peer, $af_data, $peer2) [,$k] = explode('.', $k, 2); } - d_echo("AFISAFI = $k\n"); + Log::debug("AFISAFI = $k\n"); $afisafi_tmp = explode('.', $k); if ($device['os_group'] === 'vrp') { @@ -984,7 +986,7 @@ function can_skip_discovery($sysName, $sysDescr = '', $platform = '') if ($sysName) { foreach ((array) Config::get('autodiscovery.xdp_exclude.sysname_regexp') as $needle) { if (preg_match($needle . 'i', $sysName)) { - d_echo("$sysName - regexp '$needle' matches '$sysName' - skipping device discovery \n"); + Log::debug("$sysName - regexp '$needle' matches '$sysName' - skipping device discovery \n"); return true; } @@ -994,7 +996,7 @@ function can_skip_discovery($sysName, $sysDescr = '', $platform = '') if ($sysDescr) { foreach ((array) Config::get('autodiscovery.xdp_exclude.sysdesc_regexp') as $needle) { if (preg_match($needle . 'i', $sysDescr)) { - d_echo("$sysName - regexp '$needle' matches '$sysDescr' - skipping device discovery \n"); + Log::debug("$sysName - regexp '$needle' matches '$sysDescr' - skipping device discovery \n"); return true; } @@ -1004,7 +1006,7 @@ function can_skip_discovery($sysName, $sysDescr = '', $platform = '') if ($platform) { foreach ((array) Config::get('autodiscovery.cdp_exclude.platform_regexp') as $needle) { if (preg_match($needle . 'i', $platform)) { - d_echo("$sysName - regexp '$needle' matches '$platform' - skipping device discovery \n"); + Log::debug("$sysName - regexp '$needle' matches '$platform' - skipping device discovery \n"); return true; } @@ -1088,7 +1090,7 @@ function find_device_id($name = '', $ip = '', $mac_address = '') if (count($ids) == 1) { return (int) $ids[0]; } elseif (count($ids) > 1) { - d_echo("find_device_id: more than one device found with sysName '$name'.\n"); + Log::debug("find_device_id: more than one device found with sysName '$name'.\n"); // don't do anything, try other methods, if any } } diff --git a/includes/discovery/sensors/state/equallogic.inc.php b/includes/discovery/sensors/state/equallogic.inc.php index cfc025925fc4..848cc1bc9e65 100644 --- a/includes/discovery/sensors/state/equallogic.inc.php +++ b/includes/discovery/sensors/state/equallogic.inc.php @@ -11,10 +11,13 @@ * the source code distribution for details. */ +use Illuminate\Support\Facades\Log; +use LibreNMS\Util\Number; + $oids = snmp_walk($device, 'eqlMemberHealthStatus', '-OQne', 'EQLMEMBER-MIB', 'equallogic'); -d_echo('Health oids:'); -d_echo($oids . "\n"); +Log::debug('Health oids:'); +Log::debug($oids . "\n"); /* eqlMemberHealthStatus @@ -54,7 +57,7 @@ [$oid,$current] = explode(' = ', $data, 2); $split_oid = explode('.', $oid); $num_index = $split_oid[count($split_oid) - 1]; - $index = (int) cast_number($num_index); + $index = (int) Number::cast($num_index); $low_limit = 0.5; $high_limit = 2.5; discover_sensor(null, 'state', $device, $oid, $index, $state_name, $descr, 1, 1, $low_limit, $low_limit, $high_limit, $high_limit, $current, 'snmp', $index); @@ -65,8 +68,8 @@ $oids1 = snmp_walk($device, 'eqlMemberHealthDetailsPowerSupplyName', '-OQn', 'EQLMEMBER-MIB', 'equallogic'); -d_echo('PowerSupplyName oids:'); -d_echo($oids1 . "\n"); +Log::debug('PowerSupplyName oids:'); +Log::debug($oids1 . "\n"); /* .1.3.6.1.4.1.12740.2.1.8.1.2.1.329840783.1 = Power Cooling Module 0 @@ -98,12 +101,12 @@ [$oid,$descr] = explode(' = ', $data, 2); $split_oid = explode('.', $oid); $num_index = $split_oid[count($split_oid) - 1]; - $index = (int) cast_number($num_index); + $index = (int) Number::cast($num_index); $member_id = $split_oid[count($split_oid) - 2]; $num_index = $member_id . '.' . $num_index; $oid = $base_oid . $num_index; $extra = snmp_get_multi($device, $oid, '-OQne', 'EQLMEMBER-MIB', 'equallogic'); - d_echo($extra); + Log::debug($extra); if (! empty($extra)) { [$foid,$pstatus] = explode(' = ', $extra, 2); $index = (100 + $index); @@ -118,8 +121,8 @@ $oids_disks = snmp_walk($device, 'eqlDiskSerialNumber', '-OQn', 'EQLDISK-MIB', 'equallogic'); -d_echo('Disk Serials oids:' . PHP_EOL); -d_echo($oids_disks . "\n"); +Log::debug('Disk Serials oids:' . PHP_EOL); +Log::debug($oids_disks . "\n"); $disks_base_oid = '.1.3.6.1.4.1.12740.3.1.1.1.8.1.'; // eqlDiskStatus @@ -147,7 +150,7 @@ $num_index = $member_id . '.' . $disk_index; $oid = $disks_base_oid . $num_index; $extra = snmp_get($device, $oid, '-OQne', 'EQLDISK-MIB', 'equallogic'); - d_echo($extra); + Log::debug($extra); if (! empty($extra)) { [$foid,$pstatus] = explode(' = ', $extra, 2); $index = 'eqlDiskStatus.' . $disk_index; diff --git a/includes/discovery/sensors/temperature/boss.inc.php b/includes/discovery/sensors/temperature/boss.inc.php index ddc7b3d76ed4..c188e245b78d 100644 --- a/includes/discovery/sensors/temperature/boss.inc.php +++ b/includes/discovery/sensors/temperature/boss.inc.php @@ -1,5 +1,7 @@ */ + +use LibreNMS\Util\Number; + echo 'Port types:'; foreach (['eth100g', 'eth40g', 'eth10g', 'fc16g', 'fc8g'] as $infineratype) { @@ -74,7 +77,7 @@ } // convert to integer - $lindex = cast_number($lindex); + $lindex = Number::cast($lindex); $port_stats[$lindex]['ifName'] = $descr; $port_stats[$lindex]['ifDescr'] = $descr; diff --git a/includes/polling/ports/port-etherlike.inc.php b/includes/polling/ports/port-etherlike.inc.php index e280e3931489..0c51f0400a14 100644 --- a/includes/polling/ports/port-etherlike.inc.php +++ b/includes/polling/ports/port-etherlike.inc.php @@ -1,6 +1,7 @@ addDataset($oid_ds, 'COUNTER', null, 100000000000); - $data = cast_number($this_port[$oid]); + $data = Number::cast($this_port[$oid]); $fields[$oid] = $data; } diff --git a/includes/polling/storage/eql-storage.inc.php b/includes/polling/storage/eql-storage.inc.php index 399bf4ea47ba..a475cd78a10a 100644 --- a/includes/polling/storage/eql-storage.inc.php +++ b/includes/polling/storage/eql-storage.inc.php @@ -12,14 +12,17 @@ * the source code distribution for details. */ +use Illuminate\Support\Facades\Log; +use LibreNMS\Util\Number; + if (! isset($storage_cache1['eql-storage'])) { $storage_cache1['eql-storage'] = snmpwalk_cache_oid($device, 'EqliscsiVolumeEntry', null, 'EQLVOLUME-MIB', 'equallogic'); - d_echo($storage_cache1); + Log::debug($storage_cache1); } if (! isset($storage_cache2['eql-storage'])) { $storage_cache2['eql-storage'] = snmpwalk_cache_oid($device, 'EqliscsiVolumeStatusEntry', null, 'EQLVOLUME-MIB', 'equallogic'); - d_echo($storage_cache2); + Log::debug($storage_cache2); } $iind = 0; @@ -34,13 +37,13 @@ $iind = $index; } else { $arrindex = explode('.', $index); - $iind = (int) cast_number(end($arrindex)); + $iind = (int) Number::cast(end($arrindex)); } if (is_int($iind)) { $storage_cache10[$iind] = $ventry; } } -d_echo($storage_cache10); +Log::debug($storage_cache10); foreach ($storage_cache2['eql-storage'] as $index => $vsentry) { if (! array_key_exists('eqliscsiVolumeStatusAvailable', $vsentry)) { @@ -50,13 +53,13 @@ $iind = $index; } else { $arrindex = explode('.', $index); - $iind = (int) cast_number(end($arrindex)); + $iind = (int) Number::cast(end($arrindex)); } if (is_int($iind)) { $storage_cache20[$iind] = $vsentry; } } -d_echo($storage_cache20); +Log::debug($storage_cache20); $entry1 = $storage_cache10[$storage['storage_index']]; $entry2 = $storage_cache20[$storage['storage_index']]; diff --git a/includes/polling/unix-agent/packages.inc.php b/includes/polling/unix-agent/packages.inc.php index 23093fdeab6d..d2e7a7310400 100644 --- a/includes/polling/unix-agent/packages.inc.php +++ b/includes/polling/unix-agent/packages.inc.php @@ -1,6 +1,7 @@ $arch, 'version' => $version, 'build' => '', - 'size' => cast_number($size) * 1024, + 'size' => Number::cast($size) * 1024, 'status' => 1, ]); },