142 lines
6.6 KiB
PHP
142 lines
6.6 KiB
PHP
@extends('layouts.app')
|
|||
|
|
|
||
|
|
@section('title', 'Add Health Check - ' . $site->name)
|
||
|
|
|
||
|
|
@section('content')
|
||
|
|
<div class="mb-3">
|
||
|
|
<nav aria-label="breadcrumb">
|
||
|
|
<ol class="breadcrumb">
|
||
|
|
<li class="breadcrumb-item"><a href="{{ route('sites.index') }}">Sites</a></li>
|
||
|
|
<li class="breadcrumb-item"><a href="{{ route('dashboard.show', $site) }}">{{ $site->name }}</a></li>
|
||
|
|
<li class="breadcrumb-item"><a href="{{ route('health-checks.index', $site) }}">Health Checks</a></li>
|
||
|
|
<li class="breadcrumb-item active">Add Health Check</li>
|
||
|
|
</ol>
|
||
|
|
</nav>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="row">
|
||
|
|
<div class="col-md-8">
|
||
|
|
<h1 class="mb-4"><i class="bi bi-plus-circle"></i> Add Health Check</h1>
|
||
|
|
|
||
|
|
<div class="card">
|
||
|
|
<div class="card-body">
|
||
|
|
<form action="{{ route('health-checks.store', $site) }}" method="POST">
|
||
|
|
@csrf
|
||
|
|
|
||
|
|
<div class="mb-3">
|
||
|
|
<label for="endpoint" class="form-label">Health Endpoint Path</label>
|
||
|
|
<div class="input-group">
|
||
|
|
<span class="input-group-text">{{ rtrim($site->url, '/') }}/</span>
|
||
|
|
<input type="text"
|
||
|
|
class="form-control @error('endpoint') is-invalid @enderror"
|
||
|
|
id="endpoint"
|
||
|
|
name="endpoint"
|
||
|
|
value="{{ old('endpoint') }}"
|
||
|
|
placeholder="health"
|
||
|
|
required>
|
||
|
|
@error('endpoint')
|
||
|
|
<div class="invalid-feedback">{{ $message }}</div>
|
||
|
|
@enderror
|
||
|
|
</div>
|
||
|
|
<div class="form-text">Enter the path to your health check endpoint (e.g., "health", "api/health", "status").</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="mb-3">
|
||
|
|
<label for="expected_json_keys" class="form-label">Expected JSON Keys (Optional)</label>
|
||
|
|
<input type="text"
|
||
|
|
class="form-control @error('expected_json_keys') is-invalid @enderror"
|
||
|
|
id="expected_json_keys"
|
||
|
|
name="expected_json_keys"
|
||
|
|
value="{{ old('expected_json_keys') }}"
|
||
|
|
placeholder="status, database, cache">
|
||
|
|
@error('expected_json_keys')
|
||
|
|
<div class="invalid-feedback">{{ $message }}</div>
|
||
|
|
@enderror
|
||
|
|
<div class="form-text">
|
||
|
|
Comma-separated list of JSON keys that must be present in the response. Supports dot notation for nested keys (e.g., "data.status, meta.version").
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="mb-3">
|
||
|
|
<label for="performance_threshold" class="form-label">Performance Threshold (Optional)</label>
|
||
|
|
<div class="input-group">
|
||
|
|
<input type="number"
|
||
|
|
class="form-control @error('performance_threshold') is-invalid @enderror"
|
||
|
|
id="performance_threshold"
|
||
|
|
name="performance_threshold"
|
||
|
|
value="{{ old('performance_threshold') }}"
|
||
|
|
min="1"
|
||
|
|
max="60000"
|
||
|
|
placeholder="1000">
|
||
|
|
<span class="input-group-text">ms</span>
|
||
|
|
@error('performance_threshold')
|
||
|
|
<div class="invalid-feedback">{{ $message }}</div>
|
||
|
|
@enderror
|
||
|
|
</div>
|
||
|
|
<div class="form-text">
|
||
|
|
Alert when response time exceeds this threshold in milliseconds. Leave empty to disable performance alerts.
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="mb-3">
|
||
|
|
<div class="form-check">
|
||
|
|
<input type="checkbox"
|
||
|
|
class="form-check-input"
|
||
|
|
id="is_active"
|
||
|
|
name="is_active"
|
||
|
|
value="1"
|
||
|
|
{{ old('is_active', true) ? 'checked' : '' }}>
|
||
|
|
<label class="form-check-label" for="is_active">
|
||
|
|
Enable monitoring for this health check
|
||
|
|
</label>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="d-flex gap-2">
|
||
|
|
<button type="submit" class="btn btn-primary">
|
||
|
|
<i class="bi bi-check-circle"></i> Add Health Check
|
||
|
|
</button>
|
||
|
|
<a href="{{ route('health-checks.index', $site) }}" class="btn btn-secondary">
|
||
|
|
Cancel
|
||
|
|
</a>
|
||
|
|
</div>
|
||
|
|
</form>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="col-md-4">
|
||
|
|
<div class="card">
|
||
|
|
<div class="card-header">
|
||
|
|
<h5 class="mb-0"><i class="bi bi-info-circle"></i> Health Check Guide</h5>
|
||
|
|
</div>
|
||
|
|
<div class="card-body">
|
||
|
|
<h6>What is a Health Check?</h6>
|
||
|
|
<p class="small">
|
||
|
|
A health check endpoint is a URL that returns information about your application's status, including database connectivity, cache availability, and other critical services.
|
||
|
|
</p>
|
||
|
|
|
||
|
|
<h6 class="mt-3">Common Endpoints</h6>
|
||
|
|
<ul class="small mb-0">
|
||
|
|
<li><code>/health</code></li>
|
||
|
|
<li><code>/api/health</code></li>
|
||
|
|
<li><code>/status</code></li>
|
||
|
|
<li><code>/healthz</code></li>
|
||
|
|
<li><code>/.well-known/health</code></li>
|
||
|
|
</ul>
|
||
|
|
|
||
|
|
<h6 class="mt-3">Response Format</h6>
|
||
|
|
<p class="small mb-0">
|
||
|
|
Your endpoint should return JSON with a 2xx status code when healthy. Example:
|
||
|
|
</p>
|
||
|
|
<pre class="small bg-light p-2 mt-2"><code>{
|
||
|
|
"status": "healthy",
|
||
|
|
"database": "ok",
|
||
|
|
"cache": "ok"
|
||
|
|
}</code></pre>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
@endsection
|