Skip to content

Commit

Permalink
PMM-9968 pmm-admin inventory add agent * --log-level (#903)
Browse files Browse the repository at this point in the history
* PMM-9968 pmm-admin inventory add agent * (11 requests)
MySQL, MongoDB, Postgres, ProxySQL

QANMySQLPerfSchema, QANMySQLSlowlog, QANMongoDBProfiler, QANPostgreSQLPgStatements, QANPostgreSQLPgStatMonitor

RDS, AzureDatabase

* PMM-9968 make gen

* PMM-9968 AddNodeExporter with log-level

* PMM-9968 make gen

* PMM-9968 make gen

* PMM-9968 pmm-admin inventory add agent * with --log-level

* PMM-9968 pmm-admin inventory add agent node-exporter with --log-level (after review)

* PMM-9968 inventory agent node_exporter with log_level in Grafana view

* PMM-9968 make gen

* PMM-9968 inventory agents with log_level in Grafana view

* PMM-9968 make gen

* PMM-9968 make gen with "FILES = $(shell find . -type f -name '*.go' -not -path "./vendor/*")"

* PMM-9968 revert Makefile before fix conflict

* PMM-9968 copy-paste percona/pmm-managed#1134
  • Loading branch information
YaroslavPodorvanov authored Jul 20, 2022
1 parent 0674c24 commit fee7475
Show file tree
Hide file tree
Showing 60 changed files with 7,590 additions and 1,729 deletions.
9 changes: 9 additions & 0 deletions admin/commands/inventory/add_agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,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 admin/commands/inventory/add_agent_mongodb_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,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 @@ -142,4 +143,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 admin/commands/inventory/add_agent_mysqld_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,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 @@ -177,4 +178,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 admin/commands/inventory/add_agent_node_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ func (cmd *addAgentNodeExporterCommand) Run() (commands.Result, error) {
CustomLabels: customLabels,
PushMetrics: cmd.PushMetrics,
DisableCollectors: commands.ParseDisableCollectors(cmd.DisableCollectors),
LogLevel: &addExporterLogLevel,
},
Context: commands.Ctx,
}
Expand All @@ -85,4 +86,5 @@ func init() {
" it will be sent to the server by an agent").BoolVar(&AddAgentNodeExporter.PushMetrics)
AddAgentNodeExporterC.Flag("disable-collectors",
"Comma-separated list of collector names to exclude from exporter").StringVar(&AddAgentNodeExporter.DisableCollectors)
addExporterGlobalFlags(AddAgentNodeExporterC)
}
2 changes: 2 additions & 0 deletions admin/commands/inventory/add_agent_postgres_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ func (cmd *addAgentPostgresExporterCommand) Run() (commands.Result, error) {
TLSCa: tlsCa,
TLSCert: tlsCert,
TLSKey: tlsKey,
LogLevel: &addExporterLogLevel,
},
Context: commands.Ctx,
}
Expand Down Expand Up @@ -141,4 +142,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 admin/commands/inventory/add_agent_proxysql_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,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 @@ -110,4 +111,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)
}
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,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 @@ -121,4 +122,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)
}
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ func (cmd *addAgentQANMySQLPerfSchemaAgentCommand) Run() (commands.Result, error
TLSCa: tlsCa,
TLSCert: tlsCert,
TLSKey: tlsKey,
LogLevel: &addExporterLogLevel,
},
Context: commands.Ctx,
}
Expand Down Expand Up @@ -137,4 +138,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 admin/commands/inventory/add_agent_qan_mysql_slowlog_agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ func (cmd *addAgentQANMySQLSlowlogAgentCommand) Run() (commands.Result, error) {
TLSCa: tlsCa,
TLSCert: tlsCert,
TLSKey: tlsKey,
LogLevel: &addExporterLogLevel,
},
Context: commands.Ctx,
}
Expand Down Expand Up @@ -151,4 +152,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 @@ -97,6 +97,7 @@ func (cmd *addAgentQANPostgreSQLPgStatementsAgentCommand) Run() (commands.Result
TLSCa: tlsCa,
TLSCert: tlsCert,
TLSKey: tlsKey,
LogLevel: &addExporterLogLevel,
},
Context: commands.Ctx,
}
Expand Down Expand Up @@ -129,4 +130,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 @@ -100,6 +100,7 @@ func (cmd *addAgentQANPostgreSQLPgStatMonitorAgentCommand) Run() (commands.Resul
TLSCa: tlsCa,
TLSCert: tlsCert,
TLSKey: tlsKey,
LogLevel: &addExporterLogLevel,
},
Context: commands.Ctx,
}
Expand Down Expand Up @@ -133,4 +134,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 admin/commands/inventory/add_agent_rds_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,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 @@ -103,4 +104,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)
}
Loading

0 comments on commit fee7475

Please sign in to comment.