-
Notifications
You must be signed in to change notification settings - Fork 0
/
dashboard.html
132 lines (125 loc) · 6.46 KB
/
dashboard.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Monitoring Dashboard</title>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<script src="https://cdn.jsdelivr.net/npm/moment"></script>
<script src="https://cdn.jsdelivr.net/npm/chartjs-adapter-moment"></script>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="container-fluid">
<a class="navbar-brand" href="/dashboard">Monitoring Dashboard</a>
<div class="navbar-nav">
<a class="nav-link" href="/admin">Admin Panel</a>
<a class="nav-link" href="/logout" onclick="return confirm('Are you sure you want to logout?');">Logout</a>
</div>
</div>
</nav>
<div class="container mt-4">
<div class="row mb-4">
<div id="hostSelector" class="col-md-3"></div>
<div class="col-md-3">
<label for="startDate" class="form-label">Start Date:</label>
<input type="datetime-local" id="startDate" class="form-control">
</div>
<div class="col-md-3">
<label for="endDate" class="form-label">End Date:</label>
<input type="datetime-local" id="endDate" class="form-control">
</div>
<div class="col-md-3 d-flex align-items-end">
<div class="btn-group me-2" role="group">
<button id="updateButton" class="btn btn-primary">Update</button>
<button id="removeHostButton" class="btn btn-danger">Remove Host</button>
</div>
<div class="dropdown">
<button class="btn btn-secondary dropdown-toggle" type="button" id="timeRangeDropdown" data-bs-toggle="dropdown" aria-expanded="false">
Time Range
</button>
<ul class="dropdown-menu" aria-labelledby="timeRangeDropdown">
<li><a class="dropdown-item" id="lastRealtimeButton" href="#">Realtime</a></li>
<li><a class="dropdown-item" id="lastHourButton" href="#">Last Hour</a></li>
<li><a class="dropdown-item" id="lastDayButton" href="#">Last Day</a></li>
<li><a class="dropdown-item" id="lastWeekButton" href="#">Last Week</a></li>
<li><a class="dropdown-item" id="lastMonthButton" href="#">Last Month</a></li>
</ul>
</div>
</div>
</div>
<div id="hostInfo" class="alert alert-info mb-4"></div>
<div id="chartContainer" class="row"></div>
<div class="row mt-5">
<div class="col-md-6">
<h2>Alert Configuration</h2>
<div id="alertConfigList" class="mb-4"></div>
<h3>Add New Alert</h3>
<form id="alertForm">
<div id="hostnameField" class="mb-3">
<label for="hostname" class="form-label">Hostname:</label>
<input type="text" id="hostname" name="hostname" class="form-control" required>
</div>
<div class="mb-3">
<label for="metric_name" class="form-label">Metric:</label>
<input type="text" id="metric_name" name="metric_name" class="form-control" required>
</div>
<div class="mb-3">
<label for="condition" class="form-label">Condition:</label>
<select id="condition" name="condition" class="form-select" required>
<option value="above">Above</option>
<option value="below">Below</option>
</select>
</div>
<div class="mb-3">
<label for="threshold" class="form-label">Threshold:</label>
<input type="number" id="threshold" name="threshold" class="form-control" required>
</div>
<div class="mb-3">
<label for="duration" class="form-label">Duration (seconds):</label>
<input type="number" id="duration" name="duration" class="form-control" required>
</div>
<button type="submit" class="btn btn-primary">Add Alert</button>
</form>
</div>
<div class="col-md-6">
<h2>Recent Alerts</h2>
<div id="recentAlertsList"></div>
</div>
</div>
<div class="row mt-5">
<div class="col-md-6">
<h2>Downtimes</h2>
<div id="downtimeList" class="mb-4"></div>
<h3>Add New Downtime</h3>
<form id="downtimeForm">
<div id="downtimeHostnameField" class="mb-3">
<label for="downtimeHostname" class="form-label">Hostname:</label>
<input type="text" id="downtimeHostname" name="downtimeHostname" class="form-control" required>
</div>
<div class="mb-3">
<label for="downtimeStart" class="form-label">Start Time:</label>
<input type="datetime-local" id="downtimeStart" name="downtimeStart" class="form-control" required>
</div>
<div class="mb-3">
<label for="downtimeEnd" class="form-label">End Time:</label>
<input type="datetime-local" id="downtimeEnd" name="downtimeEnd" class="form-control" required>
</div>
<button type="submit" class="btn btn-primary">Add Downtime</button>
</form>
</div>
</div>
<div class="row mt-4">
<div class="col-12">
<h3>Metric Messages</h3>
<div id="messageContainer" class="border p-3 bg-light">
<!-- Messages will be displayed here -->
</div>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
<script type="module" src="/dashboard.js"></script>
</body>
</html>