Checkmk Dev Tools
Checkmk Dev Tools is a collection of helper scripts designed for developers working with Checkmk. It provides various utilities to streamline development workflows for Checkmk and related projects. The current version is 2.2.0, and it generally follows the Checkmk project's release cadence, with updates often tied to Checkmk major and patch releases.
Common errors
-
cmk-dev-install: command not found
cause The directory where pip installed the `checkmk-dev-tools` scripts is not in your system's PATH environment variable, or the package was not installed correctly.fixVerify installation with `pip show checkmk-dev-tools`. If installed, locate the script directory (e.g., `python -m site --user-base`/bin on Linux/macOS or `Scripts` in your virtual environment on Windows) and add it to your PATH. For example: `export PATH="$PATH:$(python -m site --user-base)/bin"` in your shell config. -
Error: Python requirements not met: requires Python >=3.10.4, <4.0.0
cause You are attempting to use `checkmk-dev-tools` with an incompatible Python version.fixEnsure you are running Python 3.10.4 or higher, but less than Python 4.0.0. Use a virtual environment to manage specific Python versions if needed. For example, `pyenv install 3.11.8 && pyenv local 3.11.8`. -
ValueError: Invalid site ID
cause A `checkmk-dev-tools` script was invoked with an invalid or incorrectly formatted Checkmk site ID.fixReview the specific script's documentation or `--help` output for expected site ID formats and allowed characters. Ensure the site ID exists and is accessible to the user running the script.
Warnings
- gotcha The `checkmk-dev-tools` package installs command-line scripts. These scripts need to be available in your system's PATH environment variable to be executable directly. Installation via pip does not always automatically add scripts to a universally accessible PATH.
- breaking Checkmk major version upgrades often introduce breaking changes in APIs or internal structures that Checkmk development tools might rely on. Tools might become incompatible or behave unexpectedly with newer Checkmk versions.
- gotcha Output from the scripts can vary significantly based on the Checkmk environment they are executed against (e.g., site version, configuration). Scripts are often designed for specific Checkmk versions or setups.
Install
-
pip install checkmk-dev-tools
Imports
- checkmk-dev-tools
This package primarily provides command-line tools, not Python modules for direct import. After installation, scripts are typically accessed via the system PATH.
Quickstart
# Example: Assuming 'cmk-dev-install' is one of the scripts installed and available in PATH
import subprocess
import os
# Note: The actual tools and their arguments depend on the specific scripts
# within the checkmk-dev-tools package and their intended functionality.
# This is a generic example demonstrating how to execute a command-line tool.
# Example of executing a hypothetical 'cmk-dev-info' tool to get version info
# You might need to adjust the command based on actual tools in the package.
try:
result = subprocess.run(['cmk-dev-install', '--help'], capture_output=True, text=True, check=True)
print("cmk-dev-install --help output:\n", result.stdout)
except FileNotFoundError:
print("Error: 'cmk-dev-install' command not found. Ensure checkmk-dev-tools is installed and in PATH.")
except subprocess.CalledProcessError as e:
print(f"Error executing command: {e}")
print(f"Stderr: {e.stderr}")