Skip to content
This repository has been archived by the owner on Jun 1, 2022. It is now read-only.

PMM-9968 pmm-admin inventory add agent * --log-level #224

Open
wants to merge 18 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
caea088
PMM-7326 log level for MySQL, MongoDB, PostgreSQL, ProxySQL
YaroslavPodorvanov Apr 23, 2022
76a864f
PMM-7326 pmm-admin config --log-level to configurate pmm-agent
YaroslavPodorvanov Apr 25, 2022
000b413
Merge branch 'main' into PMM-7326-log-level
YaroslavPodorvanov Apr 26, 2022
ad9924e
Merge branch 'main' into PMM-7326-log-level
YaroslavPodorvanov May 1, 2022
e082f1c
Merge branch 'main' into PMM-7326-log-level
YaroslavPodorvanov May 2, 2022
89bf921
PMM-7326 "go get -v github.com/percona/pmm@PMM-7326-log-level"
YaroslavPodorvanov May 2, 2022
9fe1a9a
PMM-7326 "go get -v github.com/percona/pmm@PMM-7326-log-level"
YaroslavPodorvanov May 2, 2022
66f0043
PMM-7326 after review
YaroslavPodorvanov May 5, 2022
539e4cd
Merge branch 'main' into PMM-7326-log-level
YaroslavPodorvanov May 5, 2022
7d95a9a
Merge branch 'PMM-7326-log-level' into PMM-9968-pmm-admin-inventory-w…
YaroslavPodorvanov May 9, 2022
177f69c
PMM-9968 "go get -v github.com/percona/pmm@PMM-9968-pmm-admin-invento…
YaroslavPodorvanov May 9, 2022
82415dd
PMM-9968 pmm-admin inventory add exporters with log-level
YaroslavPodorvanov May 9, 2022
eb9f038
Merge branch 'PMM-9968-pmm-admin-inventory-with-log-level-try-1' into…
YaroslavPodorvanov May 9, 2022
ae54b20
PMM-9968 "go get -v github.com/percona/pmm@PMM-9968-pmm-admin-invento…
YaroslavPodorvanov May 15, 2022
9b1c4e1
PMM-9968 inventory log-level
YaroslavPodorvanov May 15, 2022
0eb87e9
Merge branch 'PMM-9968-pmm-admin-inventory-with-log-level-try-2' into…
YaroslavPodorvanov May 15, 2022
04707db
Merge branch 'main' into PMM-9968-pmm-admin-inventory-with-log-level
YaroslavPodorvanov May 25, 2022
f4bfc41
PMM-9968 "go get github.com/percona/pmm@PMM-9968-pmm-admin-inventory-…
YaroslavPodorvanov May 25, 2022
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
9 changes: 9 additions & 0 deletions commands/inventory/add_agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,16 @@

package inventory

import "gopkg.in/alecthomas/kingpin.v2"

// register command
var (
addAgentC = inventoryAddC.Command("agent", "Add agent to inventory").Hide(hide)

addExporterLogLevel string
)

