id = "zabbix-cli" name = "Zabbix-cli" homepage = "https://github.com/unioslo/zabbix-cli" description = "A command line interface for performing common administrative tasks in Zabbix via the Zabbix API." # zabbix-cli publishes no mark of its own; this is the logo of Zabbix, the # service it drives. icon = "theSVG:zabbix" executables = ["zabbix-cli"] [dotfiles] # https://unioslo.github.io/zabbix-cli/guide/configuration/ lists the search # order per platform; zabbix_cli/config/constants.py is where it comes from — # `CONFIG_FILENAME = "zabbix-cli.toml"`, `DEFAULT_CONFIG_FILE = CONFIG_DIR / # CONFIG_FILENAME`, and `CONFIG_PRIORITY` is (current directory, that file, the # system config directory). zabbix_cli/dirs.py defines `CONFIG_DIR = # PlatformDirs(APP_NAME, AUTHOR).user_config_path` with APP_NAME "zabbix-cli" # and AUTHOR "unioslo" (zabbix_cli/__about__.py). platformdirs' user config # directory is $XDG_CONFIG_HOME/zabbix-cli on Linux and # ~/Library/Application Support/zabbix-cli on macOS — that pair is [appData]. # # Windows is spelled out separately because platformdirs inserts the author # there: windows.py's `user_config_dir` returns `user_data_dir`, which is # CSIDL_LOCAL_APPDATA passed through `_append_parts`, and `_append_parts` # prepends the author whenever `appauthor is not False`. So the file is # %LOCALAPPDATA%\unioslo\zabbix-cli\zabbix-cli.toml. (The docs page prints it # without the author segment; the code is what runs.) On Windows the [appData] # line above resolves to %APPDATA%\zabbix-cli, which zabbix-cli does not use, # and the /etc/xdg copy is system-wide and left out. # # zabbix_cli/_v2_compat.py keeps the v2 location alive: `CONFIG_USER_DIR = # os.path.expanduser("~/.zabbix-cli")` with `CONFIG_FILENAME = # "zabbix-cli.conf"`, an INI file read with ConfigParser # (config/utils.py, `load_config_conf`). A consumer skips whichever is absent. paths = [ "[appData]/zabbix-cli/zabbix-cli.toml", "%LOCALAPPDATA%/unioslo/zabbix-cli/zabbix-cli.toml", "~/.zabbix-cli/zabbix-cli.conf", ] exclude = [] # constants.py names three credential files, all under `DATA_DIR` # (`PlatformDirs(...).user_data_path`, which is [dataHome]): `AUTH_TOKEN_FILE = # DATA_DIR / ".zabbix-cli_auth_token"` ("Path to file containing API session # token"), `AUTH_FILE = DATA_DIR / ".zabbix-cli_auth"` ("Path to file # containing user credentials"), and `SESSION_FILE = DATA_DIR / # ".zabbix-cli_session.json"` ("Path to JSON file containing API session IDs"). # Each is a credential end to end. # # The %LOCALAPPDATA%\unioslo copies are the same three files on Windows, where # platformdirs' data directory carries the author segment the way the config # directory does — [dataHome] alone would resolve to %LOCALAPPDATA%\zabbix-cli # and the rule would not run, which for a credential means syncing it in the # clear. The two in the home directory are the v2 spellings: _v2_compat.py has # `AUTH_FILE = Path.home() / ".zabbix-cli_auth"` and `AUTH_TOKEN_FILE = # Path.home() / ".zabbix-cli_auth_token"`. secret = [ "[dataHome]/zabbix-cli/.zabbix-cli_auth", "[dataHome]/zabbix-cli/.zabbix-cli_auth_token", "[dataHome]/zabbix-cli/.zabbix-cli_session.json", "%LOCALAPPDATA%/unioslo/zabbix-cli/.zabbix-cli_auth", "%LOCALAPPDATA%/unioslo/zabbix-cli/.zabbix-cli_auth_token", "%LOCALAPPDATA%/unioslo/zabbix-cli/.zabbix-cli_session.json", "~/.zabbix-cli_auth", "~/.zabbix-cli_auth_token", ] # zabbix-cli.toml is not a whole-file secret — the server URL, output format, # default host groups and export settings are worth carrying — but the [api] # table holds the login. config/model.py's `APIConfig` declares `password: # SecretStr` ("Password for user") and `auth_token: SecretStr` ("API auth # token") beside the plain `url` and `username`. Both spellings of the file, or # the credential is only lifted out on Unix. [[dotfiles.secret_paths]] file = [ "[appData]/zabbix-cli/zabbix-cli.toml", "%LOCALAPPDATA%/unioslo/zabbix-cli/zabbix-cli.toml", ] match = { key_path = ["api.password", "api.auth_token"] } # Every one of these is an absolute path built from this machine's data or log # directory: `AppConfig` declares session_file, auth_token_file, auth_file and # history_file as `Path` fields defaulting to constants.py's `DATA_DIR / …`, # and `LoggingConfig.log_file` defaults to `LOGS_DIR / "zabbix-cli.log"`. The # written file therefore carries this user's home directory and this # platform's directory layout, which is not what the next machine needs. [[dotfiles.machine_lines]] file = [ "[appData]/zabbix-cli/zabbix-cli.toml", "%LOCALAPPDATA%/unioslo/zabbix-cli/zabbix-cli.toml", ] match = { key_path = [ "app.session_file", "app.auth_token_file", "app.auth_file", "app.history_file", "logging.log_file", ] } [commands] format = 1 label = "Run zabbix-cli" description = "Run one zabbix-cli command (for example show_hosts) or a batch file. Command-specific arguments are typed after the command." quality = "ai-draft" parser = { end_of_options = "--", interleave = "permute", long_equals = true, short_attached = false, short_bundles = false } [[commands.source]] id = "readme" kind = "manual" url = "https://github.com/unioslo/zabbix-cli/blob/master/README.md" evidence = """ 2. **Single command**: Run a single command by running `zabbix-cli COMMAND`. This will run the command and print the output. 3. **Batch mode**: Run multiple commands from a file by running `zabbix-cli -f FILE`. The file should contain one command per line. zabbix-cli show_hosts zabbix-cli --format json show_hosts """ [[commands.field]] id = "format" label = "Output format" type = "string" option = ["--format"] suggestions = [{ value = "json", label = "JSON" }] sources = ["readme"] [[commands.field]] id = "batch_file" label = "Batch file" type = "path" path = { kind = "file", role = "input" } option = ["-f"] sources = ["readme"] [[commands.field]] id = "command" label = "Command" type = "string" position = 0 suggestions = [{ value = "show_hosts", label = "show_hosts" }] sources = ["readme"] [[commands.task]] id = "single" label = "Run one command" fields = ["command", "format"] required = ["command"] [[commands.task]] id = "batch" label = "Run a batch file" fields = ["batch_file"] required = ["batch_file"] [[commands.group]] id = "basic" label = "Basic" fields = ["command", "format", "batch_file"]