@biznetgio/ms
v0.1.0
Published
Biznetgio ManageService CLI
Readme
ms — Biznetgio ManageService CLI
CLI tool for managing Biznetgio ManageService resources including CloudStack and Prometheus.
Installation
npm install -g @biznetgio/ms
# or
bun install -g @biznetgio/msQuick Start
ms config set baseUrl https://your-api-server.com # point to the API
ms auth login # log in
ms key create --name my-key # create API key (auto-stored)
ms cloudstack list # browse CloudStack commands
ms prometheus metrics # browse available metricsConfiguration
ms config # show all config keys and their current values
ms config set <key> <value> # set a value
ms config get [key] # get a value (or all values)
ms config reset # reset everything to defaults| Key | Default | Description |
|---------------|-------------------------|------------------------------------|
| baseUrl | http://localhost:3000 | API server base URL |
| accessKey | (not set) | API key access key |
| secretKey | (not set) | API key secret key |
| jwtToken | (not set) | JWT token (set automatically on login) |
| refreshToken| (not set) | Refresh token (set automatically on login) |
Config is stored at ~/.config/ms/config.json.
baseUrl can also be set via the MS_BASE_URL environment variable, which takes priority over the stored config.
Authentication
ms auth login # log in with username and password (shows current user on success)
ms auth logout # clear stored credentials
ms auth whoami # show the currently logged-in userLogin stores a JWT token automatically. It is used for ms auth, ms key, and ms credentials commands.
API Keys
API keys are used to authenticate CloudStack and Prometheus requests (X-API-Key header).
ms key list # list all API keys with status
ms key create --name <name> # create a new key (access+secret stored automatically)
ms key revoke <id> # disable a key without deleting it
ms key activate <id> # re-enable a revoked key
ms key delete <id> # permanently delete a key (confirmation required)The secret key is shown once on creation and stored to
~/.config/ms/config.json. If you lose it, delete the key and create a new one.
CloudStack
Pass-through interface to the CloudStack API.
Browse available commands
ms cloudstack list # list all 800+ CloudStack API commands
ms cloudstack list --search <term> # filter by name or description
ms cloudstack help <command> # show all parameters for a commandExample:
ms cloudstack list --search virtual
ms cloudstack help deployVirtualMachineRun a command
ms cloudstack run <command> [-p key=value ...]Parameters are passed as repeatable -p key=value pairs.
Examples:
ms cloudstack run listZones
ms cloudstack run listVirtualMachines -p zoneid=abc-123
ms cloudstack run deployVirtualMachine \
-p zoneid=abc-123 \
-p serviceofferingid=def-456 \
-p templateid=ghi-789 \
-p name=my-vmOutput is JSON. For async commands (e.g. deployVirtualMachine), a jobid is returned — poll it with:
ms cloudstack run queryAsyncJobResult -p jobid=<jobid>Prometheus
Query and explore Prometheus metrics.
Browse available metrics
ms prometheus metrics # list all metrics with type and description
ms prometheus metrics --search <term> # filter by name or description
ms prometheus metrics --type <type> # filter by type (counter, gauge, histogram, summary)Example:
ms prometheus metrics --search cpu
ms prometheus metrics --type gaugeInstant query
ms prometheus query <promql> [--time <timestamp>] [--json]Examples:
ms prometheus query 'up'
ms prometheus query 'up{job="kubelet"}'
ms prometheus query 'rate(http_requests_total[5m])'
ms prometheus query 'node_cpu_seconds_total' --time 2024-01-01T00:00:00ZRange query
ms prometheus range <promql> --start <ts> --end <ts> [--step <s>] [--json]Timestamps can be Unix seconds or RFC3339. Step defaults to 15s.
ms prometheus range 'up' --start 2024-01-01T00:00:00Z --end 2024-01-01T01:00:00Z
ms prometheus range 'node_cpu_seconds_total' --start 1700000000 --end 1700003600 --step 60sOther commands
ms prometheus targets [--filter up|down] # list scrape targets and their health
ms prometheus labels [--match <selector>] # list all label names
ms prometheus alerts [--state firing|pending|inactive] # list active alerts
ms prometheus status # show Prometheus build infoAdd --json to any command to get raw JSON output.
Credentials
Third-party credentials (CloudStack and Prometheus) are stored server-side per account.
ms credentials set cloudstack # set CloudStack API key and secret
ms credentials set prometheus # set Prometheus URL, username, and password
ms credentials get # show which credentials are configured
ms credentials delete cloudstack
ms credentials delete prometheus