@extends('adminlte::page') @section('title', 'Métricas - Sistema de Monitoramento') @section('css') @stop @section('content_header')

Métricas do Sistema

Dashboard Exportar Instalações
@stop @section('content')
Total de Métricas {{ $metricas->total() }}
Instalações Monitoradas {{ $instalacoes->count() }}
Última Coleta @if($metricas->count() > 0) {{ $metricas->first()->coletado_em->diffForHumans() }} @else N/A @endif
Alertas Ativos 0

Métricas Coletadas {{ $metricas->total() }}

@forelse($metricas as $metrica) @empty @endforelse
ID Instalação Métrica Valor Unidade Coletado em Status Ações
{{ $metrica->id }} {{ $metrica->instalacao->nome ?? 'N/A' }} {{ $metricasDisponiveis[$metrica->metrica] ?? $metrica->metrica }}
{{ $metrica->metrica }}
{{ $metrica->valor_formatado }} @if($metrica->unidade) {{ $metrica->unidade }} @else - @endif {{ $metrica->coletado_em->format('d/m/Y H:i:s') }}
{{ $metrica->coletado_em->diffForHumans() }}
@php $status = $this->getMetricaStatus($metrica->valor, $metrica->metrica); @endphp {{ $status['text'] }} Ver

Nenhuma métrica encontrada para os filtros selecionados.
@if($metricas->hasPages()) @endif
@stop @section('css') @stop @section('js') @stop @php // Helper methods para a view function getValorBadgeClass($valor, $metrica) { switch ($metrica) { case 'tempo_resposta_medio': return $valor > 5000 ? 'danger' : ($valor > 2000 ? 'warning' : 'success'); case 'uso_memoria': return $valor > 1000 ? 'danger' : ($valor > 500 ? 'warning' : 'success'); case 'uso_cpu': return $valor > 80 ? 'danger' : ($valor > 60 ? 'warning' : 'success'); case 'erros_por_hora': return $valor > 10 ? 'danger' : ($valor > 5 ? 'warning' : 'success'); default: return 'info'; } } function getMetricaStatus($valor, $metrica) { switch ($metrica) { case 'tempo_resposta_medio': if ($valor > 5000) return ['class' => 'danger', 'icon' => 'exclamation-triangle', 'text' => 'Crítico']; if ($valor > 2000) return ['class' => 'warning', 'icon' => 'clock', 'text' => 'Lento']; return ['class' => 'success', 'icon' => 'check', 'text' => 'OK']; case 'uso_memoria': if ($valor > 1000) return ['class' => 'danger', 'icon' => 'exclamation-triangle', 'text' => 'Alto']; if ($valor > 500) return ['class' => 'warning', 'icon' => 'memory', 'text' => 'Médio']; return ['class' => 'success', 'icon' => 'check', 'text' => 'OK']; case 'uso_cpu': if ($valor > 80) return ['class' => 'danger', 'icon' => 'exclamation-triangle', 'text' => 'Alto']; if ($valor > 60) return ['class' => 'warning', 'icon' => 'microchip', 'text' => 'Médio']; return ['class' => 'success', 'icon' => 'check', 'text' => 'OK']; case 'erros_por_hora': if ($valor > 10) return ['class' => 'danger', 'icon' => 'exclamation-triangle', 'text' => 'Muitos']; if ($valor > 5) return ['class' => 'warning', 'icon' => 'exclamation', 'text' => 'Alguns']; return ['class' => 'success', 'icon' => 'check', 'text' => 'OK']; default: return ['class' => 'info', 'icon' => 'info', 'text' => 'Normal']; } } @endphp