Add "Copy host list (JSON)" button to WATO folder pages

Copies hostname, alias, IPv4 address and monitored site for every
host in the list (folder browsing or host search results) to the
clipboard as JSON.
This commit is contained in:
Luigi D'Acunto 2026-07-31 12:11:26 +02:00
parent 5fa0506bdd
commit a5f7b1a934
3 changed files with 106 additions and 1 deletions

View file

@ -31,6 +31,7 @@ A [Tampermonkey](https://www.tampermonkey.net/) userscript that enhances the Che
| **Site Status Filters** | Adds Disabled / Online / Timeout / Not running toggle buttons below "Add connection" to quickly filter the site connections list | `addSitesFilterBar` |
| **ListChoice Filter Bar** | Adds a search box, a "N / total selected" counter and a "Selected only" toggle above large checkbox lists (e.g. "Deploy custom files with agent") | `addListChoiceFilter` |
| **Extra Column Toggle** | Adds an ON/OFF button to the menu bar to show/hide the Extra column; the choice is remembered across reloads | `addExtraColumnToggle` |
| **Copy Host List (JSON)** | Adds a button to the menu bar that copies hostname, alias, IPv4 address and monitored site for every host in the list to the clipboard as JSON | `addHostListCopyButton` |
---
@ -159,6 +160,13 @@ Checkmk's native checkbox-list widget (used by rules like "Deploy custom files w
Applies to: any WATO rule editor page containing a large checkbox-list value (with or without sidebar).
---
### Copy Host List (JSON)
Adds a **"Copy host list (JSON)"** button to the menu bar on any WATO host-list page — plain folder browsing or host search results. Clicking it copies hostname, alias, IPv4 address and monitored site for every host currently listed to the clipboard as a JSON array, ready to paste into a script, ticket, or spreadsheet.
Applies to: `wato.py?mode=folder` (folder browsing and host search results, with or without sidebar).
## How it works
The script injects enhancements at page load and re-applies them on SPA navigation (Checkmk reloads content inside an `<iframe>` without a full page reload). Each feature is independent — a feature that does not apply to the current page does nothing and stops polling.