diff --git a/CHANGELOG.md b/CHANGELOG.md index 5218ec058e..49ffe359fb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,9 @@ ### 🛑 Breaking changes 🛑 -- (Splunk) `receiver/discovery`: Remove `severity_text` field from log evaluation statements. ([#4583](https://github.com/signalfx/splunk-otel-collector/pull/4583)) +- (Splunk) `receiver/discovery`: Update metrics and logs evaluation statements schema: + - Remove `severity_text` field from log evaluation statements ([#4583](https://github.com/signalfx/splunk-otel-collector/pull/4583)) + - Combine matching conditions with different statuses in one list ([#4588](https://github.com/signalfx/splunk-otel-collector/pull/4588)) ## v0.97.0 diff --git a/cmd/otelcol/config/collector/config.d.linux/receivers/mysql.discovery.yaml b/cmd/otelcol/config/collector/config.d.linux/receivers/mysql.discovery.yaml index 8d6700a8f2..e9787ae1df 100644 --- a/cmd/otelcol/config/collector/config.d.linux/receivers/mysql.discovery.yaml +++ b/cmd/otelcol/config/collector/config.d.linux/receivers/mysql.discovery.yaml @@ -18,26 +18,26 @@ # password: splunk.discovery.default # status: # metrics: -# successful: -# - strict: mysql.locks -# first_only: true -# log_record: -# body: Mysql receiver is working! +# - status: successful +# strict: mysql.locks +# first_only: true +# log_record: +# body: Mysql receiver is working! # statements: -# failed: -# - regexp: "Can't connect to MySQL server on .* [(]111[)]" -# first_only: true -# log_record: -# append_pattern: true -# body: The container cannot be reached by the Collector. The container is refusing MySQL connections. -# partial: -# - regexp: 'Access denied for user' -# first_only: true -# log_record: -# append_pattern: true -# body: >- -# Make sure your user credentials are correctly specified using the -# `--set splunk.discovery.receivers.mysql.config.username=""` and -# `--set splunk.discovery.receivers.mysql.config.password=""` command or the -# `SPLUNK_DISCOVERY_RECEIVERS_mysql_CONFIG_username=""` and -# `SPLUNK_DISCOVERY_RECEIVERS_mysql_CONFIG_password=""` environment variables. \ No newline at end of file +# - status: failed +# regexp: "Can't connect to MySQL server on .* [(]111[)]" +# first_only: true +# log_record: +# append_pattern: true +# body: The container cannot be reached by the Collector. The container is refusing MySQL connections. +# - status: partial +# regexp: 'Access denied for user' +# first_only: true +# log_record: +# append_pattern: true +# body: >- +# Make sure your user credentials are correctly specified using the +# `--set splunk.discovery.receivers.mysql.config.username=""` and +# `--set splunk.discovery.receivers.mysql.config.password=""` command or the +# `SPLUNK_DISCOVERY_RECEIVERS_mysql_CONFIG_username=""` and +# `SPLUNK_DISCOVERY_RECEIVERS_mysql_CONFIG_password=""` environment variables. diff --git a/cmd/otelcol/config/collector/config.d.linux/receivers/oracledb.discovery.yaml b/cmd/otelcol/config/collector/config.d.linux/receivers/oracledb.discovery.yaml index faa4dd5ab0..dd0a800ceb 100644 --- a/cmd/otelcol/config/collector/config.d.linux/receivers/oracledb.discovery.yaml +++ b/cmd/otelcol/config/collector/config.d.linux/receivers/oracledb.discovery.yaml @@ -19,50 +19,53 @@ # service: splunk.discovery.default # status: # metrics: -# successful: -# - strict: oracledb.cpu_time -# first_only: true -# log_record: -# body: oracledb receiver is working! +# - status: successful +# strict: oracledb.cpu_time +# first_only: true +# log_record: +# body: oracledb receiver is working! # statements: -# failed: -# - regexp: "connection refused" -# first_only: true -# log_record: -# append_pattern: true -# body: The container is not serving http connections. -# - regexp: "received goaway and there are no active streams" -# first_only: true -# log_record: -# append_pattern: true -# body: Unable to connect and scrape metrics. -# - regexp: "dial tcp: lookup" -# first_only: true -# log_record: -# append_pattern: true -# body: Unable to resolve oracledb tcp endpoint -# - regexp: 'error executing select .*: EOF' -# first_only: true -# log_record: -# append_pattern: true -# body: Unable to execute select from oracledb. Verify endpoint and user permissions. -# partial: -# - regexp: "listener does not currently know of service requested" -# first_only: true -# log_record: -# append_pattern: true -# body: >- -# Make sure your oracledb service is correctly specified using the -# `--set splunk.discovery.receivers.oracledb.config.service=""` command or the -# `SPLUNK_DISCOVERY_RECEIVERS_oracledb_CONFIG_service=""` environment variable. -# - regexp: 'invalid username/password' -# first_only: true -# log_record: -# append_pattern: true -# body: >- -# Make sure your user credentials are correctly specified using the -# `--set splunk.discovery.receivers.oracledb.config.username=""` and -# `--set splunk.discovery.receivers.oracledb.config.password=""` command or the -# `SPLUNK_DISCOVERY_RECEIVERS_oracledb_CONFIG_username=""` and -# `SPLUNK_DISCOVERY_RECEIVERS_oracledb_CONFIG_password=""` environment variables. -# \ No newline at end of file +# - status: failed +# regexp: "connection refused" +# first_only: true +# log_record: +# append_pattern: true +# body: The container is not serving http connections. +# - status: failed +# regexp: "received goaway and there are no active streams" +# first_only: true +# log_record: +# append_pattern: true +# body: Unable to connect and scrape metrics. +# - status: failed +# regexp: "dial tcp: lookup" +# first_only: true +# log_record: +# append_pattern: true +# body: Unable to resolve oracledb tcp endpoint +# - status: failed +# regexp: 'error executing select .*: EOF' +# first_only: true +# log_record: +# append_pattern: true +# body: Unable to execute select from oracledb. Verify endpoint and user permissions. +# - status: partial +# regexp: "listener does not currently know of service requested" +# first_only: true +# log_record: +# append_pattern: true +# body: >- +# Make sure your oracledb service is correctly specified using the +# `--set splunk.discovery.receivers.oracledb.config.service=""` command or the +# `SPLUNK_DISCOVERY_RECEIVERS_oracledb_CONFIG_service=""` environment variable. +# - status: partial +# regexp: 'invalid username/password' +# first_only: true +# log_record: +# append_pattern: true +# body: >- +# Make sure your user credentials are correctly specified using the +# `--set splunk.discovery.receivers.oracledb.config.username=""` and +# `--set splunk.discovery.receivers.oracledb.config.password=""` command or the +# `SPLUNK_DISCOVERY_RECEIVERS_oracledb_CONFIG_username=""` and +# `SPLUNK_DISCOVERY_RECEIVERS_oracledb_CONFIG_password=""` environment variables. diff --git a/cmd/otelcol/config/collector/config.d.linux/receivers/postgresql.discovery.yaml b/cmd/otelcol/config/collector/config.d.linux/receivers/postgresql.discovery.yaml index 88b5184469..c82dad0a90 100644 --- a/cmd/otelcol/config/collector/config.d.linux/receivers/postgresql.discovery.yaml +++ b/cmd/otelcol/config/collector/config.d.linux/receivers/postgresql.discovery.yaml @@ -18,59 +18,63 @@ # password: splunk.discovery.default # status: # metrics: -# successful: -# - strict: postgresql.commits -# first_only: true -# log_record: -# body: PostgreSQL receiver is working! +# - status: successful +# strict: postgresql.commits +# first_only: true +# log_record: +# body: PostgreSQL receiver is working! # statements: -# failed: -# - regexp: 'connect: network is unreachable' -# first_only: true -# log_record: -# append_pattern: true -# body: The container cannot be reached by the Collector. Make sure they're in the same network. -# - regexp: 'connect: connection refused' -# first_only: true -# log_record: -# append_pattern: true -# body: The container is refusing PostgreSQL connections. -# partial: -# - regexp: 'pq: password authentication failed for user' -# first_only: true -# log_record: -# append_pattern: true -# body: >- -# Please ensure your user credentials are correctly specified with -# `--set splunk.discovery.receivers.postgresql.config.username=""` and -# `--set splunk.discovery.receivers.postgresql.config.password=""` or -# `SPLUNK_DISCOVERY_RECEIVERS_postgresql_CONFIG_username=""` and -# `SPLUNK_DISCOVERY_RECEIVERS_postgresql_CONFIG_password=""` environment variables. -# - regexp: 'pq: database .* does not exist' -# first_only: true -# log_record: -# append_pattern: true -# body: >- -# Make sure the target database is correctly specified using the -# `--set splunk.discovery.receivers.postgresql.config.databases="[]"` command or the -# `SPLUNK_DISCOVERY_RECEIVERS_postgresql_CONFIG_databases="[]"` environment variable. -# - regexp: 'pq: SSL is not enabled on the server' -# first_only: true -# log_record: -# append_pattern: true -# body: >- -# Make sure the target database has SSL enabled or set insecure using the -# `--set splunk.discovery.receivers.postgresql.config.tls::insecure=""` command or the -# `SPLUNK_DISCOVERY_RECEIVERS_postgresql_CONFIG_tls_x3a__x3a_insecure=""` environment variable. -# - regexp: 'pq: pg_stat_statements must be loaded via shared_preload_libraries' -# first_only: true -# log_record: -# append_pattern: true -# body: >- -# Make sure your PostgreSQL database has -# `shared_preload_libraries = 'pg_stat_statements'` -# in the postgresql.conf file and that -# `CREATE EXTENSION IF NOT EXISTS pg_stat_statements;` -# has been run for each database you would like to monitor. -# For example: -# `psql --dbname "" -c "CREATE EXTENSION pg_stat_statements;"` +# - status: failed +# regexp: 'connect: network is unreachable' +# first_only: true +# log_record: +# append_pattern: true +# body: The container cannot be reached by the Collector. Make sure they're in the same network. +# - status: failed +# regexp: 'connect: connection refused' +# first_only: true +# log_record: +# append_pattern: true +# body: The container is refusing PostgreSQL connections. +# - status: partial +# regexp: 'pq: password authentication failed for user' +# first_only: true +# log_record: +# append_pattern: true +# body: >- +# Please ensure your user credentials are correctly specified with +# `--set splunk.discovery.receivers.postgresql.config.username=""` and +# `--set splunk.discovery.receivers.postgresql.config.password=""` or +# `SPLUNK_DISCOVERY_RECEIVERS_postgresql_CONFIG_username=""` and +# `SPLUNK_DISCOVERY_RECEIVERS_postgresql_CONFIG_password=""` environment variables. +# - status: partial +# regexp: 'pq: database .* does not exist' +# first_only: true +# log_record: +# append_pattern: true +# body: >- +# Make sure the target database is correctly specified using the +# `--set splunk.discovery.receivers.postgresql.config.databases="[]"` command or the +# `SPLUNK_DISCOVERY_RECEIVERS_postgresql_CONFIG_databases="[]"` environment variable. +# - status: partial +# regexp: 'pq: SSL is not enabled on the server' +# first_only: true +# log_record: +# append_pattern: true +# body: >- +# Make sure the target database has SSL enabled or set insecure using the +# `--set splunk.discovery.receivers.postgresql.config.tls::insecure=""` command or the +# `SPLUNK_DISCOVERY_RECEIVERS_postgresql_CONFIG_tls_x3a__x3a_insecure=""` environment variable. +# - status: partial +# regexp: 'pq: pg_stat_statements must be loaded via shared_preload_libraries' +# first_only: true +# log_record: +# append_pattern: true +# body: >- +# Make sure your PostgreSQL database has +# `shared_preload_libraries = 'pg_stat_statements'` +# in the postgresql.conf file and that +# `CREATE EXTENSION IF NOT EXISTS pg_stat_statements;` +# has been run for each database you would like to monitor. +# For example: +# `psql --dbname "" -c "CREATE EXTENSION pg_stat_statements;"` diff --git a/cmd/otelcol/config/collector/config.d.linux/receivers/redis.discovery.yaml b/cmd/otelcol/config/collector/config.d.linux/receivers/redis.discovery.yaml index 746222a4aa..e8ec13da5c 100644 --- a/cmd/otelcol/config/collector/config.d.linux/receivers/redis.discovery.yaml +++ b/cmd/otelcol/config/collector/config.d.linux/receivers/redis.discovery.yaml @@ -16,54 +16,58 @@ # default: {} # status: # metrics: -# successful: -# - strict: redis.uptime -# first_only: true -# log_record: -# body: redis receiver is working! +# - status: successful +# strict: redis.uptime +# first_only: true +# log_record: +# body: redis receiver is working! # statements: -# failed: -# - regexp: "connection refused" -# first_only: true -# log_record: -# append_pattern: true -# body: The container is not serving http connections. -# - regexp: "received goaway and there are no active streams" -# first_only: true -# log_record: -# append_pattern: true -# body: Unable to connect and scrape metrics. -# - regexp: "dial tcp: lookup" -# first_only: true -# log_record: -# append_pattern: true -# body: Unable to resolve redis tcp endpoint -# partial: -# - regexp: 'NOAUTH Authentication required.' -# first_only: true -# log_record: -# append_pattern: true -# body: >- -# Make sure your user credentials are correctly specified using the -# `--set splunk.discovery.receivers.redis.config.password=""` and -# `--set splunk.discovery.receivers.redis.config.username=""` commands or the -# `SPLUNK_DISCOVERY_RECEIVERS_redis_CONFIG_password=""` and -# `SPLUNK_DISCOVERY_RECEIVERS_redis_CONFIG_password=""` environment variables. -# - regexp: 'called without any password configured for the default user' -# first_only: true -# log_record: -# append_pattern: true -# body: >- -# Make sure your user credentials are correctly specified using the -# `--set splunk.discovery.receivers.redis.config.password=""` command or the -# `SPLUNK_DISCOVERY_RECEIVERS_redis_CONFIG_password=""` environment variables. -# - regexp: 'WRONGPASS invalid username-password pair or user is disabled' -# first_only: true -# log_record: -# append_pattern: true -# body: >- -# Make sure your user credentials are correctly specified using the -# `--set splunk.discovery.receivers.redis.config.password=""` and -# `--set splunk.discovery.receivers.redis.config.username=""` commands or the -# `SPLUNK_DISCOVERY_RECEIVERS_redis_CONFIG_password=""` and -# `SPLUNK_DISCOVERY_RECEIVERS_redis_CONFIG_password=""` environment variables. \ No newline at end of file +# - status: failed +# regexp: "connection refused" +# first_only: true +# log_record: +# append_pattern: true +# body: The container is not serving http connections. +# - status: failed +# regexp: "received goaway and there are no active streams" +# first_only: true +# log_record: +# append_pattern: true +# body: Unable to connect and scrape metrics. +# - status: failed +# regexp: "dial tcp: lookup" +# first_only: true +# log_record: +# append_pattern: true +# body: Unable to resolve redis tcp endpoint +# - status: partial +# regexp: 'NOAUTH Authentication required.' +# first_only: true +# log_record: +# append_pattern: true +# body: >- +# Make sure your user credentials are correctly specified using the +# `--set splunk.discovery.receivers.redis.config.password=""` and +# `--set splunk.discovery.receivers.redis.config.username=""` commands or the +# `SPLUNK_DISCOVERY_RECEIVERS_redis_CONFIG_password=""` and +# `SPLUNK_DISCOVERY_RECEIVERS_redis_CONFIG_password=""` environment variables. +# - status: partial +# regexp: 'called without any password configured for the default user' +# first_only: true +# log_record: +# append_pattern: true +# body: >- +# Make sure your user credentials are correctly specified using the +# `--set splunk.discovery.receivers.redis.config.password=""` command or the +# `SPLUNK_DISCOVERY_RECEIVERS_redis_CONFIG_password=""` environment variables. +# - status: partial +# regexp: 'WRONGPASS invalid username-password pair or user is disabled' +# first_only: true +# log_record: +# append_pattern: true +# body: >- +# Make sure your user credentials are correctly specified using the +# `--set splunk.discovery.receivers.redis.config.password=""` and +# `--set splunk.discovery.receivers.redis.config.username=""` commands or the +# `SPLUNK_DISCOVERY_RECEIVERS_redis_CONFIG_password=""` and +# `SPLUNK_DISCOVERY_RECEIVERS_redis_CONFIG_password=""` environment variables. diff --git a/cmd/otelcol/config/collector/config.d.linux/receivers/smartagent-collectd-mysql.discovery.yaml b/cmd/otelcol/config/collector/config.d.linux/receivers/smartagent-collectd-mysql.discovery.yaml index 00853a51d1..d5ab870d5e 100644 --- a/cmd/otelcol/config/collector/config.d.linux/receivers/smartagent-collectd-mysql.discovery.yaml +++ b/cmd/otelcol/config/collector/config.d.linux/receivers/smartagent-collectd-mysql.discovery.yaml @@ -22,42 +22,44 @@ # isolatedCollectd: true # status: # metrics: -# successful: -# - strict: mysql_octets.rx -# first_only: true -# log_record: -# body: smartagent/collectd/mysql receiver is working! +# - status: successful +# strict: mysql_octets.rx +# first_only: true +# log_record: +# body: smartagent/collectd/mysql receiver is working! # statements: -# failed: -# - regexp: "mysql plugin: Failed to connect to database .* at server .* Can't connect to MySQL server on .* [(]111[)]" -# first_only: true -# log_record: -# append_pattern: true -# body: The container is refusing MySQL connections. -# partial: -# - regexp: 'mysql plugin: Failed to connect to database .* at server .* Access denied for user .* [(]using password: .*[)]' -# first_only: true -# log_record: -# append_pattern: true -# body: >- -# Make sure your user credentials are correctly specified using the -# `--set splunk.discovery.receivers.smartagent/collectd/mysql.config.username=""` and -# `--set splunk.discovery.receivers.smartagent/collectd/mysql.config.password=""` command or the -# `SPLUNK_DISCOVERY_RECEIVERS_smartagent_x2f_collectd_x2f_mysql_CONFIG_username=""` and -# `SPLUNK_DISCOVERY_RECEIVERS_smartagent_x2f_collectd_x2f_mysql_CONFIG_password=""` environment variables. -# - regexp: 'mysql plugin: Failed to connect to database .* at server .* Unknown database' -# first_only: true -# log_record: -# append_pattern: true -# body: >- -# Make sure your MySQL databases are correctly specified using the -# `--set splunk.discovery.receivers.smartagent/collectd/mysql.config.databases="[{name: ''}, {name: '', username: '', password: ''}]"` command or the -# `SPLUNK_DISCOVERY_RECEIVERS_smartagent_x2f_collectd_x2f_mysql_CONFIG_databases="[{name: ''}, {name: '', username: '', password: ''}]"` environment variable. -# - regexp: 'mysql plugin: Failed to connect to database .* at server .* Access denied for user .* to database' -# first_only: true -# log_record: -# append_pattern: true -# body: >- -# Make sure your MySQL databases and auth information are correctly specified using the -# `--set splunk.discovery.receivers.smartagent/collectd/mysql.config.databases="[{name: ''}, {name: '', username: '', password: ''}]"` command or the -# `SPLUNK_DISCOVERY_RECEIVERS_smartagent_x2f_collectd_x2f_mysql_CONFIG_databases="[{name: ''}, {name: '', username: '', password: ''}]"` environment variable. +# - status: failed +# regexp: "mysql plugin: Failed to connect to database .* at server .* Can't connect to MySQL server on .* [(]111[)]" +# first_only: true +# log_record: +# append_pattern: true +# body: The container is refusing MySQL connections. +# - status: partial +# regexp: 'mysql plugin: Failed to connect to database .* at server .* Access denied for user .* [(]using password: .*[)]' +# first_only: true +# log_record: +# append_pattern: true +# body: >- +# Make sure your user credentials are correctly specified using the +# `--set splunk.discovery.receivers.smartagent/collectd/mysql.config.username=""` and +# `--set splunk.discovery.receivers.smartagent/collectd/mysql.config.password=""` command or the +# `SPLUNK_DISCOVERY_RECEIVERS_smartagent_x2f_collectd_x2f_mysql_CONFIG_username=""` and +# `SPLUNK_DISCOVERY_RECEIVERS_smartagent_x2f_collectd_x2f_mysql_CONFIG_password=""` environment variables. +# - status: partial +# regexp: 'mysql plugin: Failed to connect to database .* at server .* Unknown database' +# first_only: true +# log_record: +# append_pattern: true +# body: >- +# Make sure your MySQL databases are correctly specified using the +# `--set splunk.discovery.receivers.smartagent/collectd/mysql.config.databases="[{name: ''}, {name: '', username: '', password: ''}]"` command or the +# `SPLUNK_DISCOVERY_RECEIVERS_smartagent_x2f_collectd_x2f_mysql_CONFIG_databases="[{name: ''}, {name: '', username: '', password: ''}]"` environment variable. +# - status: partial +# regexp: 'mysql plugin: Failed to connect to database .* at server .* Access denied for user .* to database' +# first_only: true +# log_record: +# append_pattern: true +# body: >- +# Make sure your MySQL databases and auth information are correctly specified using the +# `--set splunk.discovery.receivers.smartagent/collectd/mysql.config.databases="[{name: ''}, {name: '', username: '', password: ''}]"` command or the +# `SPLUNK_DISCOVERY_RECEIVERS_smartagent_x2f_collectd_x2f_mysql_CONFIG_databases="[{name: ''}, {name: '', username: '', password: ''}]"` environment variable. diff --git a/cmd/otelcol/config/collector/config.d.linux/receivers/smartagent-collectd-nginx.discovery.yaml b/cmd/otelcol/config/collector/config.d.linux/receivers/smartagent-collectd-nginx.discovery.yaml index 46d29707c3..e6b08a79cb 100644 --- a/cmd/otelcol/config/collector/config.d.linux/receivers/smartagent-collectd-nginx.discovery.yaml +++ b/cmd/otelcol/config/collector/config.d.linux/receivers/smartagent-collectd-nginx.discovery.yaml @@ -20,20 +20,21 @@ # isolatedCollectd: true # status: # metrics: -# successful: -# - strict: connections.accepted -# first_only: true -# log_record: -# body: smartagent/collectd/nginx receiver is working! +# - status: successful +# strict: connections.accepted +# first_only: true +# log_record: +# body: smartagent/collectd/nginx receiver is working! # statements: -# failed: -# - regexp: "nginx plugin: curl_easy_perform failed: Operation timed out after" -# first_only: true -# log_record: -# append_pattern: true -# body: The container is not serving http connections. -# - regexp: "read-function of plugin .* failed" -# first_only: true -# log_record: -# append_pattern: true -# body: The integration is unable to read metrics from this endpoint. \ No newline at end of file +# - status: failed +# regexp: "nginx plugin: curl_easy_perform failed: Operation timed out after" +# first_only: true +# log_record: +# append_pattern: true +# body: The container is not serving http connections. +# - status: failed +# regexp: "read-function of plugin .* failed" +# first_only: true +# log_record: +# append_pattern: true +# body: The integration is unable to read metrics from this endpoint. \ No newline at end of file diff --git a/cmd/otelcol/config/collector/config.d.linux/receivers/smartagent-postgresql.discovery.yaml b/cmd/otelcol/config/collector/config.d.linux/receivers/smartagent-postgresql.discovery.yaml index 2e562dea83..3928024e5a 100644 --- a/cmd/otelcol/config/collector/config.d.linux/receivers/smartagent-postgresql.discovery.yaml +++ b/cmd/otelcol/config/collector/config.d.linux/receivers/smartagent-postgresql.discovery.yaml @@ -22,61 +22,64 @@ # masterDBName: splunk.discovery.default # status: # metrics: -# successful: -# - strict: postgres_query_count -# first_only: true -# log_record: -# body: PostgreSQL receiver is working! -# partial: -# - strict: postgres_rows_inserted -# first_only: true -# log_record: -# body: >- -# Make sure that -# `CREATE EXTENSION IF NOT EXISTS pg_stat_statements;` -# has been run for each database you would like to monitor. -# For example: -# `psql --dbname "" -c "CREATE EXTENSION IF NOT EXISTS pg_stat_statements;"` +# - status: successful +# strict: postgres_query_count +# first_only: true +# log_record: +# body: PostgreSQL receiver is working! +# - status: partial +# strict: postgres_rows_inserted +# first_only: true +# log_record: +# body: >- +# Make sure that +# `CREATE EXTENSION IF NOT EXISTS pg_stat_statements;` +# has been run for each database you would like to monitor. +# For example: +# `psql --dbname "" -c "CREATE EXTENSION IF NOT EXISTS pg_stat_statements;"` # statements: -# failed: -# - regexp: 'connect: network is unreachable' -# first_only: true -# log_record: -# append_pattern: true -# body: The container cannot be reached by the Collector. Make sure they're in the same network. -# - regexp: 'connect: connection refused' -# first_only: true -# log_record: -# append_pattern: true -# body: The container is refusing PostgreSQL connections. -# partial: -# - regexp: 'pq: password authentication failed for user' -# first_only: true -# log_record: -# append_pattern: true -# body: >- -# Please ensure your user credentials are correctly specified with -# `--set splunk.discovery.receivers.smartagent/postgresql.config.params::username=""` and -# `--set splunk.discovery.receivers.smartagent/postgresql.config.params::password=""` or -# `SPLUNK_DISCOVERY_RECEIVERS_smartagent_x2f_postgresql_CONFIG_params_x3a__x3a_username=""` and -# `SPLUNK_DISCOVERY_RECEIVERS_smartagent_x2f_postgresql_CONFIG_params_x3a__x3a_password=""` environment variables. -# - regexp: 'pq: database .* does not exist' -# first_only: true -# log_record: -# append_pattern: true -# body: >- -# Make sure the target database is correctly specified using the -# `--set splunk.discovery.receivers.smartagent/postgresql.config.masterDBName=""` command or the -# `SPLUNK_DISCOVERY_RECEIVERS_smartagent_x2f_postgresql_CONFIG_masterDBName=""` environment variable. -# - regexp: 'pq: pg_stat_statements must be loaded via shared_preload_libraries' -# first_only: true -# log_record: -# append_pattern: true -# body: >- -# Make sure your PostgreSQL database has -# `shared_preload_libraries = 'pg_stat_statements'` -# in the postgresql.conf file and that -# `CREATE EXTENSION IF NOT EXISTS pg_stat_statements;` -# has been run for each database you would like to monitor. -# For example: -# `psql --dbname "" -c "CREATE EXTENSION pg_stat_statements;"` \ No newline at end of file +# - status: failed +# regexp: 'connect: network is unreachable' +# first_only: true +# log_record: +# append_pattern: true +# body: The container cannot be reached by the Collector. Make sure they're in the same network. +# - status: failed +# regexp: 'connect: connection refused' +# first_only: true +# log_record: +# append_pattern: true +# body: The container is refusing PostgreSQL connections. +# - status: partial +# regexp: 'pq: password authentication failed for user' +# first_only: true +# log_record: +# append_pattern: true +# body: >- +# Please ensure your user credentials are correctly specified with +# `--set splunk.discovery.receivers.smartagent/postgresql.config.params::username=""` and +# `--set splunk.discovery.receivers.smartagent/postgresql.config.params::password=""` or +# `SPLUNK_DISCOVERY_RECEIVERS_smartagent_x2f_postgresql_CONFIG_params_x3a__x3a_username=""` and +# `SPLUNK_DISCOVERY_RECEIVERS_smartagent_x2f_postgresql_CONFIG_params_x3a__x3a_password=""` environment variables. +# - status: partial +# regexp: 'pq: database .* does not exist' +# first_only: true +# log_record: +# append_pattern: true +# body: >- +# Make sure the target database is correctly specified using the +# `--set splunk.discovery.receivers.smartagent/postgresql.config.masterDBName=""` command or the +# `SPLUNK_DISCOVERY_RECEIVERS_smartagent_x2f_postgresql_CONFIG_masterDBName=""` environment variable. +# - status: partial +# regexp: 'pq: pg_stat_statements must be loaded via shared_preload_libraries' +# first_only: true +# log_record: +# append_pattern: true +# body: >- +# Make sure your PostgreSQL database has +# `shared_preload_libraries = 'pg_stat_statements'` +# in the postgresql.conf file and that +# `CREATE EXTENSION IF NOT EXISTS pg_stat_statements;` +# has been run for each database you would like to monitor. +# For example: +# `psql --dbname "" -c "CREATE EXTENSION pg_stat_statements;"` diff --git a/internal/common/discovery/discovery.go b/internal/common/discovery/discovery.go index be67dc1d26..ccaf80c622 100644 --- a/internal/common/discovery/discovery.go +++ b/internal/common/discovery/discovery.go @@ -53,6 +53,9 @@ var allowedStatuses = func() map[StatusType]struct{} { }() func IsValidStatus(status StatusType) (bool, error) { + if status == "" { + return false, fmt.Errorf("status cannot be empty") + } if _, ok := allowedStatuses[status]; !ok { return false, fmt.Errorf("invalid status %q. must be one of %v", status, StatusTypes) } diff --git a/internal/confmapprovider/discovery/bundle/bundle.d/receivers/mysql.discovery.yaml b/internal/confmapprovider/discovery/bundle/bundle.d/receivers/mysql.discovery.yaml index ae46b4c179..fe817c1a85 100644 --- a/internal/confmapprovider/discovery/bundle/bundle.d/receivers/mysql.discovery.yaml +++ b/internal/confmapprovider/discovery/bundle/bundle.d/receivers/mysql.discovery.yaml @@ -14,26 +14,26 @@ mysql: password: splunk.discovery.default status: metrics: - successful: - - strict: mysql.locks - first_only: true - log_record: - body: Mysql receiver is working! + - status: successful + strict: mysql.locks + first_only: true + log_record: + body: Mysql receiver is working! statements: - failed: - - regexp: "Can't connect to MySQL server on .* [(]111[)]" - first_only: true - log_record: - append_pattern: true - body: The container cannot be reached by the Collector. The container is refusing MySQL connections. - partial: - - regexp: 'Access denied for user' - first_only: true - log_record: - append_pattern: true - body: >- - Make sure your user credentials are correctly specified using the - `--set splunk.discovery.receivers.mysql.config.username=""` and - `--set splunk.discovery.receivers.mysql.config.password=""` command or the - `SPLUNK_DISCOVERY_RECEIVERS_mysql_CONFIG_username=""` and - `SPLUNK_DISCOVERY_RECEIVERS_mysql_CONFIG_password=""` environment variables. \ No newline at end of file + - status: failed + regexp: "Can't connect to MySQL server on .* [(]111[)]" + first_only: true + log_record: + append_pattern: true + body: The container cannot be reached by the Collector. The container is refusing MySQL connections. + - status: partial + regexp: 'Access denied for user' + first_only: true + log_record: + append_pattern: true + body: >- + Make sure your user credentials are correctly specified using the + `--set splunk.discovery.receivers.mysql.config.username=""` and + `--set splunk.discovery.receivers.mysql.config.password=""` command or the + `SPLUNK_DISCOVERY_RECEIVERS_mysql_CONFIG_username=""` and + `SPLUNK_DISCOVERY_RECEIVERS_mysql_CONFIG_password=""` environment variables. diff --git a/internal/confmapprovider/discovery/bundle/bundle.d/receivers/mysql.discovery.yaml.tmpl b/internal/confmapprovider/discovery/bundle/bundle.d/receivers/mysql.discovery.yaml.tmpl index 8d89cfbe89..71b907037c 100644 --- a/internal/confmapprovider/discovery/bundle/bundle.d/receivers/mysql.discovery.yaml.tmpl +++ b/internal/confmapprovider/discovery/bundle/bundle.d/receivers/mysql.discovery.yaml.tmpl @@ -10,26 +10,26 @@ password: {{ defaultValue }} status: metrics: - successful: - - strict: mysql.locks - first_only: true - log_record: - body: Mysql receiver is working! + - status: successful + strict: mysql.locks + first_only: true + log_record: + body: Mysql receiver is working! statements: - failed: - - regexp: "Can't connect to MySQL server on .* [(]111[)]" - first_only: true - log_record: - append_pattern: true - body: The container cannot be reached by the Collector. The container is refusing MySQL connections. - partial: - - regexp: 'Access denied for user' - first_only: true - log_record: - append_pattern: true - body: >- - Make sure your user credentials are correctly specified using the - `--set {{ configProperty "username" "" }}` and - `--set {{ configProperty "password" "" }}` command or the - `{{ configPropertyEnvVar "username" "" }}` and - `{{ configPropertyEnvVar "password" "" }}` environment variables. \ No newline at end of file + - status: failed + regexp: "Can't connect to MySQL server on .* [(]111[)]" + first_only: true + log_record: + append_pattern: true + body: The container cannot be reached by the Collector. The container is refusing MySQL connections. + - status: partial + regexp: 'Access denied for user' + first_only: true + log_record: + append_pattern: true + body: >- + Make sure your user credentials are correctly specified using the + `--set {{ configProperty "username" "" }}` and + `--set {{ configProperty "password" "" }}` command or the + `{{ configPropertyEnvVar "username" "" }}` and + `{{ configPropertyEnvVar "password" "" }}` environment variables. diff --git a/internal/confmapprovider/discovery/bundle/bundle.d/receivers/oracledb.discovery.yaml b/internal/confmapprovider/discovery/bundle/bundle.d/receivers/oracledb.discovery.yaml index b691af1339..e2859a5528 100644 --- a/internal/confmapprovider/discovery/bundle/bundle.d/receivers/oracledb.discovery.yaml +++ b/internal/confmapprovider/discovery/bundle/bundle.d/receivers/oracledb.discovery.yaml @@ -15,50 +15,53 @@ oracledb: service: splunk.discovery.default status: metrics: - successful: - - strict: oracledb.cpu_time - first_only: true - log_record: - body: oracledb receiver is working! + - status: successful + strict: oracledb.cpu_time + first_only: true + log_record: + body: oracledb receiver is working! statements: - failed: - - regexp: "connection refused" - first_only: true - log_record: - append_pattern: true - body: The container is not serving http connections. - - regexp: "received goaway and there are no active streams" - first_only: true - log_record: - append_pattern: true - body: Unable to connect and scrape metrics. - - regexp: "dial tcp: lookup" - first_only: true - log_record: - append_pattern: true - body: Unable to resolve oracledb tcp endpoint - - regexp: 'error executing select .*: EOF' - first_only: true - log_record: - append_pattern: true - body: Unable to execute select from oracledb. Verify endpoint and user permissions. - partial: - - regexp: "listener does not currently know of service requested" - first_only: true - log_record: - append_pattern: true - body: >- - Make sure your oracledb service is correctly specified using the - `--set splunk.discovery.receivers.oracledb.config.service=""` command or the - `SPLUNK_DISCOVERY_RECEIVERS_oracledb_CONFIG_service=""` environment variable. - - regexp: 'invalid username/password' - first_only: true - log_record: - append_pattern: true - body: >- - Make sure your user credentials are correctly specified using the - `--set splunk.discovery.receivers.oracledb.config.username=""` and - `--set splunk.discovery.receivers.oracledb.config.password=""` command or the - `SPLUNK_DISCOVERY_RECEIVERS_oracledb_CONFIG_username=""` and - `SPLUNK_DISCOVERY_RECEIVERS_oracledb_CONFIG_password=""` environment variables. - \ No newline at end of file + - status: failed + regexp: "connection refused" + first_only: true + log_record: + append_pattern: true + body: The container is not serving http connections. + - status: failed + regexp: "received goaway and there are no active streams" + first_only: true + log_record: + append_pattern: true + body: Unable to connect and scrape metrics. + - status: failed + regexp: "dial tcp: lookup" + first_only: true + log_record: + append_pattern: true + body: Unable to resolve oracledb tcp endpoint + - status: failed + regexp: 'error executing select .*: EOF' + first_only: true + log_record: + append_pattern: true + body: Unable to execute select from oracledb. Verify endpoint and user permissions. + - status: partial + regexp: "listener does not currently know of service requested" + first_only: true + log_record: + append_pattern: true + body: >- + Make sure your oracledb service is correctly specified using the + `--set splunk.discovery.receivers.oracledb.config.service=""` command or the + `SPLUNK_DISCOVERY_RECEIVERS_oracledb_CONFIG_service=""` environment variable. + - status: partial + regexp: 'invalid username/password' + first_only: true + log_record: + append_pattern: true + body: >- + Make sure your user credentials are correctly specified using the + `--set splunk.discovery.receivers.oracledb.config.username=""` and + `--set splunk.discovery.receivers.oracledb.config.password=""` command or the + `SPLUNK_DISCOVERY_RECEIVERS_oracledb_CONFIG_username=""` and + `SPLUNK_DISCOVERY_RECEIVERS_oracledb_CONFIG_password=""` environment variables. diff --git a/internal/confmapprovider/discovery/bundle/bundle.d/receivers/oracledb.discovery.yaml.tmpl b/internal/confmapprovider/discovery/bundle/bundle.d/receivers/oracledb.discovery.yaml.tmpl index ab0d61ebe8..d2bb7dab9c 100644 --- a/internal/confmapprovider/discovery/bundle/bundle.d/receivers/oracledb.discovery.yaml.tmpl +++ b/internal/confmapprovider/discovery/bundle/bundle.d/receivers/oracledb.discovery.yaml.tmpl @@ -11,50 +11,53 @@ service: {{ defaultValue }} status: metrics: - successful: - - strict: oracledb.cpu_time - first_only: true - log_record: - body: oracledb receiver is working! + - status: successful + strict: oracledb.cpu_time + first_only: true + log_record: + body: oracledb receiver is working! statements: - failed: - - regexp: "connection refused" - first_only: true - log_record: - append_pattern: true - body: The container is not serving http connections. - - regexp: "received goaway and there are no active streams" - first_only: true - log_record: - append_pattern: true - body: Unable to connect and scrape metrics. - - regexp: "dial tcp: lookup" - first_only: true - log_record: - append_pattern: true - body: Unable to resolve oracledb tcp endpoint - - regexp: 'error executing select .*: EOF' - first_only: true - log_record: - append_pattern: true - body: Unable to execute select from oracledb. Verify endpoint and user permissions. - partial: - - regexp: "listener does not currently know of service requested" - first_only: true - log_record: - append_pattern: true - body: >- - Make sure your oracledb service is correctly specified using the - `--set {{ configProperty "service" "" }}` command or the - `{{ configPropertyEnvVar "service" "" }}` environment variable. - - regexp: 'invalid username/password' - first_only: true - log_record: - append_pattern: true - body: >- - Make sure your user credentials are correctly specified using the - `--set {{ configProperty "username" "" }}` and - `--set {{ configProperty "password" "" }}` command or the - `{{ configPropertyEnvVar "username" "" }}` and - `{{ configPropertyEnvVar "password" "" }}` environment variables. - \ No newline at end of file + - status: failed + regexp: "connection refused" + first_only: true + log_record: + append_pattern: true + body: The container is not serving http connections. + - status: failed + regexp: "received goaway and there are no active streams" + first_only: true + log_record: + append_pattern: true + body: Unable to connect and scrape metrics. + - status: failed + regexp: "dial tcp: lookup" + first_only: true + log_record: + append_pattern: true + body: Unable to resolve oracledb tcp endpoint + - status: failed + regexp: 'error executing select .*: EOF' + first_only: true + log_record: + append_pattern: true + body: Unable to execute select from oracledb. Verify endpoint and user permissions. + - status: partial + regexp: "listener does not currently know of service requested" + first_only: true + log_record: + append_pattern: true + body: >- + Make sure your oracledb service is correctly specified using the + `--set {{ configProperty "service" "" }}` command or the + `{{ configPropertyEnvVar "service" "" }}` environment variable. + - status: partial + regexp: 'invalid username/password' + first_only: true + log_record: + append_pattern: true + body: >- + Make sure your user credentials are correctly specified using the + `--set {{ configProperty "username" "" }}` and + `--set {{ configProperty "password" "" }}` command or the + `{{ configPropertyEnvVar "username" "" }}` and + `{{ configPropertyEnvVar "password" "" }}` environment variables. diff --git a/internal/confmapprovider/discovery/bundle/bundle.d/receivers/postgresql.discovery.yaml b/internal/confmapprovider/discovery/bundle/bundle.d/receivers/postgresql.discovery.yaml index afc30c4cb0..a431dd6023 100644 --- a/internal/confmapprovider/discovery/bundle/bundle.d/receivers/postgresql.discovery.yaml +++ b/internal/confmapprovider/discovery/bundle/bundle.d/receivers/postgresql.discovery.yaml @@ -14,59 +14,63 @@ postgresql: password: splunk.discovery.default status: metrics: - successful: - - strict: postgresql.commits - first_only: true - log_record: - body: PostgreSQL receiver is working! + - status: successful + strict: postgresql.commits + first_only: true + log_record: + body: PostgreSQL receiver is working! statements: - failed: - - regexp: 'connect: network is unreachable' - first_only: true - log_record: - append_pattern: true - body: The container cannot be reached by the Collector. Make sure they're in the same network. - - regexp: 'connect: connection refused' - first_only: true - log_record: - append_pattern: true - body: The container is refusing PostgreSQL connections. - partial: - - regexp: 'pq: password authentication failed for user' - first_only: true - log_record: - append_pattern: true - body: >- - Please ensure your user credentials are correctly specified with - `--set splunk.discovery.receivers.postgresql.config.username=""` and - `--set splunk.discovery.receivers.postgresql.config.password=""` or - `SPLUNK_DISCOVERY_RECEIVERS_postgresql_CONFIG_username=""` and - `SPLUNK_DISCOVERY_RECEIVERS_postgresql_CONFIG_password=""` environment variables. - - regexp: 'pq: database .* does not exist' - first_only: true - log_record: - append_pattern: true - body: >- - Make sure the target database is correctly specified using the - `--set splunk.discovery.receivers.postgresql.config.databases="[]"` command or the - `SPLUNK_DISCOVERY_RECEIVERS_postgresql_CONFIG_databases="[]"` environment variable. - - regexp: 'pq: SSL is not enabled on the server' - first_only: true - log_record: - append_pattern: true - body: >- - Make sure the target database has SSL enabled or set insecure using the - `--set splunk.discovery.receivers.postgresql.config.tls::insecure=""` command or the - `SPLUNK_DISCOVERY_RECEIVERS_postgresql_CONFIG_tls_x3a__x3a_insecure=""` environment variable. - - regexp: 'pq: pg_stat_statements must be loaded via shared_preload_libraries' - first_only: true - log_record: - append_pattern: true - body: >- - Make sure your PostgreSQL database has - `shared_preload_libraries = 'pg_stat_statements'` - in the postgresql.conf file and that - `CREATE EXTENSION IF NOT EXISTS pg_stat_statements;` - has been run for each database you would like to monitor. - For example: - `psql --dbname "" -c "CREATE EXTENSION pg_stat_statements;"` + - status: failed + regexp: 'connect: network is unreachable' + first_only: true + log_record: + append_pattern: true + body: The container cannot be reached by the Collector. Make sure they're in the same network. + - status: failed + regexp: 'connect: connection refused' + first_only: true + log_record: + append_pattern: true + body: The container is refusing PostgreSQL connections. + - status: partial + regexp: 'pq: password authentication failed for user' + first_only: true + log_record: + append_pattern: true + body: >- + Please ensure your user credentials are correctly specified with + `--set splunk.discovery.receivers.postgresql.config.username=""` and + `--set splunk.discovery.receivers.postgresql.config.password=""` or + `SPLUNK_DISCOVERY_RECEIVERS_postgresql_CONFIG_username=""` and + `SPLUNK_DISCOVERY_RECEIVERS_postgresql_CONFIG_password=""` environment variables. + - status: partial + regexp: 'pq: database .* does not exist' + first_only: true + log_record: + append_pattern: true + body: >- + Make sure the target database is correctly specified using the + `--set splunk.discovery.receivers.postgresql.config.databases="[]"` command or the + `SPLUNK_DISCOVERY_RECEIVERS_postgresql_CONFIG_databases="[]"` environment variable. + - status: partial + regexp: 'pq: SSL is not enabled on the server' + first_only: true + log_record: + append_pattern: true + body: >- + Make sure the target database has SSL enabled or set insecure using the + `--set splunk.discovery.receivers.postgresql.config.tls::insecure=""` command or the + `SPLUNK_DISCOVERY_RECEIVERS_postgresql_CONFIG_tls_x3a__x3a_insecure=""` environment variable. + - status: partial + regexp: 'pq: pg_stat_statements must be loaded via shared_preload_libraries' + first_only: true + log_record: + append_pattern: true + body: >- + Make sure your PostgreSQL database has + `shared_preload_libraries = 'pg_stat_statements'` + in the postgresql.conf file and that + `CREATE EXTENSION IF NOT EXISTS pg_stat_statements;` + has been run for each database you would like to monitor. + For example: + `psql --dbname "" -c "CREATE EXTENSION pg_stat_statements;"` diff --git a/internal/confmapprovider/discovery/bundle/bundle.d/receivers/postgresql.discovery.yaml.tmpl b/internal/confmapprovider/discovery/bundle/bundle.d/receivers/postgresql.discovery.yaml.tmpl index 8eff38d888..68afa50839 100644 --- a/internal/confmapprovider/discovery/bundle/bundle.d/receivers/postgresql.discovery.yaml.tmpl +++ b/internal/confmapprovider/discovery/bundle/bundle.d/receivers/postgresql.discovery.yaml.tmpl @@ -10,59 +10,63 @@ password: {{ defaultValue }} status: metrics: - successful: - - strict: postgresql.commits - first_only: true - log_record: - body: PostgreSQL receiver is working! + - status: successful + strict: postgresql.commits + first_only: true + log_record: + body: PostgreSQL receiver is working! statements: - failed: - - regexp: 'connect: network is unreachable' - first_only: true - log_record: - append_pattern: true - body: The container cannot be reached by the Collector. Make sure they're in the same network. - - regexp: 'connect: connection refused' - first_only: true - log_record: - append_pattern: true - body: The container is refusing PostgreSQL connections. - partial: - - regexp: 'pq: password authentication failed for user' - first_only: true - log_record: - append_pattern: true - body: >- - Please ensure your user credentials are correctly specified with - `--set {{ configProperty "username" "" }}` and - `--set {{ configProperty "password" "" }}` or - `{{ configPropertyEnvVar "username" "" }}` and - `{{ configPropertyEnvVar "password" "" }}` environment variables. - - regexp: 'pq: database .* does not exist' - first_only: true - log_record: - append_pattern: true - body: >- - Make sure the target database is correctly specified using the - `--set {{ configProperty "databases" "[]" }}` command or the - `{{ configPropertyEnvVar "databases" "[]" }}` environment variable. - - regexp: 'pq: SSL is not enabled on the server' - first_only: true - log_record: - append_pattern: true - body: >- - Make sure the target database has SSL enabled or set insecure using the - `--set {{ configProperty "tls::insecure" "" }}` command or the - `{{ configPropertyEnvVar "tls::insecure" "" }}` environment variable. - - regexp: 'pq: pg_stat_statements must be loaded via shared_preload_libraries' - first_only: true - log_record: - append_pattern: true - body: >- - Make sure your PostgreSQL database has - `shared_preload_libraries = 'pg_stat_statements'` - in the postgresql.conf file and that - `CREATE EXTENSION IF NOT EXISTS pg_stat_statements;` - has been run for each database you would like to monitor. - For example: - `psql --dbname "" -c "CREATE EXTENSION pg_stat_statements;"` + - status: failed + regexp: 'connect: network is unreachable' + first_only: true + log_record: + append_pattern: true + body: The container cannot be reached by the Collector. Make sure they're in the same network. + - status: failed + regexp: 'connect: connection refused' + first_only: true + log_record: + append_pattern: true + body: The container is refusing PostgreSQL connections. + - status: partial + regexp: 'pq: password authentication failed for user' + first_only: true + log_record: + append_pattern: true + body: >- + Please ensure your user credentials are correctly specified with + `--set {{ configProperty "username" "" }}` and + `--set {{ configProperty "password" "" }}` or + `{{ configPropertyEnvVar "username" "" }}` and + `{{ configPropertyEnvVar "password" "" }}` environment variables. + - status: partial + regexp: 'pq: database .* does not exist' + first_only: true + log_record: + append_pattern: true + body: >- + Make sure the target database is correctly specified using the + `--set {{ configProperty "databases" "[]" }}` command or the + `{{ configPropertyEnvVar "databases" "[]" }}` environment variable. + - status: partial + regexp: 'pq: SSL is not enabled on the server' + first_only: true + log_record: + append_pattern: true + body: >- + Make sure the target database has SSL enabled or set insecure using the + `--set {{ configProperty "tls::insecure" "" }}` command or the + `{{ configPropertyEnvVar "tls::insecure" "" }}` environment variable. + - status: partial + regexp: 'pq: pg_stat_statements must be loaded via shared_preload_libraries' + first_only: true + log_record: + append_pattern: true + body: >- + Make sure your PostgreSQL database has + `shared_preload_libraries = 'pg_stat_statements'` + in the postgresql.conf file and that + `CREATE EXTENSION IF NOT EXISTS pg_stat_statements;` + has been run for each database you would like to monitor. + For example: + `psql --dbname "" -c "CREATE EXTENSION pg_stat_statements;"` diff --git a/internal/confmapprovider/discovery/bundle/bundle.d/receivers/redis.discovery.yaml b/internal/confmapprovider/discovery/bundle/bundle.d/receivers/redis.discovery.yaml index 048d4c68ac..ca49741d07 100644 --- a/internal/confmapprovider/discovery/bundle/bundle.d/receivers/redis.discovery.yaml +++ b/internal/confmapprovider/discovery/bundle/bundle.d/receivers/redis.discovery.yaml @@ -12,54 +12,58 @@ redis: default: {} status: metrics: - successful: - - strict: redis.uptime - first_only: true - log_record: - body: redis receiver is working! + - status: successful + strict: redis.uptime + first_only: true + log_record: + body: redis receiver is working! statements: - failed: - - regexp: "connection refused" - first_only: true - log_record: - append_pattern: true - body: The container is not serving http connections. - - regexp: "received goaway and there are no active streams" - first_only: true - log_record: - append_pattern: true - body: Unable to connect and scrape metrics. - - regexp: "dial tcp: lookup" - first_only: true - log_record: - append_pattern: true - body: Unable to resolve redis tcp endpoint - partial: - - regexp: 'NOAUTH Authentication required.' - first_only: true - log_record: - append_pattern: true - body: >- - Make sure your user credentials are correctly specified using the - `--set splunk.discovery.receivers.redis.config.password=""` and - `--set splunk.discovery.receivers.redis.config.username=""` commands or the - `SPLUNK_DISCOVERY_RECEIVERS_redis_CONFIG_password=""` and - `SPLUNK_DISCOVERY_RECEIVERS_redis_CONFIG_password=""` environment variables. - - regexp: 'called without any password configured for the default user' - first_only: true - log_record: - append_pattern: true - body: >- - Make sure your user credentials are correctly specified using the - `--set splunk.discovery.receivers.redis.config.password=""` command or the - `SPLUNK_DISCOVERY_RECEIVERS_redis_CONFIG_password=""` environment variables. - - regexp: 'WRONGPASS invalid username-password pair or user is disabled' - first_only: true - log_record: - append_pattern: true - body: >- - Make sure your user credentials are correctly specified using the - `--set splunk.discovery.receivers.redis.config.password=""` and - `--set splunk.discovery.receivers.redis.config.username=""` commands or the - `SPLUNK_DISCOVERY_RECEIVERS_redis_CONFIG_password=""` and - `SPLUNK_DISCOVERY_RECEIVERS_redis_CONFIG_password=""` environment variables. \ No newline at end of file + - status: failed + regexp: "connection refused" + first_only: true + log_record: + append_pattern: true + body: The container is not serving http connections. + - status: failed + regexp: "received goaway and there are no active streams" + first_only: true + log_record: + append_pattern: true + body: Unable to connect and scrape metrics. + - status: failed + regexp: "dial tcp: lookup" + first_only: true + log_record: + append_pattern: true + body: Unable to resolve redis tcp endpoint + - status: partial + regexp: 'NOAUTH Authentication required.' + first_only: true + log_record: + append_pattern: true + body: >- + Make sure your user credentials are correctly specified using the + `--set splunk.discovery.receivers.redis.config.password=""` and + `--set splunk.discovery.receivers.redis.config.username=""` commands or the + `SPLUNK_DISCOVERY_RECEIVERS_redis_CONFIG_password=""` and + `SPLUNK_DISCOVERY_RECEIVERS_redis_CONFIG_password=""` environment variables. + - status: partial + regexp: 'called without any password configured for the default user' + first_only: true + log_record: + append_pattern: true + body: >- + Make sure your user credentials are correctly specified using the + `--set splunk.discovery.receivers.redis.config.password=""` command or the + `SPLUNK_DISCOVERY_RECEIVERS_redis_CONFIG_password=""` environment variables. + - status: partial + regexp: 'WRONGPASS invalid username-password pair or user is disabled' + first_only: true + log_record: + append_pattern: true + body: >- + Make sure your user credentials are correctly specified using the + `--set splunk.discovery.receivers.redis.config.password=""` and + `--set splunk.discovery.receivers.redis.config.username=""` commands or the + `SPLUNK_DISCOVERY_RECEIVERS_redis_CONFIG_password=""` and + `SPLUNK_DISCOVERY_RECEIVERS_redis_CONFIG_password=""` environment variables. diff --git a/internal/confmapprovider/discovery/bundle/bundle.d/receivers/redis.discovery.yaml.tmpl b/internal/confmapprovider/discovery/bundle/bundle.d/receivers/redis.discovery.yaml.tmpl index ccc5fb2c08..09585b4f0e 100644 --- a/internal/confmapprovider/discovery/bundle/bundle.d/receivers/redis.discovery.yaml.tmpl +++ b/internal/confmapprovider/discovery/bundle/bundle.d/receivers/redis.discovery.yaml.tmpl @@ -8,54 +8,58 @@ default: {} status: metrics: - successful: - - strict: redis.uptime - first_only: true - log_record: - body: redis receiver is working! + - status: successful + strict: redis.uptime + first_only: true + log_record: + body: redis receiver is working! statements: - failed: - - regexp: "connection refused" - first_only: true - log_record: - append_pattern: true - body: The container is not serving http connections. - - regexp: "received goaway and there are no active streams" - first_only: true - log_record: - append_pattern: true - body: Unable to connect and scrape metrics. - - regexp: "dial tcp: lookup" - first_only: true - log_record: - append_pattern: true - body: Unable to resolve redis tcp endpoint - partial: - - regexp: 'NOAUTH Authentication required.' - first_only: true - log_record: - append_pattern: true - body: >- - Make sure your user credentials are correctly specified using the - `--set {{ configProperty "password" "" }}` and - `--set {{ configProperty "username" "" }}` commands or the - `{{ configPropertyEnvVar "password" "" }}` and - `{{ configPropertyEnvVar "password" "" }}` environment variables. - - regexp: 'called without any password configured for the default user' - first_only: true - log_record: - append_pattern: true - body: >- - Make sure your user credentials are correctly specified using the - `--set {{ configProperty "password" "" }}` command or the - `{{ configPropertyEnvVar "password" "" }}` environment variables. - - regexp: 'WRONGPASS invalid username-password pair or user is disabled' - first_only: true - log_record: - append_pattern: true - body: >- - Make sure your user credentials are correctly specified using the - `--set {{ configProperty "password" "" }}` and - `--set {{ configProperty "username" "" }}` commands or the - `{{ configPropertyEnvVar "password" "" }}` and - `{{ configPropertyEnvVar "password" "" }}` environment variables. \ No newline at end of file + - status: failed + regexp: "connection refused" + first_only: true + log_record: + append_pattern: true + body: The container is not serving http connections. + - status: failed + regexp: "received goaway and there are no active streams" + first_only: true + log_record: + append_pattern: true + body: Unable to connect and scrape metrics. + - status: failed + regexp: "dial tcp: lookup" + first_only: true + log_record: + append_pattern: true + body: Unable to resolve redis tcp endpoint + - status: partial + regexp: 'NOAUTH Authentication required.' + first_only: true + log_record: + append_pattern: true + body: >- + Make sure your user credentials are correctly specified using the + `--set {{ configProperty "password" "" }}` and + `--set {{ configProperty "username" "" }}` commands or the + `{{ configPropertyEnvVar "password" "" }}` and + `{{ configPropertyEnvVar "password" "" }}` environment variables. + - status: partial + regexp: 'called without any password configured for the default user' + first_only: true + log_record: + append_pattern: true + body: >- + Make sure your user credentials are correctly specified using the + `--set {{ configProperty "password" "" }}` command or the + `{{ configPropertyEnvVar "password" "" }}` environment variables. + - status: partial + regexp: 'WRONGPASS invalid username-password pair or user is disabled' + first_only: true + log_record: + append_pattern: true + body: >- + Make sure your user credentials are correctly specified using the + `--set {{ configProperty "password" "" }}` and + `--set {{ configProperty "username" "" }}` commands or the + `{{ configPropertyEnvVar "password" "" }}` and + `{{ configPropertyEnvVar "password" "" }}` environment variables. diff --git a/internal/confmapprovider/discovery/bundle/bundle.d/receivers/smartagent-collectd-mysql.discovery.yaml b/internal/confmapprovider/discovery/bundle/bundle.d/receivers/smartagent-collectd-mysql.discovery.yaml index 07afe0a611..32de9d0d5a 100644 --- a/internal/confmapprovider/discovery/bundle/bundle.d/receivers/smartagent-collectd-mysql.discovery.yaml +++ b/internal/confmapprovider/discovery/bundle/bundle.d/receivers/smartagent-collectd-mysql.discovery.yaml @@ -18,42 +18,44 @@ smartagent/collectd/mysql: isolatedCollectd: true status: metrics: - successful: - - strict: mysql_octets.rx - first_only: true - log_record: - body: smartagent/collectd/mysql receiver is working! + - status: successful + strict: mysql_octets.rx + first_only: true + log_record: + body: smartagent/collectd/mysql receiver is working! statements: - failed: - - regexp: "mysql plugin: Failed to connect to database .* at server .* Can't connect to MySQL server on .* [(]111[)]" - first_only: true - log_record: - append_pattern: true - body: The container is refusing MySQL connections. - partial: - - regexp: 'mysql plugin: Failed to connect to database .* at server .* Access denied for user .* [(]using password: .*[)]' - first_only: true - log_record: - append_pattern: true - body: >- - Make sure your user credentials are correctly specified using the - `--set splunk.discovery.receivers.smartagent/collectd/mysql.config.username=""` and - `--set splunk.discovery.receivers.smartagent/collectd/mysql.config.password=""` command or the - `SPLUNK_DISCOVERY_RECEIVERS_smartagent_x2f_collectd_x2f_mysql_CONFIG_username=""` and - `SPLUNK_DISCOVERY_RECEIVERS_smartagent_x2f_collectd_x2f_mysql_CONFIG_password=""` environment variables. - - regexp: 'mysql plugin: Failed to connect to database .* at server .* Unknown database' - first_only: true - log_record: - append_pattern: true - body: >- - Make sure your MySQL databases are correctly specified using the - `--set splunk.discovery.receivers.smartagent/collectd/mysql.config.databases="[{name: ''}, {name: '', username: '', password: ''}]"` command or the - `SPLUNK_DISCOVERY_RECEIVERS_smartagent_x2f_collectd_x2f_mysql_CONFIG_databases="[{name: ''}, {name: '', username: '', password: ''}]"` environment variable. - - regexp: 'mysql plugin: Failed to connect to database .* at server .* Access denied for user .* to database' - first_only: true - log_record: - append_pattern: true - body: >- - Make sure your MySQL databases and auth information are correctly specified using the - `--set splunk.discovery.receivers.smartagent/collectd/mysql.config.databases="[{name: ''}, {name: '', username: '', password: ''}]"` command or the - `SPLUNK_DISCOVERY_RECEIVERS_smartagent_x2f_collectd_x2f_mysql_CONFIG_databases="[{name: ''}, {name: '', username: '', password: ''}]"` environment variable. + - status: failed + regexp: "mysql plugin: Failed to connect to database .* at server .* Can't connect to MySQL server on .* [(]111[)]" + first_only: true + log_record: + append_pattern: true + body: The container is refusing MySQL connections. + - status: partial + regexp: 'mysql plugin: Failed to connect to database .* at server .* Access denied for user .* [(]using password: .*[)]' + first_only: true + log_record: + append_pattern: true + body: >- + Make sure your user credentials are correctly specified using the + `--set splunk.discovery.receivers.smartagent/collectd/mysql.config.username=""` and + `--set splunk.discovery.receivers.smartagent/collectd/mysql.config.password=""` command or the + `SPLUNK_DISCOVERY_RECEIVERS_smartagent_x2f_collectd_x2f_mysql_CONFIG_username=""` and + `SPLUNK_DISCOVERY_RECEIVERS_smartagent_x2f_collectd_x2f_mysql_CONFIG_password=""` environment variables. + - status: partial + regexp: 'mysql plugin: Failed to connect to database .* at server .* Unknown database' + first_only: true + log_record: + append_pattern: true + body: >- + Make sure your MySQL databases are correctly specified using the + `--set splunk.discovery.receivers.smartagent/collectd/mysql.config.databases="[{name: ''}, {name: '', username: '', password: ''}]"` command or the + `SPLUNK_DISCOVERY_RECEIVERS_smartagent_x2f_collectd_x2f_mysql_CONFIG_databases="[{name: ''}, {name: '', username: '', password: ''}]"` environment variable. + - status: partial + regexp: 'mysql plugin: Failed to connect to database .* at server .* Access denied for user .* to database' + first_only: true + log_record: + append_pattern: true + body: >- + Make sure your MySQL databases and auth information are correctly specified using the + `--set splunk.discovery.receivers.smartagent/collectd/mysql.config.databases="[{name: ''}, {name: '', username: '', password: ''}]"` command or the + `SPLUNK_DISCOVERY_RECEIVERS_smartagent_x2f_collectd_x2f_mysql_CONFIG_databases="[{name: ''}, {name: '', username: '', password: ''}]"` environment variable. diff --git a/internal/confmapprovider/discovery/bundle/bundle.d/receivers/smartagent-collectd-mysql.discovery.yaml.tmpl b/internal/confmapprovider/discovery/bundle/bundle.d/receivers/smartagent-collectd-mysql.discovery.yaml.tmpl index 8bab5dc704..18bf4f519f 100644 --- a/internal/confmapprovider/discovery/bundle/bundle.d/receivers/smartagent-collectd-mysql.discovery.yaml.tmpl +++ b/internal/confmapprovider/discovery/bundle/bundle.d/receivers/smartagent-collectd-mysql.discovery.yaml.tmpl @@ -14,42 +14,44 @@ isolatedCollectd: true status: metrics: - successful: - - strict: mysql_octets.rx - first_only: true - log_record: - body: smartagent/collectd/mysql receiver is working! + - status: successful + strict: mysql_octets.rx + first_only: true + log_record: + body: smartagent/collectd/mysql receiver is working! statements: - failed: - - regexp: "mysql plugin: Failed to connect to database .* at server .* Can't connect to MySQL server on .* [(]111[)]" - first_only: true - log_record: - append_pattern: true - body: The container is refusing MySQL connections. - partial: - - regexp: 'mysql plugin: Failed to connect to database .* at server .* Access denied for user .* [(]using password: .*[)]' - first_only: true - log_record: - append_pattern: true - body: >- - Make sure your user credentials are correctly specified using the - `--set {{ configProperty "username" "" }}` and - `--set {{ configProperty "password" "" }}` command or the - `{{ configPropertyEnvVar "username" "" }}` and - `{{ configPropertyEnvVar "password" "" }}` environment variables. - - regexp: 'mysql plugin: Failed to connect to database .* at server .* Unknown database' - first_only: true - log_record: - append_pattern: true - body: >- - Make sure your MySQL databases are correctly specified using the - `--set {{ configProperty "databases" "[{name: ''}, {name: '', username: '', password: ''}]" }}` command or the - `{{ configPropertyEnvVar "databases" "[{name: ''}, {name: '', username: '', password: ''}]" }}` environment variable. - - regexp: 'mysql plugin: Failed to connect to database .* at server .* Access denied for user .* to database' - first_only: true - log_record: - append_pattern: true - body: >- - Make sure your MySQL databases and auth information are correctly specified using the - `--set {{ configProperty "databases" "[{name: ''}, {name: '', username: '', password: ''}]" }}` command or the - `{{ configPropertyEnvVar "databases" "[{name: ''}, {name: '', username: '', password: ''}]" }}` environment variable. + - status: failed + regexp: "mysql plugin: Failed to connect to database .* at server .* Can't connect to MySQL server on .* [(]111[)]" + first_only: true + log_record: + append_pattern: true + body: The container is refusing MySQL connections. + - status: partial + regexp: 'mysql plugin: Failed to connect to database .* at server .* Access denied for user .* [(]using password: .*[)]' + first_only: true + log_record: + append_pattern: true + body: >- + Make sure your user credentials are correctly specified using the + `--set {{ configProperty "username" "" }}` and + `--set {{ configProperty "password" "" }}` command or the + `{{ configPropertyEnvVar "username" "" }}` and + `{{ configPropertyEnvVar "password" "" }}` environment variables. + - status: partial + regexp: 'mysql plugin: Failed to connect to database .* at server .* Unknown database' + first_only: true + log_record: + append_pattern: true + body: >- + Make sure your MySQL databases are correctly specified using the + `--set {{ configProperty "databases" "[{name: ''}, {name: '', username: '', password: ''}]" }}` command or the + `{{ configPropertyEnvVar "databases" "[{name: ''}, {name: '', username: '', password: ''}]" }}` environment variable. + - status: partial + regexp: 'mysql plugin: Failed to connect to database .* at server .* Access denied for user .* to database' + first_only: true + log_record: + append_pattern: true + body: >- + Make sure your MySQL databases and auth information are correctly specified using the + `--set {{ configProperty "databases" "[{name: ''}, {name: '', username: '', password: ''}]" }}` command or the + `{{ configPropertyEnvVar "databases" "[{name: ''}, {name: '', username: '', password: ''}]" }}` environment variable. diff --git a/internal/confmapprovider/discovery/bundle/bundle.d/receivers/smartagent-collectd-nginx.discovery.yaml b/internal/confmapprovider/discovery/bundle/bundle.d/receivers/smartagent-collectd-nginx.discovery.yaml index 7ddd4ab613..3bf4d3de96 100644 --- a/internal/confmapprovider/discovery/bundle/bundle.d/receivers/smartagent-collectd-nginx.discovery.yaml +++ b/internal/confmapprovider/discovery/bundle/bundle.d/receivers/smartagent-collectd-nginx.discovery.yaml @@ -16,20 +16,21 @@ smartagent/collectd/nginx: isolatedCollectd: true status: metrics: - successful: - - strict: connections.accepted - first_only: true - log_record: - body: smartagent/collectd/nginx receiver is working! + - status: successful + strict: connections.accepted + first_only: true + log_record: + body: smartagent/collectd/nginx receiver is working! statements: - failed: - - regexp: "nginx plugin: curl_easy_perform failed: Operation timed out after" - first_only: true - log_record: - append_pattern: true - body: The container is not serving http connections. - - regexp: "read-function of plugin .* failed" - first_only: true - log_record: - append_pattern: true - body: The integration is unable to read metrics from this endpoint. \ No newline at end of file + - status: failed + regexp: "nginx plugin: curl_easy_perform failed: Operation timed out after" + first_only: true + log_record: + append_pattern: true + body: The container is not serving http connections. + - status: failed + regexp: "read-function of plugin .* failed" + first_only: true + log_record: + append_pattern: true + body: The integration is unable to read metrics from this endpoint. \ No newline at end of file diff --git a/internal/confmapprovider/discovery/bundle/bundle.d/receivers/smartagent-collectd-nginx.discovery.yaml.tmpl b/internal/confmapprovider/discovery/bundle/bundle.d/receivers/smartagent-collectd-nginx.discovery.yaml.tmpl index 6e7bb8656c..0bd6490217 100644 --- a/internal/confmapprovider/discovery/bundle/bundle.d/receivers/smartagent-collectd-nginx.discovery.yaml.tmpl +++ b/internal/confmapprovider/discovery/bundle/bundle.d/receivers/smartagent-collectd-nginx.discovery.yaml.tmpl @@ -12,20 +12,21 @@ isolatedCollectd: true status: metrics: - successful: - - strict: connections.accepted - first_only: true - log_record: - body: smartagent/collectd/nginx receiver is working! + - status: successful + strict: connections.accepted + first_only: true + log_record: + body: smartagent/collectd/nginx receiver is working! statements: - failed: - - regexp: "nginx plugin: curl_easy_perform failed: Operation timed out after" - first_only: true - log_record: - append_pattern: true - body: The container is not serving http connections. - - regexp: "read-function of plugin .* failed" - first_only: true - log_record: - append_pattern: true - body: The integration is unable to read metrics from this endpoint. \ No newline at end of file + - status: failed + regexp: "nginx plugin: curl_easy_perform failed: Operation timed out after" + first_only: true + log_record: + append_pattern: true + body: The container is not serving http connections. + - status: failed + regexp: "read-function of plugin .* failed" + first_only: true + log_record: + append_pattern: true + body: The integration is unable to read metrics from this endpoint. \ No newline at end of file diff --git a/internal/confmapprovider/discovery/bundle/bundle.d/receivers/smartagent-postgresql.discovery.yaml b/internal/confmapprovider/discovery/bundle/bundle.d/receivers/smartagent-postgresql.discovery.yaml index ba2108c008..436c45f47a 100644 --- a/internal/confmapprovider/discovery/bundle/bundle.d/receivers/smartagent-postgresql.discovery.yaml +++ b/internal/confmapprovider/discovery/bundle/bundle.d/receivers/smartagent-postgresql.discovery.yaml @@ -18,61 +18,64 @@ smartagent/postgresql: masterDBName: splunk.discovery.default status: metrics: - successful: - - strict: postgres_query_count - first_only: true - log_record: - body: PostgreSQL receiver is working! - partial: - - strict: postgres_rows_inserted - first_only: true - log_record: - body: >- - Make sure that - `CREATE EXTENSION IF NOT EXISTS pg_stat_statements;` - has been run for each database you would like to monitor. - For example: - `psql --dbname "" -c "CREATE EXTENSION IF NOT EXISTS pg_stat_statements;"` + - status: successful + strict: postgres_query_count + first_only: true + log_record: + body: PostgreSQL receiver is working! + - status: partial + strict: postgres_rows_inserted + first_only: true + log_record: + body: >- + Make sure that + `CREATE EXTENSION IF NOT EXISTS pg_stat_statements;` + has been run for each database you would like to monitor. + For example: + `psql --dbname "" -c "CREATE EXTENSION IF NOT EXISTS pg_stat_statements;"` statements: - failed: - - regexp: 'connect: network is unreachable' - first_only: true - log_record: - append_pattern: true - body: The container cannot be reached by the Collector. Make sure they're in the same network. - - regexp: 'connect: connection refused' - first_only: true - log_record: - append_pattern: true - body: The container is refusing PostgreSQL connections. - partial: - - regexp: 'pq: password authentication failed for user' - first_only: true - log_record: - append_pattern: true - body: >- - Please ensure your user credentials are correctly specified with - `--set splunk.discovery.receivers.smartagent/postgresql.config.params::username=""` and - `--set splunk.discovery.receivers.smartagent/postgresql.config.params::password=""` or - `SPLUNK_DISCOVERY_RECEIVERS_smartagent_x2f_postgresql_CONFIG_params_x3a__x3a_username=""` and - `SPLUNK_DISCOVERY_RECEIVERS_smartagent_x2f_postgresql_CONFIG_params_x3a__x3a_password=""` environment variables. - - regexp: 'pq: database .* does not exist' - first_only: true - log_record: - append_pattern: true - body: >- - Make sure the target database is correctly specified using the - `--set splunk.discovery.receivers.smartagent/postgresql.config.masterDBName=""` command or the - `SPLUNK_DISCOVERY_RECEIVERS_smartagent_x2f_postgresql_CONFIG_masterDBName=""` environment variable. - - regexp: 'pq: pg_stat_statements must be loaded via shared_preload_libraries' - first_only: true - log_record: - append_pattern: true - body: >- - Make sure your PostgreSQL database has - `shared_preload_libraries = 'pg_stat_statements'` - in the postgresql.conf file and that - `CREATE EXTENSION IF NOT EXISTS pg_stat_statements;` - has been run for each database you would like to monitor. - For example: - `psql --dbname "" -c "CREATE EXTENSION pg_stat_statements;"` \ No newline at end of file + - status: failed + regexp: 'connect: network is unreachable' + first_only: true + log_record: + append_pattern: true + body: The container cannot be reached by the Collector. Make sure they're in the same network. + - status: failed + regexp: 'connect: connection refused' + first_only: true + log_record: + append_pattern: true + body: The container is refusing PostgreSQL connections. + - status: partial + regexp: 'pq: password authentication failed for user' + first_only: true + log_record: + append_pattern: true + body: >- + Please ensure your user credentials are correctly specified with + `--set splunk.discovery.receivers.smartagent/postgresql.config.params::username=""` and + `--set splunk.discovery.receivers.smartagent/postgresql.config.params::password=""` or + `SPLUNK_DISCOVERY_RECEIVERS_smartagent_x2f_postgresql_CONFIG_params_x3a__x3a_username=""` and + `SPLUNK_DISCOVERY_RECEIVERS_smartagent_x2f_postgresql_CONFIG_params_x3a__x3a_password=""` environment variables. + - status: partial + regexp: 'pq: database .* does not exist' + first_only: true + log_record: + append_pattern: true + body: >- + Make sure the target database is correctly specified using the + `--set splunk.discovery.receivers.smartagent/postgresql.config.masterDBName=""` command or the + `SPLUNK_DISCOVERY_RECEIVERS_smartagent_x2f_postgresql_CONFIG_masterDBName=""` environment variable. + - status: partial + regexp: 'pq: pg_stat_statements must be loaded via shared_preload_libraries' + first_only: true + log_record: + append_pattern: true + body: >- + Make sure your PostgreSQL database has + `shared_preload_libraries = 'pg_stat_statements'` + in the postgresql.conf file and that + `CREATE EXTENSION IF NOT EXISTS pg_stat_statements;` + has been run for each database you would like to monitor. + For example: + `psql --dbname "" -c "CREATE EXTENSION pg_stat_statements;"` diff --git a/internal/confmapprovider/discovery/bundle/bundle.d/receivers/smartagent-postgresql.discovery.yaml.tmpl b/internal/confmapprovider/discovery/bundle/bundle.d/receivers/smartagent-postgresql.discovery.yaml.tmpl index 27c4da4d3e..b6acbbdc43 100644 --- a/internal/confmapprovider/discovery/bundle/bundle.d/receivers/smartagent-postgresql.discovery.yaml.tmpl +++ b/internal/confmapprovider/discovery/bundle/bundle.d/receivers/smartagent-postgresql.discovery.yaml.tmpl @@ -14,61 +14,64 @@ masterDBName: {{ defaultValue }} status: metrics: - successful: - - strict: postgres_query_count - first_only: true - log_record: - body: PostgreSQL receiver is working! - partial: - - strict: postgres_rows_inserted - first_only: true - log_record: - body: >- - Make sure that - `CREATE EXTENSION IF NOT EXISTS pg_stat_statements;` - has been run for each database you would like to monitor. - For example: - `psql --dbname "" -c "CREATE EXTENSION IF NOT EXISTS pg_stat_statements;"` + - status: successful + strict: postgres_query_count + first_only: true + log_record: + body: PostgreSQL receiver is working! + - status: partial + strict: postgres_rows_inserted + first_only: true + log_record: + body: >- + Make sure that + `CREATE EXTENSION IF NOT EXISTS pg_stat_statements;` + has been run for each database you would like to monitor. + For example: + `psql --dbname "" -c "CREATE EXTENSION IF NOT EXISTS pg_stat_statements;"` statements: - failed: - - regexp: 'connect: network is unreachable' - first_only: true - log_record: - append_pattern: true - body: The container cannot be reached by the Collector. Make sure they're in the same network. - - regexp: 'connect: connection refused' - first_only: true - log_record: - append_pattern: true - body: The container is refusing PostgreSQL connections. - partial: - - regexp: 'pq: password authentication failed for user' - first_only: true - log_record: - append_pattern: true - body: >- - Please ensure your user credentials are correctly specified with - `--set {{ configProperty "params" "username" "" }}` and - `--set {{ configProperty "params" "password" "" }}` or - `{{ configPropertyEnvVar "params" "username" "" }}` and - `{{ configPropertyEnvVar "params" "password" "" }}` environment variables. - - regexp: 'pq: database .* does not exist' - first_only: true - log_record: - append_pattern: true - body: >- - Make sure the target database is correctly specified using the - `--set {{ configProperty "masterDBName" "" }}` command or the - `{{ configPropertyEnvVar "masterDBName" "" }}` environment variable. - - regexp: 'pq: pg_stat_statements must be loaded via shared_preload_libraries' - first_only: true - log_record: - append_pattern: true - body: >- - Make sure your PostgreSQL database has - `shared_preload_libraries = 'pg_stat_statements'` - in the postgresql.conf file and that - `CREATE EXTENSION IF NOT EXISTS pg_stat_statements;` - has been run for each database you would like to monitor. - For example: - `psql --dbname "" -c "CREATE EXTENSION pg_stat_statements;"` \ No newline at end of file + - status: failed + regexp: 'connect: network is unreachable' + first_only: true + log_record: + append_pattern: true + body: The container cannot be reached by the Collector. Make sure they're in the same network. + - status: failed + regexp: 'connect: connection refused' + first_only: true + log_record: + append_pattern: true + body: The container is refusing PostgreSQL connections. + - status: partial + regexp: 'pq: password authentication failed for user' + first_only: true + log_record: + append_pattern: true + body: >- + Please ensure your user credentials are correctly specified with + `--set {{ configProperty "params" "username" "" }}` and + `--set {{ configProperty "params" "password" "" }}` or + `{{ configPropertyEnvVar "params" "username" "" }}` and + `{{ configPropertyEnvVar "params" "password" "" }}` environment variables. + - status: partial + regexp: 'pq: database .* does not exist' + first_only: true + log_record: + append_pattern: true + body: >- + Make sure the target database is correctly specified using the + `--set {{ configProperty "masterDBName" "" }}` command or the + `{{ configPropertyEnvVar "masterDBName" "" }}` environment variable. + - status: partial + regexp: 'pq: pg_stat_statements must be loaded via shared_preload_libraries' + first_only: true + log_record: + append_pattern: true + body: >- + Make sure your PostgreSQL database has + `shared_preload_libraries = 'pg_stat_statements'` + in the postgresql.conf file and that + `CREATE EXTENSION IF NOT EXISTS pg_stat_statements;` + has been run for each database you would like to monitor. + For example: + `psql --dbname "" -c "CREATE EXTENSION pg_stat_statements;"` diff --git a/internal/receiver/discoveryreceiver/README.md b/internal/receiver/discoveryreceiver/README.md index e676628e93..20ed5b6147 100644 --- a/internal/receiver/discoveryreceiver/README.md +++ b/internal/receiver/discoveryreceiver/README.md @@ -151,23 +151,23 @@ receivers: // the metric or log statement status: metrics: - successful: - - regexp: '.*' - // Only emit a single log record for this status entry instead of one for each matching received metric (`false`, the default) - first_only: true - log_record: - body: Successfully able to connect to Redis container. + - status: successful + regexp: '.*' + // Only emit a single log record for this status entry instead of one for each matching received metric (`false`, the default) + first_only: true + log_record: + body: Successfully able to connect to Redis container. statements: - partial: - - regexp: (WRONGPASS|NOAUTH|ERR AUTH) - first_only: true - log_record: - body: Container appears to be accepting redis connections but the default auth setting is incorrect. - failed: - - regexp: ConnectionRefusedError - first_only: true - log_record: - body: Container appears to not be accepting redis connections. + - status: partial + regexp: (WRONGPASS|NOAUTH|ERR AUTH) + first_only: true + log_record: + body: Container appears to be accepting redis connections but the default auth setting is incorrect. + - status: failed + regexp: ConnectionRefusedError + first_only: true + log_record: + body: Container appears to not be accepting redis connections. exporters: debug: verbosity: detailed diff --git a/internal/receiver/discoveryreceiver/config.go b/internal/receiver/discoveryreceiver/config.go index 893fe72a7c..80a0809515 100644 --- a/internal/receiver/discoveryreceiver/config.go +++ b/internal/receiver/discoveryreceiver/config.go @@ -70,20 +70,22 @@ type ReceiverEntry struct { } // Status defines the Match rules for applicable app and telemetry sources. +// The first matching rule determines status of the endpoint. // At this time only Metrics and zap logger Statements status source types are supported. type Status struct { - Metrics map[discovery.StatusType][]Match `mapstructure:"metrics"` - Statements map[discovery.StatusType][]Match `mapstructure:"statements"` + Metrics []Match `mapstructure:"metrics"` + Statements []Match `mapstructure:"statements"` } // Match defines the rules for the desired match type and resulting log record // content emitted by the Discovery receiver type Match struct { - Record *LogRecord `mapstructure:"log_record"` - Strict string `mapstructure:"strict"` - Regexp string `mapstructure:"regexp"` - Expr string `mapstructure:"expr"` - FirstOnly bool `mapstructure:"first_only"` + Status discovery.StatusType `mapstructure:"status"` + Record *LogRecord `mapstructure:"log_record"` + Strict string `mapstructure:"strict"` + Regexp string `mapstructure:"regexp"` + Expr string `mapstructure:"expr"` + FirstOnly bool `mapstructure:"first_only"` } // LogRecord is a definition of the desired plog.LogRecord content to emit for a match. @@ -131,36 +133,34 @@ func (s *Status) validate() error { } if len(s.Metrics) == 0 && len(s.Statements) == 0 { - return fmt.Errorf("`status` must contain at least one `metrics` or `statements` mapping with at least one of %v", discovery.StatusTypes) + return fmt.Errorf("`status` must contain at least one `metrics` or `statements` list") } var err error statusSources := []struct { - matches map[discovery.StatusType][]Match sourceType string - }{{s.Metrics, "metrics"}, {s.Statements, "statements"}} + matches []Match + }{{"metrics", s.Metrics}, {"statements", s.Statements}} for _, statusSource := range statusSources { - for statusType, statements := range statusSource.matches { - if ok, e := discovery.IsValidStatus(statusType); !ok { - err = multierr.Combine(err, e) + for _, statement := range statusSource.matches { + if ok, e := discovery.IsValidStatus(statement.Status); !ok { + err = multierr.Combine(err, fmt.Errorf(`"%s" status match validation failed: %w`, statusSource.sourceType, e)) continue } - for _, logMatch := range statements { - var matchTypes []string - if logMatch.Strict != "" { - matchTypes = append(matchTypes, "strict") - } - if logMatch.Regexp != "" { - matchTypes = append(matchTypes, "regexp") - } - if logMatch.Expr != "" { - matchTypes = append(matchTypes, "expr") - } - if len(matchTypes) != 1 { - err = multierr.Combine(err, fmt.Errorf( - "`%s` status source type `%s` match type validation failed. Must provide one of %v but received %v", statusSource.sourceType, statusType, allowedMatchTypes, matchTypes, - )) - } + var matchTypes []string + if statement.Strict != "" { + matchTypes = append(matchTypes, "strict") + } + if statement.Regexp != "" { + matchTypes = append(matchTypes, "regexp") + } + if statement.Expr != "" { + matchTypes = append(matchTypes, "expr") + } + if len(matchTypes) != 1 { + err = multierr.Combine(err, fmt.Errorf( + `"%s" status match validation failed. Must provide one of %v but received %v`, statusSource.sourceType, allowedMatchTypes, matchTypes, + )) } } } diff --git a/internal/receiver/discoveryreceiver/config_test.go b/internal/receiver/discoveryreceiver/config_test.go index 0fda553d12..2f64c4b6a9 100644 --- a/internal/receiver/discoveryreceiver/config_test.go +++ b/internal/receiver/discoveryreceiver/config_test.go @@ -56,46 +56,43 @@ func TestValidConfig(t *testing.T) { "type": "collectd/redis", }, Status: &Status{ - Metrics: map[discovery.StatusType][]Match{ - discovery.Successful: { - Match{ - Record: &LogRecord{ - Attributes: map[string]string{ - "attr_one": "attr_one_val", - "attr_two": "attr_two_val", - }, - Body: "smartagent/redis receiver successful status", + Metrics: []Match{ + { + Status: discovery.Successful, + Record: &LogRecord{ + Attributes: map[string]string{ + "attr_one": "attr_one_val", + "attr_two": "attr_two_val", }, - Strict: "", - Regexp: ".*", - Expr: "", - FirstOnly: true, + Body: "smartagent/redis receiver successful status", }, + Strict: "", + Regexp: ".*", + Expr: "", + FirstOnly: true, }, }, - Statements: map[discovery.StatusType][]Match{ - discovery.Failed: { - { - Strict: "", - Regexp: "ConnectionRefusedError", - Expr: "", - FirstOnly: true, - Record: &LogRecord{ - Attributes: map[string]string{}, - Body: "container appears to not be accepting redis connections", - }, + Statements: []Match{ + { + Status: discovery.Failed, + Strict: "", + Regexp: "ConnectionRefusedError", + Expr: "", + FirstOnly: true, + Record: &LogRecord{ + Attributes: map[string]string{}, + Body: "container appears to not be accepting redis connections", }, }, - discovery.Partial: { - { - Strict: "", - Regexp: "(WRONGPASS|NOAUTH|ERR AUTH)", - Expr: "", - FirstOnly: false, - Record: &LogRecord{ - Attributes: nil, - Body: "desired log invalid auth log body", - }, + { + Status: discovery.Partial, + Strict: "", + Regexp: "(WRONGPASS|NOAUTH|ERR AUTH)", + Expr: "", + FirstOnly: false, + Record: &LogRecord{ + Attributes: nil, + Body: "desired log invalid auth log body", }, }, }, @@ -119,13 +116,13 @@ func TestValidConfig(t *testing.T) { } func TestInvalidConfigs(t *testing.T) { - tests := []struct{ name, expectedError string }{ {name: "no_watch_observers", expectedError: "`watch_observers` must be defined and include at least one configured observer extension"}, {name: "missing_status", expectedError: "receiver \"a_receiver\" validation failure: `status` must be defined and contain at least one `metrics` or `statements` mapping"}, + {name: "missing_match_status", expectedError: "receiver \"a_receiver\" validation failure: \"metrics\" status match validation failed: status cannot be empty; \"statements\" status match validation failed: status cannot be empty"}, {name: "missing_status_metrics_and_statements", expectedError: "receiver \"a_receiver\" validation failure: `status` must be defined and contain at least one `metrics` or `statements` mapping"}, - {name: "invalid_status_types", expectedError: `receiver "a_receiver" validation failure: invalid status "unsupported". must be one of [successful partial failed]; invalid status "another_unsupported". must be one of [successful partial failed]`}, - {name: "multiple_status_match_types", expectedError: "receiver \"a_receiver\" validation failure: `metrics` status source type `successful` match type validation failed. Must provide one of [regexp strict expr] but received [strict regexp]; `statements` status source type `failed` match type validation failed. Must provide one of [regexp strict expr] but received [strict expr]"}, + {name: "invalid_status_types", expectedError: `receiver "a_receiver" validation failure: "metrics" status match validation failed: invalid status "unsupported". must be one of [successful partial failed]; "statements" status match validation failed: invalid status "another_unsupported". must be one of [successful partial failed]`}, + {name: "multiple_status_match_types", expectedError: "receiver \"a_receiver\" validation failure: \"metrics\" status match validation failed. Must provide one of [regexp strict expr] but received [strict regexp]; \"statements\" status match validation failed. Must provide one of [regexp strict expr] but received [strict expr]"}, {name: "reserved_receiver_creator", expectedError: `receiver "receiver_creator/with-name" validation failure: receiver cannot be a receiver_creator`}, {name: "reserved_receiver_name", expectedError: `receiver "a_receiver/with-receiver_creator/in-name" validation failure: receiver name cannot contain "receiver_creator/"`}, {name: "reserved_receiver_name_with_endpoint", expectedError: `receiver "receiver/with{endpoint=}/" validation failure: receiver name cannot contain "{endpoint=[^}]*}/"`}, diff --git a/internal/receiver/discoveryreceiver/metric_evaluator.go b/internal/receiver/discoveryreceiver/metric_evaluator.go index 2e4b9990c0..c1400fccf7 100644 --- a/internal/receiver/discoveryreceiver/metric_evaluator.go +++ b/internal/receiver/discoveryreceiver/metric_evaluator.go @@ -112,50 +112,48 @@ func (m *metricEvaluator) evaluateMetrics(md pmetric.Metrics) plog.Logs { } } - for status, matches := range rEntry.Status.Metrics { - for _, match := range matches { - for metricName, metrics := range receiverMetrics { - for _, metric := range metrics { - if shouldLog, err := m.evaluateMatch(match, metricName, status, receiverID, endpointID); err != nil { - m.logger.Info(fmt.Sprintf("Error evaluating %s metric match", status), zap.Error(err)) - continue - } else if !shouldLog { - continue - } - - pLogs := plog.NewLogs() - rLog := pLogs.ResourceLogs().AppendEmpty() - rAttrs := rLog.Resource().Attributes() - m.correlateResourceAttributes( - md.ResourceMetrics().At(0).Resource().Attributes(), rAttrs, - m.correlations.GetOrCreate(receiverID, endpointID), - ) - rAttrs.PutStr(eventTypeAttr, metricMatch) - rAttrs.PutStr(receiverRuleAttr, rEntry.Rule) - - logRecords := rLog.ScopeLogs().AppendEmpty().LogRecords() - - logRecord := logRecords.AppendEmpty() - desiredRecord := match.Record - if desiredRecord == nil { - desiredRecord = &LogRecord{} - } - var desiredBody string - if desiredRecord.Body != "" { - desiredBody = desiredRecord.Body - } - logRecord.Body().SetStr(desiredBody) - for k, v := range desiredRecord.Attributes { - logRecord.Attributes().PutStr(k, v) - } - logRecord.Attributes().PutStr(metricNameAttr, metricName) - logRecord.Attributes().PutStr(discovery.StatusAttr, string(status)) - if ts := m.timestampFromMetric(metric); ts != nil { - logRecord.SetTimestamp(*ts) - } - logRecord.SetObservedTimestamp(pcommon.NewTimestampFromTime(time.Now())) - return pLogs + for _, match := range rEntry.Status.Metrics { + for metricName, metrics := range receiverMetrics { + for _, metric := range metrics { + if shouldLog, err := m.evaluateMatch(match, metricName, match.Status, receiverID, endpointID); err != nil { + m.logger.Info(fmt.Sprintf("Error evaluating %s metric match", metricName), zap.Error(err)) + continue + } else if !shouldLog { + continue } + + pLogs := plog.NewLogs() + rLog := pLogs.ResourceLogs().AppendEmpty() + rAttrs := rLog.Resource().Attributes() + m.correlateResourceAttributes( + md.ResourceMetrics().At(0).Resource().Attributes(), rAttrs, + m.correlations.GetOrCreate(receiverID, endpointID), + ) + rAttrs.PutStr(eventTypeAttr, metricMatch) + rAttrs.PutStr(receiverRuleAttr, rEntry.Rule) + + logRecords := rLog.ScopeLogs().AppendEmpty().LogRecords() + + logRecord := logRecords.AppendEmpty() + desiredRecord := match.Record + if desiredRecord == nil { + desiredRecord = &LogRecord{} + } + var desiredBody string + if desiredRecord.Body != "" { + desiredBody = desiredRecord.Body + } + logRecord.Body().SetStr(desiredBody) + for k, v := range desiredRecord.Attributes { + logRecord.Attributes().PutStr(k, v) + } + logRecord.Attributes().PutStr(metricNameAttr, metricName) + logRecord.Attributes().PutStr(discovery.StatusAttr, string(match.Status)) + if ts := m.timestampFromMetric(metric); ts != nil { + logRecord.SetTimestamp(*ts) + } + logRecord.SetObservedTimestamp(pcommon.NewTimestampFromTime(time.Now())) + return pLogs } } } diff --git a/internal/receiver/discoveryreceiver/metric_evaluator_test.go b/internal/receiver/discoveryreceiver/metric_evaluator_test.go index 08934b874b..0164f84757 100644 --- a/internal/receiver/discoveryreceiver/metric_evaluator_test.go +++ b/internal/receiver/discoveryreceiver/metric_evaluator_test.go @@ -67,6 +67,7 @@ func TestMetricEvaluation(t *testing.T) { }, } for _, status := range discovery.StatusTypes { + match.Status = status t.Run(string(status), func(t *testing.T) { for _, firstOnly := range []bool{true, false} { match.FirstOnly = firstOnly @@ -76,7 +77,7 @@ func TestMetricEvaluation(t *testing.T) { Receivers: map[component.ID]ReceiverEntry{ component.MustNewIDWithName("a_receiver", "receiver.name"): { Rule: "a.rule", - Status: &Status{Metrics: map[discovery.StatusType][]Match{status: {match}}}, + Status: &Status{Metrics: []Match{match}}, }, }, WatchObservers: []component.ID{observerID}, diff --git a/internal/receiver/discoveryreceiver/statement_evaluator.go b/internal/receiver/discoveryreceiver/statement_evaluator.go index de13d96fe8..eb3110d8fa 100644 --- a/internal/receiver/discoveryreceiver/statement_evaluator.go +++ b/internal/receiver/discoveryreceiver/statement_evaluator.go @@ -172,43 +172,41 @@ func (se *statementEvaluator) evaluateStatement(statement *statussources.Stateme } se.logger.Debug("non-strict matches will be evaluated with pattern map", zap.String("map", patternMapStr)) - for status, matches := range rEntry.Status.Statements { - for _, match := range matches { - p := patternMapStr - if match.Strict != "" { - p = statement.Message - } - if shouldLog, err := se.evaluateMatch(match, p, status, receiverID, endpointID); err != nil { - se.logger.Info(fmt.Sprintf("Error evaluating %s statement match", status), zap.Error(err)) - continue - } else if !shouldLog { - continue - } + for _, match := range rEntry.Status.Statements { + p := patternMapStr + if match.Strict != "" { + p = statement.Message + } + if shouldLog, err := se.evaluateMatch(match, p, match.Status, receiverID, endpointID); err != nil { + se.logger.Info("Error evaluating statement match", zap.Error(err)) + continue + } else if !shouldLog { + continue + } - pLogs, logRecords := se.prepareMatchingLogs(rEntry, receiverID, endpointID) - logRecord := logRecords.AppendEmpty() - var desiredRecord LogRecord - if match.Record != nil { - desiredRecord = *match.Record - } - statementLogRecord.CopyTo(logRecord) - if desiredRecord.Body != "" { - body := desiredRecord.Body - if desiredRecord.AppendPattern { - body = fmt.Sprintf("%s (evaluated %q)", body, p) - } - logRecord.Body().SetStr(body) + pLogs, logRecords := se.prepareMatchingLogs(rEntry, receiverID, endpointID) + logRecord := logRecords.AppendEmpty() + var desiredRecord LogRecord + if match.Record != nil { + desiredRecord = *match.Record + } + statementLogRecord.CopyTo(logRecord) + if desiredRecord.Body != "" { + body := desiredRecord.Body + if desiredRecord.AppendPattern { + body = fmt.Sprintf("%s (evaluated %q)", body, p) } - if len(desiredRecord.Attributes) > 0 { - for k, v := range desiredRecord.Attributes { - logRecord.Attributes().PutStr(k, v) - } + logRecord.Body().SetStr(body) + } + if len(desiredRecord.Attributes) > 0 { + for k, v := range desiredRecord.Attributes { + logRecord.Attributes().PutStr(k, v) } - logRecord.Attributes().PutStr(discovery.StatusAttr, string(status)) - logRecord.SetTimestamp(pcommon.NewTimestampFromTime(statement.Time)) - logRecord.SetObservedTimestamp(pcommon.NewTimestampFromTime(time.Now())) - return pLogs } + logRecord.Attributes().PutStr(discovery.StatusAttr, string(match.Status)) + logRecord.SetTimestamp(pcommon.NewTimestampFromTime(statement.Time)) + logRecord.SetObservedTimestamp(pcommon.NewTimestampFromTime(time.Now())) + return pLogs } return plog.NewLogs() } diff --git a/internal/receiver/discoveryreceiver/statement_evaluator_test.go b/internal/receiver/discoveryreceiver/statement_evaluator_test.go index 74cba6be54..03c0dcde48 100644 --- a/internal/receiver/discoveryreceiver/statement_evaluator_test.go +++ b/internal/receiver/discoveryreceiver/statement_evaluator_test.go @@ -52,6 +52,7 @@ func TestStatementEvaluation(t *testing.T) { }, } for _, status := range discovery.StatusTypes { + match.Status = status t.Run(string(status), func(t *testing.T) { for _, firstOnly := range []bool{true, false} { match.FirstOnly = firstOnly @@ -61,7 +62,7 @@ func TestStatementEvaluation(t *testing.T) { Receivers: map[component.ID]ReceiverEntry{ component.MustNewIDWithName("a_receiver", "receiver.name"): { Rule: "a.rule", - Status: &Status{Statements: map[discovery.StatusType][]Match{status: {match}}}, + Status: &Status{Statements: []Match{match}}, }, }, WatchObservers: []component.ID{observerID}, diff --git a/internal/receiver/discoveryreceiver/testdata/config.yaml b/internal/receiver/discoveryreceiver/testdata/config.yaml index f2a6e6e2eb..3c0b632b8d 100644 --- a/internal/receiver/discoveryreceiver/testdata/config.yaml +++ b/internal/receiver/discoveryreceiver/testdata/config.yaml @@ -17,23 +17,23 @@ discovery/discovery-name: receiver_attribute: receiver_attribute_value status: metrics: - successful: - - regexp: '.*' - first_only: true - log_record: - body: smartagent/redis receiver successful status - attributes: - attr_one: attr_one_val - attr_two: attr_two_val + - status: successful + regexp: '.*' + first_only: true + log_record: + body: smartagent/redis receiver successful status + attributes: + attr_one: attr_one_val + attr_two: attr_two_val statements: - failed: - - regexp: ConnectionRefusedError - first_only: true - log_record: - attributes: {} - body: container appears to not be accepting redis connections - partial: - - regexp: (WRONGPASS|NOAUTH|ERR AUTH) - first_only: false - log_record: - body: desired log invalid auth log body + - status: failed + regexp: ConnectionRefusedError + first_only: true + log_record: + attributes: {} + body: container appears to not be accepting redis connections + - status: partial + regexp: (WRONGPASS|NOAUTH|ERR AUTH) + first_only: false + log_record: + body: desired log invalid auth log body diff --git a/internal/receiver/discoveryreceiver/testdata/invalid_status_types.yaml b/internal/receiver/discoveryreceiver/testdata/invalid_status_types.yaml index f985a26f28..b22dc69b6c 100644 --- a/internal/receiver/discoveryreceiver/testdata/invalid_status_types.yaml +++ b/internal/receiver/discoveryreceiver/testdata/invalid_status_types.yaml @@ -6,8 +6,8 @@ discovery: rule: a rule status: metrics: - unsupported: - - regexp: '.*' + - status: unsupported + regexp: '.*' statements: - another_unsupported: - - regexp: '.*' + - status: another_unsupported + regexp: '.*' diff --git a/internal/receiver/discoveryreceiver/testdata/missing_match_status.yaml b/internal/receiver/discoveryreceiver/testdata/missing_match_status.yaml new file mode 100644 index 0000000000..dae4751a84 --- /dev/null +++ b/internal/receiver/discoveryreceiver/testdata/missing_match_status.yaml @@ -0,0 +1,11 @@ +discovery: + watch_observers: + - an_observer + receivers: + a_receiver: + rule: a rule + status: + metrics: + - regexp: '.*' + statements: + - regexp: '.*' diff --git a/internal/receiver/discoveryreceiver/testdata/multiple_status_match_types.yaml b/internal/receiver/discoveryreceiver/testdata/multiple_status_match_types.yaml index 9ed8719219..390dbac47f 100644 --- a/internal/receiver/discoveryreceiver/testdata/multiple_status_match_types.yaml +++ b/internal/receiver/discoveryreceiver/testdata/multiple_status_match_types.yaml @@ -6,10 +6,10 @@ discovery: rule: a rule status: metrics: - successful: - - regexp: 'a regex' - strict: 'a strict' + - status: successful + regexp: 'a regex' + strict: 'a strict' statements: - failed: - - strict: 'another strict' - expr: 'an expr' + - status: failed + strict: 'another strict' + expr: 'an expr' diff --git a/internal/receiver/discoveryreceiver/testdata/reserved_receiver_creator.yaml b/internal/receiver/discoveryreceiver/testdata/reserved_receiver_creator.yaml index 99f05d904c..21eeaa300d 100644 --- a/internal/receiver/discoveryreceiver/testdata/reserved_receiver_creator.yaml +++ b/internal/receiver/discoveryreceiver/testdata/reserved_receiver_creator.yaml @@ -6,5 +6,5 @@ discovery: rule: a rule status: metrics: - successful: - - regexp: '.*' + - status: successful + regexp: '.*' diff --git a/internal/receiver/discoveryreceiver/testdata/reserved_receiver_name.yaml b/internal/receiver/discoveryreceiver/testdata/reserved_receiver_name.yaml index 8ec58f590c..d8181b6a9d 100644 --- a/internal/receiver/discoveryreceiver/testdata/reserved_receiver_name.yaml +++ b/internal/receiver/discoveryreceiver/testdata/reserved_receiver_name.yaml @@ -6,5 +6,5 @@ discovery: rule: a rule status: metrics: - successful: - - regexp: '.*' + - status: successful + regexp: '.*' diff --git a/internal/receiver/discoveryreceiver/testdata/reserved_receiver_name_with_endpoint.yaml b/internal/receiver/discoveryreceiver/testdata/reserved_receiver_name_with_endpoint.yaml index 6435f95359..782824fe33 100644 --- a/internal/receiver/discoveryreceiver/testdata/reserved_receiver_name_with_endpoint.yaml +++ b/internal/receiver/discoveryreceiver/testdata/reserved_receiver_name_with_endpoint.yaml @@ -6,5 +6,5 @@ discovery: rule: a rule status: metrics: - successful: - - regexp: '.*' + - status: successful + regexp: '.*' diff --git a/tests/general/discoverymode/testdata/docker-observer-config.d/receivers/internal-prometheus.discovery.yaml b/tests/general/discoverymode/testdata/docker-observer-config.d/receivers/internal-prometheus.discovery.yaml index 686b9a6018..bc34298f9b 100644 --- a/tests/general/discoverymode/testdata/docker-observer-config.d/receivers/internal-prometheus.discovery.yaml +++ b/tests/general/discoverymode/testdata/docker-observer-config.d/receivers/internal-prometheus.discovery.yaml @@ -15,8 +15,8 @@ prometheus_simple: label_four: overwritten by env var property status: metrics: - successful: - - strict: prometheus_tsdb_time_retentions_total - first_only: true - log_record: - body: prometheus detected + - status: successful + strict: prometheus_tsdb_time_retentions_total + first_only: true + log_record: + body: prometheus detected diff --git a/tests/general/discoverymode/testdata/host-observer-config.d/receivers/internal-prometheus.discovery.yaml b/tests/general/discoverymode/testdata/host-observer-config.d/receivers/internal-prometheus.discovery.yaml index cac5863574..b4eecf9715 100644 --- a/tests/general/discoverymode/testdata/host-observer-config.d/receivers/internal-prometheus.discovery.yaml +++ b/tests/general/discoverymode/testdata/host-observer-config.d/receivers/internal-prometheus.discovery.yaml @@ -18,8 +18,8 @@ prometheus_simple: label_two: ${LABEL_TWO_VALUE} status: metrics: - successful: - - strict: otelcol_process_uptime - first_only: true - log_record: - body: internal collector prometheus exporter detected + - status: successful + strict: otelcol_process_uptime + first_only: true + log_record: + body: internal collector prometheus exporter detected diff --git a/tests/receivers/discovery/testdata/host_observer_simple_prometheus_config.yaml b/tests/receivers/discovery/testdata/host_observer_simple_prometheus_config.yaml index 806363a92d..32218cda43 100644 --- a/tests/receivers/discovery/testdata/host_observer_simple_prometheus_config.yaml +++ b/tests/receivers/discovery/testdata/host_observer_simple_prometheus_config.yaml @@ -19,26 +19,28 @@ receivers: two.key: two.value status: metrics: - successful: - - regexp: ^otelcol_process_uptime$ - first_only: true - log_record: - body: Successfully connected to prometheus server + - status: successful + regexp: ^otelcol_process_uptime$ + first_only: true + log_record: + body: Successfully connected to prometheus server statements: - failed: - # Only the first matching statement match will be logged - - strict: Failed to scrape Prometheus endpoint - first_only: true - log_record: - body: (strict) Port appears to not be serving prometheus metrics - - regexp: '"message":"Failed to scrape Prometheus endpoint"' - first_only: true - log_record: - body: (regexp) Port appears to not be serving prometheus metrics - - expr: message == 'Failed to scrape Prometheus endpoint' && target_labels contains 'up' - first_only: true - log_record: - body: (expr) Port appears to not be serving prometheus metrics + # Only the first matching statement match will be applied + - status: failed + strict: Failed to scrape Prometheus endpoint + first_only: true + log_record: + body: (strict) Port appears to not be serving prometheus metrics + - status: failed + regexp: '"message":"Failed to scrape Prometheus endpoint"' + first_only: true + log_record: + body: (regexp) Port appears to not be serving prometheus metrics + - status: failed + expr: message == 'Failed to scrape Prometheus endpoint' && target_labels contains 'up' + first_only: true + log_record: + body: (expr) Port appears to not be serving prometheus metrics watch_observers: - host_observer