Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,7 @@ GLOBAL FLAGS:
-D, --debug Enable debug mode
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
-p, --profile string The config profile to use

SEE ALSO:
# Generate a data source configuration snippet
scw cockpit config get
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,7 @@ GLOBAL FLAGS:
-D, --debug Enable debug mode
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
-p, --profile string The config profile to use

SEE ALSO:
# Generate a data source configuration snippet
scw cockpit config get
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,7 @@ GLOBAL FLAGS:
-D, --debug Enable debug mode
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
-p, --profile string The config profile to use

SEE ALSO:
# Generate a data source configuration snippet
scw cockpit config get
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Generate a ready-to-use configuration snippet for a Cockpit data source.

Supported tools:
- prometheus: generates a remote_write block for prometheus.yml (metrics data sources only).
- fluent-bit: generates a fluent-bit.conf snippet with a dummy input and an OpenTelemetry output (logs data sources only).

Use generate-token=true to create a new Cockpit token and inject it directly in the snippet.
The token is created with the minimum required write scope for the data source type.
Expand All @@ -21,9 +22,15 @@ EXAMPLES:
Generate a Prometheus remote_write snippet with a named token
scw cockpit config get 11111111-1111-1111-1111-111111111111 type=prometheus generate-token=true token-name=my-prometheus

Generate a Fluent Bit configuration snippet
scw cockpit config get 11111111-1111-1111-1111-111111111111 type=fluent-bit

Generate a Fluent Bit configuration snippet with a new token
scw cockpit config get 11111111-1111-1111-1111-111111111111 type=fluent-bit generate-token=true

ARGS:
data-source-id ID of the data source to generate the configuration for
type Configuration template type (prometheus)
type Configuration template type (prometheus | fluent-bit)
[generate-token] Create a new Cockpit token and inject it in the generated snippet
[token-name=prometheus-push] Name of the token to create when generate-token=true
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,7 @@ GLOBAL FLAGS:
-D, --debug Enable debug mode
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
-p, --profile string The config profile to use

SEE ALSO:
# Generate a data source configuration snippet
scw cockpit config get
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,7 @@ GLOBAL FLAGS:
-D, --debug Enable debug mode
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
-p, --profile string The config profile to use

SEE ALSO:
# Generate a data source configuration snippet
scw cockpit config get
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,7 @@ GLOBAL FLAGS:
-D, --debug Enable debug mode
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
-p, --profile string The config profile to use

SEE ALSO:
# Generate a data source configuration snippet
scw cockpit config get
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,7 @@ GLOBAL FLAGS:
-D, --debug Enable debug mode
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
-p, --profile string The config profile to use

SEE ALSO:
# Generate a data source configuration snippet
scw cockpit config get
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,7 @@ GLOBAL FLAGS:
-D, --debug Enable debug mode
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
-p, --profile string The config profile to use

SEE ALSO:
# Generate a data source configuration snippet
scw cockpit config get
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,7 @@ GLOBAL FLAGS:
-D, --debug Enable debug mode
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
-p, --profile string The config profile to use

SEE ALSO:
# Generate a data source configuration snippet
scw cockpit config get
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,7 @@ GLOBAL FLAGS:
-D, --debug Enable debug mode
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
-p, --profile string The config profile to use

SEE ALSO:
# Generate a data source configuration snippet
scw cockpit config get
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,7 @@ GLOBAL FLAGS:
-D, --debug Enable debug mode
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
-p, --profile string The config profile to use

SEE ALSO:
# Generate a data source configuration snippet
scw cockpit config get
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,7 @@ GLOBAL FLAGS:
-D, --debug Enable debug mode
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
-p, --profile string The config profile to use

SEE ALSO:
# Generate a data source configuration snippet
scw cockpit config get
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,7 @@ GLOBAL FLAGS:
-D, --debug Enable debug mode
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
-p, --profile string The config profile to use

SEE ALSO:
# Generate a data source configuration snippet
scw cockpit config get
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,7 @@ GLOBAL FLAGS:
-D, --debug Enable debug mode
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
-p, --profile string The config profile to use

SEE ALSO:
# Generate a data source configuration snippet
scw cockpit config get
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,7 @@ GLOBAL FLAGS:
-D, --debug Enable debug mode
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
-p, --profile string The config profile to use

SEE ALSO:
# Generate a data source configuration snippet
scw cockpit config get
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,7 @@ GLOBAL FLAGS:
-D, --debug Enable debug mode
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
-p, --profile string The config profile to use

SEE ALSO:
# Generate a data source configuration snippet
scw cockpit config get
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,7 @@ GLOBAL FLAGS:
-D, --debug Enable debug mode
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
-p, --profile string The config profile to use

SEE ALSO:
# Generate a data source configuration snippet
scw cockpit config get
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,7 @@ GLOBAL FLAGS:
-D, --debug Enable debug mode
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
-p, --profile string The config profile to use

SEE ALSO:
# Generate a data source configuration snippet
scw cockpit config get
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,7 @@ GLOBAL FLAGS:
-D, --debug Enable debug mode
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
-p, --profile string The config profile to use

SEE ALSO:
# Generate a data source configuration snippet
scw cockpit config get
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,7 @@ GLOBAL FLAGS:
-D, --debug Enable debug mode
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
-p, --profile string The config profile to use

SEE ALSO:
# Generate a data source configuration snippet
scw cockpit config get
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,7 @@ GLOBAL FLAGS:
-D, --debug Enable debug mode
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
-p, --profile string The config profile to use

SEE ALSO:
# Generate a data source configuration snippet
scw cockpit config get
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,7 @@ GLOBAL FLAGS:
-D, --debug Enable debug mode
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
-p, --profile string The config profile to use

SEE ALSO:
# Generate a data source configuration snippet
scw cockpit config get
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,7 @@ GLOBAL FLAGS:
-D, --debug Enable debug mode
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
-p, --profile string The config profile to use

SEE ALSO:
# Generate a data source configuration snippet
scw cockpit config get
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,7 @@ GLOBAL FLAGS:
-D, --debug Enable debug mode
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
-p, --profile string The config profile to use

SEE ALSO:
# Generate a data source configuration snippet
scw cockpit config get
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,7 @@ GLOBAL FLAGS:
-D, --debug Enable debug mode
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
-p, --profile string The config profile to use

SEE ALSO:
# Generate a data source configuration snippet
scw cockpit config get
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,7 @@ GLOBAL FLAGS:
-D, --debug Enable debug mode
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
-p, --profile string The config profile to use

SEE ALSO:
# Generate a data source configuration snippet
scw cockpit config get
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,7 @@ GLOBAL FLAGS:
-D, --debug Enable debug mode
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
-p, --profile string The config profile to use

SEE ALSO:
# Generate a data source configuration snippet
scw cockpit config get
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,7 @@ GLOBAL FLAGS:
-D, --debug Enable debug mode
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
-p, --profile string The config profile to use

SEE ALSO:
# Generate a data source configuration snippet
scw cockpit config get
13 changes: 12 additions & 1 deletion docs/commands/cockpit.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ Generate a ready-to-use configuration snippet for a Cockpit data source.

Supported tools:
- prometheus: generates a remote_write block for prometheus.yml (metrics data sources only).
- fluent-bit: generates a fluent-bit.conf snippet with a dummy input and an OpenTelemetry output (logs data sources only).

Use generate-token=true to create a new Cockpit token and inject it directly in the snippet.
The token is created with the minimum required write scope for the data source type.
Expand All @@ -138,7 +139,7 @@ scw cockpit config get <data-source-id ...> [arg=value ...]
| Name | | Description |
|------|---|-------------|
| data-source-id | Required | ID of the data source to generate the configuration for |
| type | Required<br />One of: `prometheus` | Configuration template type |
| type | Required<br />One of: `prometheus`, `fluent-bit` | Configuration template type |
| generate-token | | Create a new Cockpit token and inject it in the generated snippet |
| token-name | Default: `prometheus-push` | Name of the token to create when generate-token=true |
| region | Default: `fr-par`<br />One of: `fr-par`, `nl-ams`, `pl-waw` | Region to target. If none is passed will use default region from the config |
Expand All @@ -162,6 +163,16 @@ Generate a Prometheus remote_write snippet with a named token
scw cockpit config get 11111111-1111-1111-1111-111111111111 type=prometheus generate-token=true token-name=my-prometheus
```

Generate a Fluent Bit configuration snippet
```
scw cockpit config get 11111111-1111-1111-1111-111111111111 type=fluent-bit
```

Generate a Fluent Bit configuration snippet with a new token
```
scw cockpit config get 11111111-1111-1111-1111-111111111111 type=fluent-bit generate-token=true
```




Expand Down
14 changes: 14 additions & 0 deletions internal/namespaces/cockpit/v1/custom.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,20 @@ func GetCommands() *core.Commands {
cmds.MustFind("cockpit", "token", "get").Override(cockpitTokenGetBuilder)
cmds.Add(cockpitConfigRoot())
cmds.Add(cockpitConfigGetCommand())
addCockpitConfigGetSeeAlso(cmds)

return cmds
}

func addCockpitConfigGetSeeAlso(cmds *core.Commands) {
for _, cmd := range cmds.GetAll() {
if cmd.Namespace != "cockpit" || cmd.Run == nil || cmd.Resource == "config" {
continue
}

cmd.SeeAlsos = append(cmd.SeeAlsos, &core.SeeAlso{
Command: "scw cockpit config get",
Short: "Generate a data source configuration snippet",
})
}
}
Loading
Loading