Documentation ¶
Index ¶
Constants ¶
View Source
const ( STDOUT outputType = 0 + iota MARKDOWN HTML JSONOUTPUT JSONPATH )
outputTypes enum values
View Source
const ( PolicyEnabled = "Enabled" PolicyDisabled = "Disabled" PolicyAudit = "Disabled (Audit)" UnknownState = "Unknown" )
PolicyEnabled and PolicyDisabled represent the endpoint policy status
Variables ¶
View Source
var MetricsListCmd = &cobra.Command{ Use: "list", Short: "List all metrics", Run: func(cmd *cobra.Command, args []string) { res, err := client.Metrics.GetMetrics(nil) if err != nil { Fatalf("Cannot get metrics list: %s", err) } re, err := regexp.Compile(matchPattern) if err != nil { Fatalf("Cannot compile regex: %s", err) } metrics := make([]*models.Metric, 0, len(res.Payload)) for _, metric := range res.Payload { if re.MatchString(metric.Name) { metrics = append(metrics, metric) } } if command.OutputOption() { if err := command.PrintOutput(metrics); err != nil { os.Exit(1) } return } w := tabwriter.NewWriter(os.Stdout, 5, 0, 3, ' ', 0) fmt.Fprintln(w, "Metric\tLabels\tValue") for _, metric := range metrics { label := "" if len(metric.Labels) > 0 { labelArray := []string{} keys := make([]string, 0, len(metric.Labels)) for k := range metric.Labels { keys = append(keys, k) } sort.Strings(keys) for _, k := range keys { labelArray = append(labelArray, fmt.Sprintf(`%s="%s"`, k, metric.Labels[k])) } label = strings.Join(labelArray, " ") } fmt.Fprintf(w, "%s\t%s\t%f\n", metric.Name, label, metric.Value) } w.Flush() }, }
MetricsListCmd dumps all metrics into stdout
Functions ¶
func Execute ¶
func Execute()
Execute adds all child commands to the root command sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.
func Fatalf ¶
func Fatalf(msg string, args ...interface{})
Fatalf prints the Printf formatted message to stderr and exits the program Note: os.Exit(1) is not recoverable
func TablePrinter ¶ added in v1.5.0
TablePrinter prints the map[string][]string, which is an usual representation of dumped BPF map, using tabwriter.
Types ¶
type PolicyUpdateArgs ¶ added in v1.5.0
type PolicyUpdateArgs struct {
// contains filtered or unexported fields
}
PolicyUpdateArgs is the parsed representation of a bpf policy {add,delete} command.
Source Files ¶
- bpf.go
- bpf_auth.go
- bpf_auth_list.go
- bpf_bandwidth.go
- bpf_bandwidth_list.go
- bpf_ct.go
- bpf_ct_flush.go
- bpf_ct_list.go
- bpf_egress.go
- bpf_egress_list.go
- bpf_endpoint.go
- bpf_endpoint_delete.go
- bpf_endpoint_list.go
- bpf_ipcache.go
- bpf_ipcache_get.go
- bpf_ipcache_list.go
- bpf_ipmasq.go
- bpf_ipmasq_list.go
- bpf_lb.go
- bpf_lb_list.go
- bpf_lb_maglev.go
- bpf_lb_maglev_get.go
- bpf_lb_maglev_list.go
- bpf_metrics.go
- bpf_metrics_list.go
- bpf_migrate_maps.go
- bpf_mountfs.go
- bpf_mountfs_show.go
- bpf_nat.go
- bpf_nat_flush.go
- bpf_nat_list.go
- bpf_nodeid.go
- bpf_nodeid_list.go
- bpf_policy.go
- bpf_policy_add.go
- bpf_policy_delete.go
- bpf_policy_get.go
- bpf_policy_list.go
- bpf_recorder.go
- bpf_recorder_list.go
- bpf_sha.go
- bpf_sha_get.go
- bpf_sha_list.go
- bpf_srv6.go
- bpf_srv6_policy.go
- bpf_srv6_sid.go
- bpf_srv6_state.go
- bpf_srv6_vrf.go
- bpf_tunnel.go
- bpf_tunnel_list.go
- bpf_vtep.go
- bpf_vtep_delete.go
- bpf_vtep_list.go
- bpf_vtep_update.go
- build-config.go
- cgroups.go
- cgroups_list.go
- cleanup.go
- cmdman.go
- cmdref.go
- config.go
- config_get.go
- debuginfo.go
- encrypt.go
- encrypt_flush.go
- encrypt_status.go
- endpoint.go
- endpoint_config.go
- endpoint_disconnect.go
- endpoint_get.go
- endpoint_healthz.go
- endpoint_labels.go
- endpoint_list.go
- endpoint_log.go
- endpoint_regenerate.go
- fqdn.go
- helpers.go
- identity.go
- identity_get.go
- identity_list.go
- ip.go
- ip_list.go
- kvstore.go
- kvstore_delete.go
- kvstore_get.go
- kvstore_set.go
- lrp.go
- lrp_list.go
- map.go
- map_event_list.go
- map_get.go
- map_list.go
- metrics.go
- metrics_list.go
- monitor.go
- node.go
- node_id.go
- node_id_list.go
- node_list.go
- policy.go
- policy_delete.go
- policy_get.go
- policy_import.go
- policy_selectors.go
- policy_validate.go
- policy_wait.go
- prefilter.go
- prefilter_delete.go
- prefilter_list.go
- prefilter_update.go
- preflight.go
- preflight_identity_crd_migrate.go
- preflight_k8s_valid_cnp.go
- recorder.go
- recorder_delete.go
- recorder_get.go
- recorder_list.go
- recorder_update.go
- root.go
- service.go
- service_delete.go
- service_get.go
- service_list.go
- service_update.go
- status.go
- version.go
Click to show internal directories.
Click to hide internal directories.