@@ -11,14 +11,14 @@ async function fetchTargetData() {
1111 data . active_targets . forEach ( target => {
1212 const row = document . createElement ( 'tr' ) ;
1313
14- const instanceCell = document . createElement ( 'td' ) ;
15- instanceCell . textContent = target . labels . instance ;
16- row . appendChild ( instanceCell ) ;
17-
1814 const jobCell = document . createElement ( 'td' ) ;
1915 jobCell . textContent = target . labels . job ;
2016 row . appendChild ( jobCell ) ;
2117
18+ const instanceCell = document . createElement ( 'td' ) ;
19+ instanceCell . textContent = target . labels . instance ;
20+ row . appendChild ( instanceCell ) ;
21+
2222 const healthCell = document . createElement ( 'td' ) ;
2323 healthCell . textContent = target . health ;
2424 healthCell . className = target . health === 'up' ? 'health-up' : 'health-down' ;
@@ -40,6 +40,11 @@ async function fetchTargetData() {
4040 scrapeDurationCell . textContent = target . lastScrapeDuration . toFixed ( 3 ) ;
4141 row . appendChild ( scrapeDurationCell ) ;
4242
43+ // __scrape_interval__
44+ const scrapeIntervalCell = document . createElement ( 'td' ) ;
45+ scrapeIntervalCell . textContent = target . discoveredLabels . __scrape_interval__ ;
46+ row . appendChild ( scrapeIntervalCell ) ;
47+
4348 if ( target . health === 'up' ) {
4449 const dashboardCell = document . createElement ( 'td' ) ;
4550 const dashboardLink = document . createElement ( 'a' ) ;
@@ -54,6 +59,40 @@ async function fetchTargetData() {
5459 row . appendChild ( emptyCell ) ;
5560 }
5661
62+ // remove the instance from the prometheus
63+
64+ const removeCell = document . createElement ( 'td' ) ;
65+ const removeForm = document . createElement ( 'form' ) ;
66+ removeForm . action = '/targets/remove_target' ; // Replace with actual endpoint if needed
67+ removeForm . method = 'POST' ;
68+ removeForm . style . display = 'inline' ;
69+
70+ const jobNameInput = document . createElement ( 'input' ) ;
71+ jobNameInput . type = 'hidden' ;
72+ jobNameInput . name = 'job_name' ;
73+ jobNameInput . value = target . labels . job ;
74+ removeForm . appendChild ( jobNameInput ) ;
75+
76+ const targetToRemoveInput = document . createElement ( 'input' ) ;
77+ targetToRemoveInput . type = 'hidden' ;
78+ targetToRemoveInput . name = 'target_to_remove' ;
79+ targetToRemoveInput . value = target . labels . instance ;
80+ removeForm . appendChild ( targetToRemoveInput ) ;
81+
82+ const submitButton = document . createElement ( 'input' ) ;
83+ submitButton . type = 'submit' ;
84+ submitButton . value = 'Remove' ;
85+ submitButton . onclick = function ( ) {
86+ return confirm ( 'Are you sure you want to remove this target?' ) ;
87+ } ;
88+ removeForm . appendChild ( submitButton ) ;
89+
90+ removeCell . appendChild ( removeForm ) ;
91+ row . appendChild ( removeCell ) ;
92+
93+ // Append the row to the table body
94+ targetTableBody . appendChild ( row ) ;
95+
5796 // Append the row to the table body
5897 targetTableBody . appendChild ( row ) ;
5998 } ) ;
0 commit comments