cmd

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 17, 2026 License: Apache-2.0 Imports: 22 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Version   = "0.2.0-dev"
	Commit    = "none"
	BuildDate = "unknown"
)
View Source
var RootCmd = &cobra.Command{
	Use:   "zbxctl",
	Short: "zbxctl - AI-Agent Friendly Zabbix 7 CLI",
	Long: `zbxctl is a high-performance command-line tool tailored for both human engineers and AI coding agents.
It provides a Tier 1 ergonomic verb-noun interface for common operations and a Tier 2 raw JSON-RPC engine for 100% Zabbix 7 API coverage.`,
	PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
		cfgPath, err := getConfigPath(cmd)
		if err != nil {
			return err
		}
		cfg, err = config.LoadConfig(cfgPath)
		if err != nil {
			return fmt.Errorf("failed to load config: %w", err)
		}

		if contextFlag != "" {
			cfg.ActiveContext = contextFlag
		}

		activeCtx, actCtxName, err = cfg.GetActiveContext()
		if err != nil {

			def := config.DefaultConfig()
			cfg = def
			activeCtx, actCtxName, _ = cfg.GetActiveContext()
		}

		if safetyFlag != "" {
			activeCtx.SafetyLevel = safetyFlag
		}
		if outputFlag != "" {
			activeCtx.OutputFormat = outputFlag
		}

		formatter = output.NewFormatter(activeCtx.OutputFormat)
		if cmd != nil && cmd.OutOrStdout() != nil {
			formatter.Writer = cmd.OutOrStdout()
		}
		zbxClient = zabbix.NewClient(activeCtx)

		return nil
	},
}

Functions

func Execute

func Execute()

func ResetCommandFlags

func ResetCommandFlags(cmd *cobra.Command)

Types

type ClusterInfoReport added in v0.2.0

type ClusterInfoReport struct {
	Context        string `json:"context"`
	ZabbixVersion  string `json:"zabbix_version"`
	SafetyLevel    string `json:"safety_level"`
	TotalHosts     int    `json:"total_hosts"`
	TotalProblems  int    `json:"total_problems"`
	TotalItems     int    `json:"total_items"`
	TotalTriggers  int    `json:"total_triggers"`
	TotalTemplates int    `json:"total_templates"`
}

type CommandExport

type CommandExport struct {
	Tool         string     `json:"tool"`
	Version      string     `json:"version"`
	Description  string     `json:"description"`
	SafetyLevels []string   `json:"safety_levels"`
	Verbs        []VerbTree `json:"verbs"`
	RawEngine    string     `json:"raw_engine"`
}

type CommandMeta

type CommandMeta struct {
	Name        string   `json:"name"`
	Aliases     []string `json:"aliases,omitempty"`
	Description string   `json:"description"`
}

type InventoryReport

type InventoryReport = ClusterInfoReport

InventoryReport is an alias for backwards compatibility

type ManifestItem

type ManifestItem struct {
	Kind     string                 `json:"kind,omitempty" yaml:"kind,omitempty"`
	Resource string                 `json:"resource,omitempty" yaml:"resource,omitempty"`
	Method   string                 `json:"method,omitempty" yaml:"method,omitempty"`
	Params   map[string]interface{} `json:"params,omitempty" yaml:"params,omitempty"`
	Spec     map[string]interface{} `json:"spec,omitempty" yaml:"spec,omitempty"`
}

type VerbTree

type VerbTree struct {
	Verb        string        `json:"verb"`
	Description string        `json:"description"`
	Resources   []CommandMeta `json:"resources,omitempty"`
}

type VersionInfo added in v0.2.0

type VersionInfo struct {
	Version   string `json:"version"`
	Commit    string `json:"commit"`
	BuildDate string `json:"build_date"`
	GoVersion string `json:"go_version"`
	Compiler  string `json:"compiler"`
	Platform  string `json:"platform"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL