@@ -4,7 +4,7 @@ discard block |
||
| 4 | 4 | |
| 5 | 5 | class WebServer implements ServiceInterface |
| 6 | 6 | { |
| 7 | - public $webServerStatuses = []; |
|
| 7 | + public $webServerStatuses = [ ]; |
|
| 8 | 8 | |
| 9 | 9 | public function check(): array |
| 10 | 10 | { |
@@ -17,13 +17,13 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | protected function checkNginx() |
| 19 | 19 | { |
| 20 | - $this->webServerStatuses['nginx'] = config('stethoscope.installed_web_servers.nginx') ? |
|
| 20 | + $this->webServerStatuses[ 'nginx' ] = config('stethoscope.installed_web_servers.nginx') ? |
|
| 21 | 21 | exec('systemctl is-active nginx') : null; |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | protected function checkApache() |
| 25 | 25 | { |
| 26 | - $this->webServerStatuses['apache'] = config('stethoscope.installed_web_servers.apache2') ? |
|
| 26 | + $this->webServerStatuses[ 'apache' ] = config('stethoscope.installed_web_servers.apache2') ? |
|
| 27 | 27 | exec('systemctl is-active apache2.service') : null; |
| 28 | 28 | } |
| 29 | 29 | } |
@@ -69,12 +69,12 @@ |
||
| 69 | 69 | if (!$networkStatus && config('stethoscope.monitorable_resources.network')) |
| 70 | 70 | $log .= $this->networkMessage($networkStatus) . "\n"; |
| 71 | 71 | |
| 72 | - if (($webServerStatuses['nginx'] != 'active' && config('stethoscope.monitorable_resources.web_server'))) { |
|
| 73 | - $log .= $this->webServerMessage('nginx', $webServerStatuses['nginx']) . "\n"; |
|
| 72 | + if (($webServerStatuses[ 'nginx' ] != 'active' && config('stethoscope.monitorable_resources.web_server'))) { |
|
| 73 | + $log .= $this->webServerMessage('nginx', $webServerStatuses[ 'nginx' ]) . "\n"; |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | - if (($webServerStatuses['apache'] != 'active' && config('stethoscope.monitorable_resources.web_server'))) { |
|
| 77 | - $log .= $this->webServerMessage('apache', $webServerStatuses['apache']) . "\n"; |
|
| 76 | + if (($webServerStatuses[ 'apache' ] != 'active' && config('stethoscope.monitorable_resources.web_server'))) { |
|
| 77 | + $log .= $this->webServerMessage('apache', $webServerStatuses[ 'apache' ]) . "\n"; |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | if ($hardDiskFreeSpace < config(('stethoscope.thresholds.hard_disk')) && config('stethoscope.monitorable_resources.hard_disk')) |
@@ -60,14 +60,17 @@ discard block |
||
| 60 | 60 | |
| 61 | 61 | $log = ''; |
| 62 | 62 | |
| 63 | - if ($cpuUsage > config(('stethoscope.thresholds.cpu')) && config('stethoscope.monitorable_resources.cpu')) |
|
| 64 | - $log .= $this->cpuMessage($cpuUsage) . "\n"; |
|
| 63 | + if ($cpuUsage > config(('stethoscope.thresholds.cpu')) && config('stethoscope.monitorable_resources.cpu')) { |
|
| 64 | + $log .= $this->cpuMessage($cpuUsage) . "\n"; |
|
| 65 | + } |
|
| 65 | 66 | |
| 66 | - if ($memoryUsage > config(('stethoscope.thresholds.memory')) && config('stethoscope.monitorable_resources.memory')) |
|
| 67 | - $log .= $this->memoryMessage($memoryUsage) . "\n"; |
|
| 67 | + if ($memoryUsage > config(('stethoscope.thresholds.memory')) && config('stethoscope.monitorable_resources.memory')) { |
|
| 68 | + $log .= $this->memoryMessage($memoryUsage) . "\n"; |
|
| 69 | + } |
|
| 68 | 70 | |
| 69 | - if (!$networkStatus && config('stethoscope.monitorable_resources.network')) |
|
| 70 | - $log .= $this->networkMessage($networkStatus) . "\n"; |
|
| 71 | + if (!$networkStatus && config('stethoscope.monitorable_resources.network')) { |
|
| 72 | + $log .= $this->networkMessage($networkStatus) . "\n"; |
|
| 73 | + } |
|
| 71 | 74 | |
| 72 | 75 | if (($webServerStatuses['nginx'] != 'active' && config('stethoscope.monitorable_resources.web_server'))) { |
| 73 | 76 | $log .= $this->webServerMessage('nginx', $webServerStatuses['nginx']) . "\n"; |
@@ -77,14 +80,16 @@ discard block |
||
| 77 | 80 | $log .= $this->webServerMessage('apache', $webServerStatuses['apache']) . "\n"; |
| 78 | 81 | } |
| 79 | 82 | |
| 80 | - if ($hardDiskFreeSpace < config(('stethoscope.thresholds.hard_disk')) && config('stethoscope.monitorable_resources.hard_disk')) |
|
| 81 | - $log .= $this->hardDiskMessage($hardDiskFreeSpace) . "\n"; |
|
| 83 | + if ($hardDiskFreeSpace < config(('stethoscope.thresholds.hard_disk')) && config('stethoscope.monitorable_resources.hard_disk')) { |
|
| 84 | + $log .= $this->hardDiskMessage($hardDiskFreeSpace) . "\n"; |
|
| 85 | + } |
|
| 82 | 86 | |
| 83 | 87 | if ($log != '') { |
| 84 | 88 | $log = $this->timeMessage() . "\n" . $log; |
| 85 | 89 | |
| 86 | - if ($this->storage->exists($file)) |
|
| 87 | - $log = $this->storage->get($file) . "\n \n" . $log; |
|
| 90 | + if ($this->storage->exists($file)) { |
|
| 91 | + $log = $this->storage->get($file) . "\n \n" . $log; |
|
| 92 | + } |
|
| 88 | 93 | |
| 89 | 94 | $this->storage->put($file, $log); |
| 90 | 95 | } |
@@ -64,13 +64,13 @@ discard block |
||
| 64 | 64 | ); |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - if ($resources->contains('memory') || $resourcesIsEmpty) { |
|
| 67 | + if ($resources->contains('memory') || $resourcesIsEmpty) { |
|
| 68 | 68 | $this->info( |
| 69 | 69 | $this->memoryMessage($this->memory->check()) |
| 70 | 70 | ); |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - if ($resources->contains('network') || $resourcesIsEmpty) { |
|
| 73 | + if ($resources->contains('network') || $resourcesIsEmpty) { |
|
| 74 | 74 | $this->info( |
| 75 | 75 | $this->networkMessage($this->network->check()) |
| 76 | 76 | ); |
@@ -80,13 +80,13 @@ discard block |
||
| 80 | 80 | |
| 81 | 81 | if (config('stethoscope.installed_web_servers.nginx')) { |
| 82 | 82 | $this->info( |
| 83 | - $this->webServerMessage('nginx', $webServers['nginx']) |
|
| 83 | + $this->webServerMessage('nginx', $webServers[ 'nginx' ]) |
|
| 84 | 84 | ); |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | if (config('stethoscope.installed_web_servers.apache')) { |
| 88 | 88 | $this->info( |
| 89 | - $this->webServerMessage('apache', $webServers['apache']) |
|
| 89 | + $this->webServerMessage('apache', $webServers[ 'apache' ]) |
|
| 90 | 90 | ); |
| 91 | 91 | } |
| 92 | 92 | |