How can I download a list of worker nodes in JSON format?
I have a big deployment with hundreds of worker nodes. Is there an easy way to download a full list of worker nodes in json format?
Best Answer
-
If you dont have access to the CLI to perform an API call, heres a JavaScript snippet that you can paste into your Browsers Developer Console. Once the Fetch (JavaScripts curl, essentially) resolves, it should download a JSON file with the results.
fetch(`${window.location.origin}/api/v1/master/workers`, { "headers": { "authorization": `Bearer ${localStorage.AUTH_TOKEN}`, }, "body": null, "method": "GET", "mode": "cors", "credentials": "include" }) .then(response => response.blob()) .then(blob => { let url = window.URL.createObjectURL(blob); let a = document.createElement('a'); a.href = url; a.download = 'worker_list.json'; document.body.appendChild(a); a.click(); a.remove(); });
0
Answers
-
If you dont have access to the CLI to perform an API call, heres a JavaScript snippet that you can paste into your Browsers Developer Console. Once the Fetch (JavaScripts curl, essentially) resolves, it should download a JSON file with the results.
fetch(`${window.location.origin}/api/v1/master/workers`, { "headers": { "authorization": `Bearer ${localStorage.AUTH_TOKEN}`, }, "body": null, "method": "GET", "mode": "cors", "credentials": "include" }) .then(response => response.blob()) .then(blob => { let url = window.URL.createObjectURL(blob); let a = document.createElement('a'); a.href = url; a.download = 'worker_list.json'; document.body.appendChild(a); a.click(); a.remove(); });
0 -
I love it when you talk javascript to me.
0 -
You can also do this easily directly from the Cribl GUI. Navigate to the stream → workers page and select the button "Export list as" and choose JSON. You can also export as CSV.
0