mirror of
https://github.com/hanzoai/o11y-foundry.git
synced 2026-10-30 18:26:45 +00:00
43 lines
1.1 KiB
Go
43 lines
1.1 KiB
Go
package clickhousekeepertooler
|
|
|
|
import (
|
|
"context"
|
|
"os"
|
|
|
|
"github.com/hanzoai/o11y-foundry/internal/errors"
|
|
root "github.com/hanzoai/o11y-foundry/internal/tooler"
|
|
)
|
|
|
|
var _ root.Tooler = (*clickhouseKeeperTooler)(nil)
|
|
|
|
type clickhouseKeeperTooler struct{}
|
|
|
|
func New() *clickhouseKeeperTooler {
|
|
return &clickhouseKeeperTooler{}
|
|
}
|
|
|
|
func (tooler *clickhouseKeeperTooler) Name() string {
|
|
return "clickhouse-keeper"
|
|
}
|
|
|
|
func (tooler *clickhouseKeeperTooler) Gauge(ctx context.Context) error {
|
|
// Check if clickhouse-keeper command is available
|
|
if err := root.ExecChecker(ctx, "clickhouse-keeper"); err == nil {
|
|
return nil
|
|
}
|
|
|
|
// Fallback: check if the binary exists at the standard location
|
|
binaryPath := "/usr/bin/clickhouse-keeper"
|
|
if _, err := os.Stat(binaryPath); err == nil {
|
|
return nil
|
|
}
|
|
|
|
return errors.Newf(errors.TypeNotFound, "clickhouse-keeper not found: neither command nor binary at %s", binaryPath)
|
|
}
|
|
|
|
func (tooler *clickhouseKeeperTooler) Install(ctx context.Context) error {
|
|
// ClickHouse Keeper is typically installed via package manager
|
|
// Installation instructions would depend on the OS distribution
|
|
return nil
|
|
}
|