From 88a920c024e0e1cc2afa0b7b71419542f4e0ec12 Mon Sep 17 00:00:00 2001 From: Arnob kumar saha Date: Wed, 31 Jan 2024 19:41:51 +0600 Subject: [PATCH] sort Signed-off-by: Arnob kumar saha --- pkg/cmds/monitor.go | 35 ++++++++++++++++------------------- pkg/monitor/util.go | 16 ++++++++-------- 2 files changed, 24 insertions(+), 27 deletions(-) diff --git a/pkg/cmds/monitor.go b/pkg/cmds/monitor.go index 6a10e2510..fe181bb0e 100644 --- a/pkg/cmds/monitor.go +++ b/pkg/cmds/monitor.go @@ -37,18 +37,15 @@ var monitorLong = templates.LongDesc(` var monitorExample = templates.Examples(` # Check triggered alerts for a specific database - kubectl dba monitor get-alerts [DATABASE] [DATABASE_NAME] -n [NAMESPACE] \ - --prom-svc=[PROM_SVC_NAME] --prom-svc-namespace=[PROM_SVC_NS] --prom-svc-port=[PROM_SVC_PORT] + kubectl dba monitor get-alerts [DATABASE] [DATABASE_NAME] -n [NAMESPACE] # Check availability of grafana dashboard of a database - kubectl dba monitor dashboard [DATABASE] [DASHBOARD_NAME] \ - --prom-svc=[PROM_SVC_NAME] --prom-svc-namespace=[PROM_SVC_NS] --prom-svc-port=[PROM_SVC_PORT] + kubectl dba monitor dashboard [DATABASE] [DASHBOARD_NAME] # Check connection status of target with prometheus server for a specific database - kubectl dba monitor check-connection [DATABASE] [DATABASE_NAME] -n [NAMESPACE] \ - --prom-svc=[PROM_SVC_NAME] --prom-svc-namespace=[PROM_SVC_NS] --prom-svc-port=[PROM_SVC_PORT] + kubectl dba monitor check-connection [DATABASE] [DATABASE_NAME] -n [NAMESPACE] - # Flags + # Common Flags --prom-svc-name : name of the prometheus service --prom-svc-namespace : namespace of the prometheus service --prom-svc-port : port of the prometheus service @@ -93,14 +90,14 @@ var alertExample = templates.Examples(` Valid resource types include: * elasticsearch - * mongodb + * kafka * mariadb + * mongodb * mysql - * postgres - * redis - * kafka * perconaxtradb + * postgres * proxysql + * redis `) func AlertCMD(f cmdutil.Factory) *cobra.Command { @@ -133,14 +130,14 @@ var dashboardExample = templates.Examples(` Valid dashboards include: * elasticsearch - * mongodb + * kafka * mariadb + * mongodb * mysql - * postgres - * redis - * kafka * perconaxtradb + * postgres * proxysql + * redis `) func DashboardCMD(f cmdutil.Factory) *cobra.Command { @@ -176,14 +173,14 @@ var connectionExample = templates.Examples(` Valid resource types include: * elasticsearch - * mongodb + * kafka * mariadb + * mongodb * mysql - * postgres - * redis - * kafka * perconaxtradb + * postgres * proxysql + * redis `) func ConnectionCMD(f cmdutil.Factory) *cobra.Command { diff --git a/pkg/monitor/util.go b/pkg/monitor/util.go index a0ced3ff4..b1cb623ab 100644 --- a/pkg/monitor/util.go +++ b/pkg/monitor/util.go @@ -29,22 +29,22 @@ func ConvertedResource(resource string) string { switch res { case api.ResourceCodeElasticsearch, api.ResourcePluralElasticsearch, api.ResourceSingularElasticsearch: res = api.ResourcePluralElasticsearch + case api.ResourceCodeKafka, api.ResourcePluralKafka, api.ResourceSingularKafka: + res = api.ResourcePluralKafka + case api.ResourceCodeMariaDB, api.ResourcePluralMariaDB, api.ResourceSingularMariaDB: + res = api.ResourcePluralMariaDB case api.ResourceCodeMongoDB, api.ResourcePluralMongoDB, api.ResourceSingularMongoDB: res = api.ResourcePluralMongoDB - case api.ResourceCodePostgres, api.ResourcePluralPostgres, api.ResourceSingularPostgres: - res = api.ResourcePluralPostgres case api.ResourceCodeMySQL, api.ResourcePluralMySQL, api.ResourceSingularMySQL: res = api.ResourcePluralMySQL - case api.ResourceCodeKafka, api.ResourcePluralKafka, api.ResourceSingularKafka: - res = api.ResourcePluralKafka - case api.ResourceCodeProxySQL, api.ResourcePluralProxySQL, api.ResourceSingularProxySQL: - res = api.ResourcePluralProxySQL case api.ResourceCodePerconaXtraDB, api.ResourcePluralPerconaXtraDB, api.ResourceSingularPerconaXtraDB: res = api.ResourcePluralPerconaXtraDB + case api.ResourceCodePostgres, api.ResourcePluralPostgres, api.ResourceSingularPostgres: + res = api.ResourcePluralPostgres + case api.ResourceCodeProxySQL, api.ResourcePluralProxySQL, api.ResourceSingularProxySQL: + res = api.ResourcePluralProxySQL case api.ResourceCodeRedis, api.ResourcePluralRedis, api.ResourceSingularRedis: res = api.ResourcePluralRedis - case api.ResourceCodeMariaDB, api.ResourcePluralMariaDB, api.ResourceSingularMariaDB: - res = api.ResourcePluralMariaDB default: log.Fatalf("%s is not a valid resource type \n", resource) }