From b0252672fad86014cefbff23e6487b66a55cc813 Mon Sep 17 00:00:00 2001 From: Luigi D'Acunto Date: Tue, 25 Aug 2026 12:18:30 +0200 Subject: [PATCH] Add "Copy hosts (JSON)" and "Copy hosts (TSV)" buttons for host list views Adds two buttons to the view.py menu bar that copy hostname (FQDN) and IP for every host on the page to the clipboard, as JSON or as tab-separated lines. Works on views grouped by folder across multiple tables as well as single-table views, and correctly handles views that render 2 hosts per physical row as side-by-side column pairs. --- CHANGELOG.md | 5 + README.md | 8 + user_script/checkmk_swissknife.user.js | 201 +++++++++++++++++++------ 3 files changed, 170 insertions(+), 44 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bf17d74..f71a979 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,11 @@ All notable changes to **Checkmk SwissKnife** are documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [2.21.0] - 2026-08-25 + +### Added +- "Copy hosts (JSON)" and "Copy hosts (TSV)" buttons in the monitoring view menu bar, on any view.py page listing hosts (e.g. "Host search"). Copies hostname (FQDN) and IP for every host on the page — deduplicated, and correctly handling views that render 2 hosts per physical row as side-by-side column pairs — either as JSON or as tab-separated `FQDN\tIP` lines ready to paste into a spreadsheet. + ## [2.20.2] - 2026-08-20 ### Fixed diff --git a/README.md b/README.md index d094ccf..4adda64 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,7 @@ A [Tampermonkey](https://www.tampermonkey.net/) userscript that enhances the Che | **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` | | **Service Export to Markdown** | On any view.py services table (Host + Display name/Service columns), adds a button that exports a Markdown table with whichever of Site/Host/IP/Display name/Summary/Details are present, to the clipboard and as a downloaded `.md` file | `addServiceExportButton` | +| **Copy Hosts (JSON/TSV)** | Adds two buttons to the menu bar on any view.py host list that copy hostname (FQDN) and IP for every host on the page to the clipboard, as JSON or as tab-separated lines | `addHostExportButtons` | --- @@ -176,6 +177,13 @@ On any monitoring view showing a services table — detected structurally by a * Applies to: any `view.py` page with a services table (with or without sidebar). +--- + +### Copy Hosts (JSON/TSV) +Adds **"Copy hosts (JSON)"** and **"Copy hosts (TSV)"** buttons to the menu bar on any monitoring view listing hosts (e.g. "Host search"), whether results are grouped by folder across several tables or shown as a single table. Clicking one copies hostname (FQDN) and IP for every host currently listed to the clipboard — deduplicated — either as a JSON array or as tab-separated `FQDN` / `IP` lines (with a header row) ready to paste into a spreadsheet. + +Applies to: any `view.py` page listing hosts (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 `