@@ -99,6 +99,96 @@ <h2 class="text-xl font-semibold mb-4 text-gray-800 dark:text-gray-200">Primary
99
99
</ div >
100
100
</ div >
101
101
102
+ <!-- Advanced Settings (Optional) -->
103
+ < details class ="border border-gray-200 dark:border-gray-700 rounded-lg ">
104
+ < summary class ="px-6 py-4 cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-700/50 transition-colors ">
105
+ < span class ="text-lg font-medium text-gray-800 dark:text-gray-200 "> Advanced Settings (Optional)</ span >
106
+ </ summary >
107
+ < div class ="p-6 pt-0 space-y-4 ">
108
+ < div class ="grid grid-cols-1 md:grid-cols-2 gap-4 ">
109
+ < div >
110
+ < label for ="metric-interval " class ="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1 ">
111
+ Metric Update Interval (ms)
112
+ </ label >
113
+ < input type ="number " id ="metric-interval " name ="metric-interval "
114
+ placeholder ="2000 (default) "
115
+ min ="1000 " max ="60000 "
116
+ class ="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 focus:ring-2 focus:ring-blue-500 focus:border-blue-500 ">
117
+ < p class ="mt-1 text-xs text-gray-500 dark:text-gray-400 "> How often to fetch VM/Container metrics</ p >
118
+ </ div >
119
+
120
+ < div >
121
+ < label for ="discovery-interval " class ="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1 ">
122
+ Discovery Interval (ms)
123
+ </ label >
124
+ < input type ="number " id ="discovery-interval " name ="discovery-interval "
125
+ placeholder ="30000 (default) "
126
+ min ="5000 " max ="300000 "
127
+ class ="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 focus:ring-2 focus:ring-blue-500 focus:border-blue-500 ">
128
+ < p class ="mt-1 text-xs text-gray-500 dark:text-gray-400 "> How often to discover nodes and VMs</ p >
129
+ </ div >
130
+ </ div >
131
+
132
+ <!-- Alert Settings -->
133
+ < div class ="border-t border-gray-200 dark:border-gray-700 pt-4 ">
134
+ < h3 class ="text-md font-medium text-gray-800 dark:text-gray-200 mb-3 "> Alert Settings</ h3 >
135
+
136
+ < div class ="grid grid-cols-2 md:grid-cols-4 gap-4 mb-4 ">
137
+ < label class ="flex items-center ">
138
+ < input type ="checkbox " id ="alert-cpu-enabled " name ="alert-cpu-enabled " checked
139
+ class ="mr-2 rounded border-gray-300 dark:border-gray-600 text-blue-600 focus:ring-blue-500 ">
140
+ < span class ="text-sm text-gray-700 dark:text-gray-300 "> CPU Alerts</ span >
141
+ </ label >
142
+ < label class ="flex items-center ">
143
+ < input type ="checkbox " id ="alert-memory-enabled " name ="alert-memory-enabled " checked
144
+ class ="mr-2 rounded border-gray-300 dark:border-gray-600 text-blue-600 focus:ring-blue-500 ">
145
+ < span class ="text-sm text-gray-700 dark:text-gray-300 "> Memory Alerts</ span >
146
+ </ label >
147
+ < label class ="flex items-center ">
148
+ < input type ="checkbox " id ="alert-disk-enabled " name ="alert-disk-enabled " checked
149
+ class ="mr-2 rounded border-gray-300 dark:border-gray-600 text-blue-600 focus:ring-blue-500 ">
150
+ < span class ="text-sm text-gray-700 dark:text-gray-300 "> Disk Alerts</ span >
151
+ </ label >
152
+ < label class ="flex items-center ">
153
+ < input type ="checkbox " id ="alert-down-enabled " name ="alert-down-enabled " checked
154
+ class ="mr-2 rounded border-gray-300 dark:border-gray-600 text-blue-600 focus:ring-blue-500 ">
155
+ < span class ="text-sm text-gray-700 dark:text-gray-300 "> Down Alerts</ span >
156
+ </ label >
157
+ </ div >
158
+
159
+ < div class ="grid grid-cols-1 md:grid-cols-3 gap-4 ">
160
+ < div >
161
+ < label for ="alert-cpu-threshold " class ="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1 ">
162
+ CPU Alert Threshold (%)
163
+ </ label >
164
+ < input type ="number " id ="alert-cpu-threshold " name ="alert-cpu-threshold "
165
+ placeholder ="85 (default) "
166
+ min ="50 " max ="100 "
167
+ class ="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 focus:ring-2 focus:ring-blue-500 focus:border-blue-500 ">
168
+ </ div >
169
+ < div >
170
+ < label for ="alert-memory-threshold " class ="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1 ">
171
+ Memory Alert Threshold (%)
172
+ </ label >
173
+ < input type ="number " id ="alert-memory-threshold " name ="alert-memory-threshold "
174
+ placeholder ="90 (default) "
175
+ min ="50 " max ="100 "
176
+ class ="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 focus:ring-2 focus:ring-blue-500 focus:border-blue-500 ">
177
+ </ div >
178
+ < div >
179
+ < label for ="alert-disk-threshold " class ="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1 ">
180
+ Disk Alert Threshold (%)
181
+ </ label >
182
+ < input type ="number " id ="alert-disk-threshold " name ="alert-disk-threshold "
183
+ placeholder ="95 (default) "
184
+ min ="50 " max ="100 "
185
+ class ="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 focus:ring-2 focus:ring-blue-500 focus:border-blue-500 ">
186
+ </ div >
187
+ </ div >
188
+ </ div >
189
+ </ div >
190
+ </ details >
191
+
102
192
<!-- PBS Configuration (Optional) -->
103
193
< div class ="border border-gray-200 dark:border-gray-700 rounded-lg p-6 ">
104
194
< h2 class ="text-xl font-semibold mb-4 text-gray-800 dark:text-gray-200 "> Proxmox Backup Server (Optional)</ h2 >
@@ -122,6 +212,16 @@ <h2 class="text-xl font-semibold mb-4 text-gray-800 dark:text-gray-200">Proxmox
122
212
class ="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 focus:ring-2 focus:ring-blue-500 focus:border-blue-500 ">
123
213
</ div >
124
214
215
+ < div >
216
+ < label for ="pbs-node-name " class ="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1 ">
217
+ PBS Node Name
218
+ </ label >
219
+ < input type ="text " id ="pbs-node-name " name ="pbs-node-name "
220
+ placeholder ="Internal hostname (run 'hostname' on PBS) "
221
+ class ="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 focus:ring-2 focus:ring-blue-500 focus:border-blue-500 ">
222
+ < p class ="mt-1 text-xs text-gray-500 dark:text-gray-400 "> Required unless token has Sys.Audit permission</ p >
223
+ </ div >
224
+
125
225
< div >
126
226
< label for ="pbs-token-id " class ="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1 ">
127
227
API Token ID
@@ -301,9 +401,33 @@ <h3 class="text-sm font-medium text-green-800 dark:text-green-200">Success!</h3>
301
401
host : formData . get ( 'pbs-host' ) ,
302
402
port : formData . get ( 'pbs-port' ) || '8007' ,
303
403
tokenId : formData . get ( 'pbs-token-id' ) ,
304
- tokenSecret : formData . get ( 'pbs-token-secret' )
404
+ tokenSecret : formData . get ( 'pbs-token-secret' ) ,
405
+ nodeName : formData . get ( 'pbs-node-name' )
305
406
} ;
306
407
}
408
+
409
+ // Add advanced settings
410
+ config . advanced = {
411
+ metricInterval : formData . get ( 'metric-interval' ) ,
412
+ discoveryInterval : formData . get ( 'discovery-interval' ) ,
413
+ alerts : {
414
+ cpu : {
415
+ enabled : formData . get ( 'alert-cpu-enabled' ) === 'on' ,
416
+ threshold : formData . get ( 'alert-cpu-threshold' )
417
+ } ,
418
+ memory : {
419
+ enabled : formData . get ( 'alert-memory-enabled' ) === 'on' ,
420
+ threshold : formData . get ( 'alert-memory-threshold' )
421
+ } ,
422
+ disk : {
423
+ enabled : formData . get ( 'alert-disk-enabled' ) === 'on' ,
424
+ threshold : formData . get ( 'alert-disk-threshold' )
425
+ } ,
426
+ down : {
427
+ enabled : formData . get ( 'alert-down-enabled' ) === 'on'
428
+ }
429
+ }
430
+ } ;
307
431
308
432
hideMessages ( ) ;
309
433
const button = document . getElementById ( 'save-button' ) ;
@@ -353,6 +477,42 @@ <h3 class="text-sm font-medium text-green-800 dark:text-green-200">Success!</h3>
353
477
document . getElementById ( 'pbs-host' ) . value = config . pbs . host || '' ;
354
478
document . getElementById ( 'pbs-port' ) . value = config . pbs . port || '' ;
355
479
document . getElementById ( 'pbs-token-id' ) . value = config . pbs . tokenId || '' ;
480
+ document . getElementById ( 'pbs-node-name' ) . value = config . pbs . nodeName || '' ;
481
+ }
482
+
483
+ if ( config . advanced ) {
484
+ if ( config . advanced . metricInterval ) {
485
+ document . getElementById ( 'metric-interval' ) . value = config . advanced . metricInterval ;
486
+ }
487
+ if ( config . advanced . discoveryInterval ) {
488
+ document . getElementById ( 'discovery-interval' ) . value = config . advanced . discoveryInterval ;
489
+ }
490
+
491
+ // Load alert settings
492
+ if ( config . advanced . alerts ) {
493
+ const alerts = config . advanced . alerts ;
494
+ if ( alerts . cpu !== undefined ) {
495
+ document . getElementById ( 'alert-cpu-enabled' ) . checked = alerts . cpu . enabled !== false ;
496
+ if ( alerts . cpu . threshold ) {
497
+ document . getElementById ( 'alert-cpu-threshold' ) . value = alerts . cpu . threshold ;
498
+ }
499
+ }
500
+ if ( alerts . memory !== undefined ) {
501
+ document . getElementById ( 'alert-memory-enabled' ) . checked = alerts . memory . enabled !== false ;
502
+ if ( alerts . memory . threshold ) {
503
+ document . getElementById ( 'alert-memory-threshold' ) . value = alerts . memory . threshold ;
504
+ }
505
+ }
506
+ if ( alerts . disk !== undefined ) {
507
+ document . getElementById ( 'alert-disk-enabled' ) . checked = alerts . disk . enabled !== false ;
508
+ if ( alerts . disk . threshold ) {
509
+ document . getElementById ( 'alert-disk-threshold' ) . value = alerts . disk . threshold ;
510
+ }
511
+ }
512
+ if ( alerts . down !== undefined ) {
513
+ document . getElementById ( 'alert-down-enabled' ) . checked = alerts . down . enabled !== false ;
514
+ }
515
+ }
356
516
}
357
517
}
358
518
} catch ( error ) {
0 commit comments