diff --git a/LibreNMS/OS/Coriant.php b/LibreNMS/OS/Coriant.php index 913e66d9a8..a899b3d78b 100644 --- a/LibreNMS/OS/Coriant.php +++ b/LibreNMS/OS/Coriant.php @@ -28,6 +28,7 @@ namespace LibreNMS\OS; use App\Models\Eventlog; use App\Models\TnmsneInfo; use App\Observers\ModuleModelObserver; +use Illuminate\Support\Facades\Log; use LibreNMS\Enum\Severity; use LibreNMS\Interfaces\Data\DataStorageInterface; use LibreNMS\Interfaces\Polling\OSPolling; @@ -36,7 +37,7 @@ class Coriant extends \LibreNMS\OS implements OSPolling { public function pollOS(DataStorageInterface $datastore): void { - echo 'TNMS-NBI-MIB: enmsNETable'; + Log::info('TNMS-NBI-MIB: enmsNETable'); /* * Coriant have done some SQL over SNMP, since we have to populate and update all the tables diff --git a/LibreNMS/OS/Fortigate.php b/LibreNMS/OS/Fortigate.php index 40cd803445..7e1be2ea51 100644 --- a/LibreNMS/OS/Fortigate.php +++ b/LibreNMS/OS/Fortigate.php @@ -26,6 +26,7 @@ namespace LibreNMS\OS; use App\Models\Device; +use Illuminate\Support\Facades\Log; use LibreNMS\Device\WirelessSensor; use LibreNMS\Interfaces\Data\DataStorageInterface; use LibreNMS\Interfaces\Discovery\Sensors\WirelessApCountDiscovery; @@ -52,7 +53,7 @@ class Fortigate extends Fortinet implements if (is_numeric($sessions)) { $rrd_def = RrdDefinition::make()->addDataset('sessions', 'GAUGE', 0, 3000000); - echo "Sessions: $sessions\n"; + Log::info("Sessions: $sessions"); $fields = [ 'sessions' => $sessions, ]; @@ -66,7 +67,7 @@ class Fortigate extends Fortinet implements if (is_numeric($cpu_usage)) { $rrd_def = RrdDefinition::make()->addDataset('LOAD', 'GAUGE', -1, 100); - echo "CPU: $cpu_usage%\n"; + Log::info("CPU: $cpu_usage%"); $fields = [ 'LOAD' => $cpu_usage, ]; diff --git a/LibreNMS/OS/Iosxe.php b/LibreNMS/OS/Iosxe.php index 391089842f..e15d4c5f10 100644 --- a/LibreNMS/OS/Iosxe.php +++ b/LibreNMS/OS/Iosxe.php @@ -29,6 +29,7 @@ namespace LibreNMS\OS; use App\Models\IsisAdjacency; use Illuminate\Support\Arr; use Illuminate\Support\Collection; +use Illuminate\Support\Facades\Log; use LibreNMS\DB\SyncsModels; use LibreNMS\Interfaces\Data\DataStorageInterface; use LibreNMS\Interfaces\Discovery\IsIsDiscovery; @@ -124,7 +125,7 @@ class Iosxe extends Ciscowlc implements $up_count = array_count_values($states)['up'] ?? 0; if ($up_count !== $adjacencies->count()) { - echo 'New Adjacencies, running discovery'; + Log::info('New Adjacencies, running discovery'); return $this->fillNew($adjacencies, $this->discoverIsIs()); } diff --git a/LibreNMS/OS/Junos.php b/LibreNMS/OS/Junos.php index da877dacad..16bc845601 100644 --- a/LibreNMS/OS/Junos.php +++ b/LibreNMS/OS/Junos.php @@ -30,6 +30,7 @@ use App\Models\EntPhysical; use App\Models\Sla; use Carbon\Carbon; use Illuminate\Support\Collection; +use Illuminate\Support\Facades\Log; use LibreNMS\Interfaces\Data\DataStorageInterface; use LibreNMS\Interfaces\Discovery\SlaDiscovery; use LibreNMS\Interfaces\Polling\OSPolling; @@ -190,7 +191,7 @@ class Junos extends \LibreNMS\OS implements SlaDiscovery, OSPolling, SlaPolling $sla->rtt = ($data[$owner][$test]['jnxPingResultsAvgRttUs'] ?? 0) / 1000; $time = Carbon::parse($data[$owner][$test]['jnxPingResultsTime'] ?? null)->toDateTimeString(); - echo 'SLA : ' . $rtt_type . ' ' . $owner . ' ' . $test . '... ' . $sla->rtt . 'ms at ' . $time . "\n"; + Log::info('SLA : ' . $rtt_type . ' ' . $owner . ' ' . $test . '... ' . $sla->rtt . 'ms at ' . $time); $collected = ['rtt' => $sla->rtt]; diff --git a/LibreNMS/OS/Linux.php b/LibreNMS/OS/Linux.php index 8121c6e701..fe78768329 100644 --- a/LibreNMS/OS/Linux.php +++ b/LibreNMS/OS/Linux.php @@ -50,8 +50,6 @@ class Linux extends Shared\Unix implements VminfoDiscovery return $vms; } - echo PHP_EOL; - return $this->discoverVmwareVminfo(); } diff --git a/LibreNMS/OS/Netscaler.php b/LibreNMS/OS/Netscaler.php index eb9c61c5e8..d92e2a9ab1 100644 --- a/LibreNMS/OS/Netscaler.php +++ b/LibreNMS/OS/Netscaler.php @@ -25,6 +25,7 @@ namespace LibreNMS\OS; +use Illuminate\Support\Facades\Log; use LibreNMS\Interfaces\Data\DataStorageInterface; use LibreNMS\Interfaces\Polling\OSPolling; use LibreNMS\RRD\RrdDefinition; @@ -33,7 +34,7 @@ class Netscaler extends \LibreNMS\OS implements OSPolling { public function pollOS(DataStorageInterface $datastore): void { - echo ' IP'; + Log::info('IP:'); // These are at the start of large trees that we don't want to walk the entirety of, so we snmp_get_multi them $oids_gauge = [ diff --git a/LibreNMS/OS/Sgos.php b/LibreNMS/OS/Sgos.php index 5c2612b4be..fbebde9b8d 100644 --- a/LibreNMS/OS/Sgos.php +++ b/LibreNMS/OS/Sgos.php @@ -25,6 +25,7 @@ namespace LibreNMS\OS; +use Illuminate\Support\Facades\Log; use LibreNMS\Device\Processor; use LibreNMS\Interfaces\Data\DataStorageInterface; use LibreNMS\Interfaces\Discovery\ProcessorDiscovery; @@ -59,7 +60,7 @@ class Sgos extends OS implements ProcessorDiscovery, OSPolling $datastore->put($this->getDeviceArray(), 'sgos_average_requests', $tags, $fields); $this->enableGraph('sgos_average_requests'); - echo ' HTTP Req Rate'; + Log::info(' HTTP Req Rate'); } if (is_numeric($sgos[0]['sgProxyHttpClientConnections'] ?? null)) { @@ -73,7 +74,7 @@ class Sgos extends OS implements ProcessorDiscovery, OSPolling $datastore->put($this->getDeviceArray(), 'sgos_client_connections', $tags, $fields); $this->enableGraph('sgos_client_connections'); - echo ' Client Conn'; + Log::info(' Client Conn'); } if (is_numeric($sgos[0]['sgProxyHttpServerConnections'] ?? null)) { @@ -87,7 +88,7 @@ class Sgos extends OS implements ProcessorDiscovery, OSPolling $datastore->put($this->getDeviceArray(), 'sgos_server_connections', $tags, $fields); $this->enableGraph('sgos_server_connections'); - echo ' Server Conn'; + Log::info(' Server Conn'); } if (is_numeric($sgos[0]['sgProxyHttpClientConnectionsActive'] ?? null)) { @@ -101,7 +102,7 @@ class Sgos extends OS implements ProcessorDiscovery, OSPolling $datastore->put($this->getDeviceArray(), 'sgos_client_connections_active', $tags, $fields); $this->enableGraph('sgos_client_connections_active'); - echo ' Client Conn Active'; + Log::info(' Client Conn Active'); } if (is_numeric($sgos[0]['sgProxyHttpServerConnectionsActive'] ?? null)) { @@ -115,7 +116,7 @@ class Sgos extends OS implements ProcessorDiscovery, OSPolling $datastore->put($this->getDeviceArray(), 'sgos_server_connections_active', $tags, $fields); $this->enableGraph('sgos_server_connections_active'); - echo ' Server Conn Active'; + Log::info(' Server Conn Active'); } if (is_numeric($sgos[0]['sgProxyHttpClientConnectionsIdle'] ?? null)) { @@ -129,7 +130,7 @@ class Sgos extends OS implements ProcessorDiscovery, OSPolling $datastore->put($this->getDeviceArray(), 'sgos_client_connections_idle', $tags, $fields); $this->enableGraph('sgos_client_connections_idle'); - echo ' Client Conne Idle'; + Log::info(' Client Conne Idle'); } if (is_numeric($sgos[0]['sgProxyHttpServerConnectionsIdle'] ?? null)) { @@ -143,7 +144,7 @@ class Sgos extends OS implements ProcessorDiscovery, OSPolling $datastore->put($this->getDeviceArray(), 'sgos_server_connections_idle', $tags, $fields); $this->enableGraph('sgos_server_connections_idle'); - echo ' Server Conn Idle'; + Log::info(' Server Conn Idle'); } } diff --git a/LibreNMS/OS/Shared/Cisco.php b/LibreNMS/OS/Shared/Cisco.php index d6582dc03b..94f3babad9 100755 --- a/LibreNMS/OS/Shared/Cisco.php +++ b/LibreNMS/OS/Shared/Cisco.php @@ -33,6 +33,7 @@ use App\Models\PortsNac; use App\Models\Sla; use Illuminate\Support\Arr; use Illuminate\Support\Collection; +use Illuminate\Support\Facades\Log; use LibreNMS\Device\Processor; use LibreNMS\Interfaces\Discovery\MempoolsDiscovery; use LibreNMS\Interfaces\Discovery\OSDiscovery; @@ -504,7 +505,7 @@ class Cisco extends OS implements // Use Nagios Status codes. 0: Good, 2: Critical $sla->opstatus = $data[$sla_nr]['rttMonLatestRttOperSense'] == 1 ? 0 : 2; - echo 'SLA ' . $sla_nr . ': ' . $rtt_type . ' ' . $sla['owner'] . ' ' . $sla['tag'] . '... ' . $sla->rtt . 'ms at ' . $time . "\n"; + Log::info('SLA ' . $sla_nr . ': ' . $rtt_type . ' ' . $sla['owner'] . ' ' . $sla['tag'] . '... ' . $sla->rtt . 'ms at ' . $time); $collected = ['rtt' => $sla->rtt]; diff --git a/LibreNMS/OS/Traits/HostResources.php b/LibreNMS/OS/Traits/HostResources.php index 86ce4147d8..7122242bd2 100644 --- a/LibreNMS/OS/Traits/HostResources.php +++ b/LibreNMS/OS/Traits/HostResources.php @@ -29,6 +29,7 @@ use App\Models\Mempool; use Closure; use Exception; use Illuminate\Support\Collection; +use Illuminate\Support\Facades\Log; use Illuminate\Support\Str; use LibreNMS\Device\Processor; use Rrd; @@ -70,7 +71,7 @@ trait HostResources */ public function discoverProcessors() { - echo 'Host Resources: '; + Log::info('Host Resources: '); $processors = []; try { diff --git a/LibreNMS/OS/Traits/UcdResources.php b/LibreNMS/OS/Traits/UcdResources.php index d13b0b71c4..3dc37cf617 100644 --- a/LibreNMS/OS/Traits/UcdResources.php +++ b/LibreNMS/OS/Traits/UcdResources.php @@ -27,6 +27,7 @@ namespace LibreNMS\OS\Traits; use App\Models\Mempool; use Illuminate\Support\Collection; +use Illuminate\Support\Facades\Log; use LibreNMS\Device\Processor; trait UcdResources @@ -39,7 +40,7 @@ trait UcdResources */ public function discoverProcessors() { - echo 'UCD Resources: '; + Log::info('UCD Resources: '); return [ Processor::discover( diff --git a/LibreNMS/OS/Traits/VminfoLibvirt.php b/LibreNMS/OS/Traits/VminfoLibvirt.php index 8e2d1de236..868f90968f 100644 --- a/LibreNMS/OS/Traits/VminfoLibvirt.php +++ b/LibreNMS/OS/Traits/VminfoLibvirt.php @@ -35,10 +35,10 @@ trait VminfoLibvirt { public function discoverVminfo(): Collection { - echo 'LibVirt VM: '; + Log::info('LibVirt VM: '); if (! Config::get('enable_libvirt')) { - echo 'not configured'; + Log::info('not configured'); return new Collection; } diff --git a/LibreNMS/OS/Traits/VminfoVmware.php b/LibreNMS/OS/Traits/VminfoVmware.php index afc0c5a83a..bfcf18c3c3 100644 --- a/LibreNMS/OS/Traits/VminfoVmware.php +++ b/LibreNMS/OS/Traits/VminfoVmware.php @@ -27,13 +27,14 @@ namespace LibreNMS\OS\Traits; use App\Models\Vminfo; use Illuminate\Support\Collection; +use Illuminate\Support\Facades\Log; use LibreNMS\Enum\PowerState; trait VminfoVmware { public function discoverVmInfo(): Collection { - echo 'VMware VM: '; + Log::info('VMware VM: '); /* * Fetch the Virtual Machine information. diff --git a/LibreNMS/OS/Vrp.php b/LibreNMS/OS/Vrp.php index 77bd961375..750899bba3 100644 --- a/LibreNMS/OS/Vrp.php +++ b/LibreNMS/OS/Vrp.php @@ -35,6 +35,7 @@ use App\Observers\ModuleModelObserver; use Carbon\Carbon; use Illuminate\Support\Arr; use Illuminate\Support\Collection; +use Illuminate\Support\Facades\Log; use Illuminate\Support\Str; use LibreNMS\DB\SyncsModels; use LibreNMS\Device\Processor; @@ -564,7 +565,7 @@ class Vrp extends OS implements $sla->rtt = ($data[$owner][$test]['pingResultsAverageRtt'] ?? 0) / $divisor; $time = Carbon::parse($data[$owner][$test]['pingResultsLastGoodProbe'] ?? null)->toDateTimeString(); - echo 'SLA : ' . $rtt_type . ' ' . $owner . ' ' . $test . '... ' . $sla->rtt . 'ms at ' . $time . "\n"; + Log::info('SLA : ' . $rtt_type . ' ' . $owner . ' ' . $test . '... ' . $sla->rtt . 'ms at ' . $time); $collected = ['rtt' => $sla->rtt];