func addExporterGlobalFlags(cmd *kingpin.CmdClause) {
// Add command global flags
cmd.Flag("log-level", "Service logging level").Default("warn").EnumVar(&addExporterLogLevel, "debug", "info", "warn", "error", "fatal")
}
2 changes: 2 additions & 0 deletions commands/inventory/add_agent_mongodb_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ func (cmd *addAgentMongodbExporterCommand) Run() (commands.Result, error) {
DisableCollectors: commands.ParseDisableCollectors(cmd.DisableCollectors),
StatsCollections: commands.ParseDisableCollectors(cmd.StatsCollections),
CollectionsLimit: cmd.CollectionsLimit,
LogLevel: &addExporterLogLevel,
},
Context: commands.Ctx,
}
Expand Down Expand Up @@ -144,4 +145,5 @@ func init() {
AddAgentMongodbExporterC.Flag("stats-collections", "Collections for collstats & indexstats").StringVar(&AddAgentMongodbExporter.StatsCollections)
AddAgentMongodbExporterC.Flag("max-collections-limit", "Disable collstats & indexstats if there are more than <n> collections").
Int32Var(&AddAgentMongodbExporter.CollectionsLimit)
addExporterGlobalFlags(AddAgentMongodbExporterC)
}
2 changes: 2 additions & 0 deletions commands/inventory/add_agent_mysqld_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ func (cmd *addAgentMysqldExporterCommand) Run() (commands.Result, error) {
TablestatsGroupTableLimit: cmd.TablestatsGroupTableLimit,
PushMetrics: cmd.PushMetrics,
DisableCollectors: commands.ParseDisableCollectors(cmd.DisableCollectors),
LogLevel: &addExporterLogLevel,
},
Context: commands.Ctx,
}
Expand Down Expand Up @@ -179,4 +180,5 @@ func init() {
" it will be sent to the server by an agent").BoolVar(&AddAgentMysqldExporter.PushMetrics)
AddAgentMysqldExporterC.Flag("disable-collectors",
"Comma-separated list of collector names to exclude from exporter").StringVar(&AddAgentMysqldExporter.DisableCollectors)
addExporterGlobalFlags(AddAgentMysqldExporterC)
}
2 changes: 2 additions & 0 deletions commands/inventory/add_agent_postgres_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ func (cmd *addAgentPostgresExporterCommand) Run() (commands.Result, error) {
TLSCa: tlsCa,
TLSCert: tlsCert,
TLSKey: tlsKey,
LogLevel: &addExporterLogLevel,
},
Context: commands.Ctx,
}
Expand Down Expand Up @@ -143,4 +144,5 @@ func init() {
AddAgentPostgresExporterC.Flag("tls-ca-file", "TLS CA certificate file").StringVar(&AddAgentPostgresExporter.TLSCAFile)
AddAgentPostgresExporterC.Flag("tls-cert-file", "TLS certificate file").StringVar(&AddAgentPostgresExporter.TLSCertFile)
AddAgentPostgresExporterC.Flag("tls-key-file", "TLS certificate key file").StringVar(&AddAgentPostgresExporter.TLSKeyFile)
addExporterGlobalFlags(AddAgentPostgresExporterC)
}
2 changes: 2 additions & 0 deletions commands/inventory/add_agent_proxysql_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ func (cmd *addAgentProxysqlExporterCommand) Run() (commands.Result, error) {
TLSSkipVerify: cmd.TLSSkipVerify,
PushMetrics: cmd.PushMetrics,
DisableCollectors: commands.ParseDisableCollectors(cmd.DisableCollectors),
LogLevel: &addExporterLogLevel,
},
Context: commands.Ctx,
}
Expand Down Expand Up @@ -112,4 +113,5 @@ func init() {
" it will be sent to the server by an agent").BoolVar(&AddAgentProxysqlExporter.PushMetrics)
AddAgentProxysqlExporterC.Flag("disable-collectors",
"Comma-separated list of collector names to exclude from exporter").StringVar(&AddAgentProxysqlExporter.DisableCollectors)
addExporterGlobalFlags(AddAgentProxysqlExporterC)
}
2 changes: 2 additions & 0 deletions commands/inventory/add_agent_qan_mongodb_profiler_agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ func (cmd *addAgentQANMongoDBProfilerAgentCommand) Run() (commands.Result, error
TLSCertificateKeyFilePassword: cmd.TLSCertificateKeyFilePassword,
TLSCa: tlsCa,
AuthenticationMechanism: cmd.AuthenticationMechanism,
LogLevel: &addExporterLogLevel,
},
Context: commands.Ctx,
}
Expand Down Expand Up @@ -123,4 +124,5 @@ func init() {
AddAgentQANMongoDBProfilerAgentC.Flag("tls-ca-file", "Path to certificate authority file").StringVar(&AddAgentQANMongoDBProfilerAgent.TLSCaFile)
AddAgentQANMongoDBProfilerAgentC.Flag("authentication-mechanism", "Authentication mechanism. Default is empty. Use MONGODB-X509 for ssl certificates").
StringVar(&AddAgentQANMongoDBProfilerAgent.AuthenticationMechanism)
addExporterGlobalFlags(AddAgentQANMongoDBProfilerAgentC)
}
2 changes: 2 additions & 0 deletions commands/inventory/add_agent_qan_mysql_perfschema_agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ func (cmd *addAgentQANMySQLPerfSchemaAgentCommand) Run() (commands.Result, error
TLSCa: tlsCa,
TLSCert: tlsCert,
TLSKey: tlsKey,
LogLevel: &addExporterLogLevel,
},
Context: commands.Ctx,
}
Expand Down Expand Up @@ -139,4 +140,5 @@ func init() {
AddAgentQANMySQLPerfSchemaAgentC.Flag("tls-ca", "Path to certificate authority certificate file").StringVar(&AddAgentQANMySQLPerfSchemaAgent.TLSCaFile)
AddAgentQANMySQLPerfSchemaAgentC.Flag("tls-cert", "Path to client certificate file").StringVar(&AddAgentQANMySQLPerfSchemaAgent.TLSCertFile)
AddAgentQANMySQLPerfSchemaAgentC.Flag("tls-key", "Path to client key file").StringVar(&AddAgentQANMySQLPerfSchemaAgent.TLSKeyFile)
addExporterGlobalFlags(AddAgentQANMySQLPerfSchemaAgentC)
}
2 changes: 2 additions & 0 deletions commands/inventory/add_agent_qan_mysql_slowlog_agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ func (cmd *addAgentQANMySQLSlowlogAgentCommand) Run() (commands.Result, error) {
TLSCa: tlsCa,
TLSCert: tlsCert,
TLSKey: tlsKey,
LogLevel: &addExporterLogLevel,
},
Context: commands.Ctx,
}
Expand Down Expand Up @@ -152,4 +153,5 @@ func init() {
AddAgentQANMySQLSlowlogAgentC.Flag("tls-ca", "Path to certificate authority certificate file").StringVar(&AddAgentQANMySQLSlowlogAgent.TLSCaFile)
AddAgentQANMySQLSlowlogAgentC.Flag("tls-cert", "Path to client certificate file").StringVar(&AddAgentQANMySQLSlowlogAgent.TLSCertFile)
AddAgentQANMySQLSlowlogAgentC.Flag("tls-key", "Path to client key file").StringVar(&AddAgentQANMySQLSlowlogAgent.TLSKeyFile)
addExporterGlobalFlags(AddAgentQANMySQLSlowlogAgentC)
}
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ func (cmd *addAgentQANPostgreSQLPgStatementsAgentCommand) Run() (commands.Result
TLSCa: tlsCa,
TLSCert: tlsCert,
TLSKey: tlsKey,
LogLevel: &addExporterLogLevel,
},
Context: commands.Ctx,
}
Expand Down Expand Up @@ -131,4 +132,5 @@ func init() {
AddAgentQANPostgreSQLPgStatementsAgentC.Flag("tls-ca-file", "TLS CA certificate file").StringVar(&AddAgentQANPostgreSQLPgStatementsAgent.TLSCAFile)
AddAgentQANPostgreSQLPgStatementsAgentC.Flag("tls-cert-file", "TLS certificate file").StringVar(&AddAgentQANPostgreSQLPgStatementsAgent.TLSCertFile)
AddAgentQANPostgreSQLPgStatementsAgentC.Flag("tls-key-file", "TLS certificate key file").StringVar(&AddAgentQANPostgreSQLPgStatementsAgent.TLSKeyFile)
addExporterGlobalFlags(AddAgentQANPostgreSQLPgStatementsAgentC)
}
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ func (cmd *addAgentQANPostgreSQLPgStatMonitorAgentCommand) Run() (commands.Resul
TLSCa: tlsCa,
TLSCert: tlsCert,
TLSKey: tlsKey,
LogLevel: &addExporterLogLevel,
},
Context: commands.Ctx,
}
Expand Down Expand Up @@ -135,4 +136,5 @@ func init() {
AddAgentQANPostgreSQLPgStatMonitorAgentC.Flag("tls-ca-file", "TLS CA certificate file").StringVar(&AddAgentQANPostgreSQLPgStatMonitorAgent.TLSCAFile)
AddAgentQANPostgreSQLPgStatMonitorAgentC.Flag("tls-cert-file", "TLS certificate file").StringVar(&AddAgentQANPostgreSQLPgStatMonitorAgent.TLSCertFile)
AddAgentQANPostgreSQLPgStatMonitorAgentC.Flag("tls-key-file", "TLS certificate key file").StringVar(&AddAgentQANPostgreSQLPgStatMonitorAgent.TLSKeyFile)
addExporterGlobalFlags(AddAgentQANPostgreSQLPgStatMonitorAgentC)
}
2 changes: 2 additions & 0 deletions commands/inventory/add_agent_rds_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ func (cmd *addAgentRDSExporterCommand) Run() (commands.Result, error) {
DisableBasicMetrics: cmd.DisableBasicMetrics,
DisableEnhancedMetrics: cmd.DisableEnhancedMetrics,
PushMetrics: cmd.PushMetrics,
LogLevel: &addExporterLogLevel,
},
Context: commands.Ctx,
}
Expand Down Expand Up @@ -105,4 +106,5 @@ func init() {
AddAgentRDSExporterC.Flag("disable-enhanced-metrics", "Disable enhanced metrics").BoolVar(&AddAgentRDSExporter.DisableEnhancedMetrics)
AddAgentRDSExporterC.Flag("push-metrics", "Enables push metrics model flow,"+
" it will be sent to the server by an agent").BoolVar(&AddAgentRDSExporter.PushMetrics)
addExporterGlobalFlags(AddAgentRDSExporterC)
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ require (
github.com/AlekSi/pointer v1.2.0
github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d
github.com/go-openapi/runtime v0.24.0
github.com/percona/pmm v0.0.0-20220520150831-23069cdf1bb8
github.com/percona/pmm v0.0.0-20220525201549-eda29cad842f
github.com/pkg/errors v0.9.1
github.com/sirupsen/logrus v1.8.1
github.com/stretchr/testify v1.7.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn
github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs=
github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc=
github.com/pelletier/go-toml v1.7.0/go.mod h1:vwGMzjaWMwyfHwgIBhI2YUM4fB6nL6lVAvS1LBMMhTE=
github.com/percona/pmm v0.0.0-20220520150831-23069cdf1bb8 h1:P5iuV4GRUIviRg/5/FM6ZOKdiBPdwUPbrHld/epM3hk=
github.com/percona/pmm v0.0.0-20220520150831-23069cdf1bb8/go.mod h1:gr+WLd8clEAe2xMFgsGhpw9ziZc2UCWcfy6d3M6Aq00=
github.com/percona/pmm v0.0.0-20220525201549-eda29cad842f h1:intEr6g51IIzN55MFH37uEte6x+jaObb/a19dYMzMdY=
github.com/percona/pmm v0.0.0-20220525201549-eda29cad842f/go.mod h1:gr+WLd8clEAe2xMFgsGhpw9ziZc2UCWcfy6d3M6Aq00=
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
Expand Down