@extends('layouts.app', ['pageSlug' => 'deviceLists']) @section('content')
Monitoring devices

@foreach ($devices as $key => $dev) @php $month_data = $logs->where('receiver',"$dev->name ")->where('month',date('m'))->first(); $month_count = !empty($month_data) ? ($month_data->logcounts*100)/8640 : ''; $first = $firstlogs->where('receiver',"$dev->name ")->first(); $count = !empty($first) ? round((strtotime(now()) - strtotime($first->created_at)) / (60 * 60 * 24),2) : 0; $total_data = $logs->where('receiver',"$dev->name ")->sum('logcounts'); $total_count = !empty($total_data) ? ($total_data*100)/($count*288) : ''; $mins = $devicelog->where('device_id',$dev->id); $lastrecord = $mins->whereNull('date_to')->sortByDesc('date_from')->first(); $last_mins = !empty($lastrecord) ? round((strtotime(now()) - strtotime($lastrecord->date_from)) / 60,2) : 0; $totalmins = $mins->sum('mins') + $last_mins; $mincount = round((strtotime(now()) - strtotime("2021-11-24 14:37:14")) / 60,2); $total_mins = ($totalmins*100)/$mincount; @endphp @endforeach
# Name Parent Group Make Model IP Ping CPU Latency Off Log Status Action
{{$key+1}} {{$dev->name}} @if($dev->sector != null){{$dev->type}} @endif {{$dev->parent_name ? $dev->parent_name : 'none'}} {{isset($dev->devicegroup) ? $dev->devicegroup->name : ''}} {{$dev->make_id == 1 ? 'Mikrotik' : 'Other'}} {{$dev->model}} {{$dev->ip}} {{$dev->ping !='timeout' ? $dev->ping.'ms':'timeout'}} {{$dev->cpu != '--' ? $dev->cpu.'%':'--'}} {{round($month_count,2)}}/{{round($total_count,2)}} % {{round($total_mins,2)}}% @if($dev->status == 'up') @else
@endif
@endsection @push('js') @endpush