Hi Grafana team im a newbie and i want to scrape data from a digital ocean mysql database using Grafana Alloy, i get the following error and im confused on what im doing wrong:
Error: /etc/alloy/config.alloy:66:1: Failed to build component: decoding configuration: invalid value / unknown config name: true
prometheus.exporter.mysql "integrations_mysqld_exporter" {
_^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
data_source_name = local.file.mysql_secret.content
}
|_^
this is my config file:
prometheus.exporter.self "alloy_check" { }
discovery.relabel "alloy_check" {
targets = prometheus.exporter.self.alloy_check.targets
rule {
target_label = "instance"
replacement = constants.hostname
}
rule {
target_label = "alloy_hostname"
replacement = constants.hostname
}
rule {
target_label = "job"
replacement = "integrations/alloy-check"
}
}
prometheus.scrape "alloy_check" {
targets = discovery.relabel.alloy_check.output
forward_to = [prometheus.relabel.alloy_check.receiver]
scrape_interval = "60s"
}
prometheus.relabel "alloy_check" {
forward_to = [prometheus.remote_write.metrics_service.receiver]
rule {
source_labels = ["__name__"]
regex = "(prometheus_target_sync_length_seconds_sum|prometheus_target_scrapes_.*|prometheus_target_interval.*|prometheus_sd_discovered_targets|alloy_build.*|prometheus_remote_write_wal_samples_appended_total|process_start_time_seconds)"
action = "keep"
}
}
prometheus.remote_write "metrics_service" {
endpoint {
url = "https://prometheus-prod-13-prod-us-east-0.grafana.net/api/prom/push"
basic_auth {
username = "1649549"
password = "glc_eyJvIjoiMTE1NzI1NSIsIm4iOiJzdGFjay05NjY5MTgtaW50ZWdyYXRpb24tbXlzcWwtY29sbGVjdG9yIiwiayI6Imp4V3doN2ozV3ZuMTcwSzdMWjUwOUh6MSIsIm0iOnsiciI6InByb2QtdXMtZWFzdC0wIn19"
}
}
}
loki.write "grafana_cloud_loki" {
endpoint {
url = "https://logs-prod-006.grafana.net/loki/api/v1/push"
basic_auth {
username = "924698"
password = "glc_eyJvIjoiMTE1NzI1NSIsIm4iOiJzdGFjay05NjY5MTgtaW50ZWdyYXRpb24tbXlzcWwtY29sbGVjdG9yIiwiayI6Imp4V3doN2ozV3ZuMTcwSzdMWjUwOUh6MSIsIm0iOnsiciI6InByb2QtdXMtZWFzdC0wIn19"
}
}
}
local.file "mysql_secret" {
filename = "/var/lib/alloy/mysql-secret"
is_secret = true
}
prometheus.exporter.mysql "integrations_mysqld_exporter" {
data_source_name = local.file.mysql_secret.content
}
discovery.relabel "integrations_mysqld_exporter" {
targets = prometheus.exporter.mysql.integrations_mysqld_exporter.targets
rule {
target_label = "job"
replacement = "integrations/mysql"
}
rule {
target_label = "instance"
replacement = "DO_AFROAI_DB"
}
}
prometheus.relabel "integrations_mysqld_exporter" {
forward_to = [prometheus.remote_write.metrics_service.receiver]
rule {
action = "keep"
regex = "up|instance:mysql_heartbeat_lag_seconds|instance:mysql_slave_lag_seconds|mysql_global_status_aborted_clients|mysql_global_status_aborted_connects|mysql_global_status_buffer_pool_pages|mysql_global_status_bytes_received|mysql_global_status_bytes_sent|mysql_global_status_commands_total|mysql_global_status_created_tmp_disk_tables|mysql_global_status_created_tmp_files|mysql_global_status_created_tmp_tables|mysql_global_status_handlers_total|mysql_global_status_innodb_log_waits|mysql_global_status_innodb_mem_adaptive_hash|mysql_global_status_innodb_mem_dictionary|mysql_global_status_innodb_num_open_files|mysql_global_status_innodb_page_size|mysql_global_status_max_used_connections|mysql_global_status_open_files|mysql_global_status_open_table_definitions|mysql_global_status_open_tables|mysql_global_status_opened_files|mysql_global_status_opened_table_definitions|mysql_global_status_opened_tables|mysql_global_status_qcache_free_memory|mysql_global_status_qcache_hits|mysql_global_status_qcache_inserts|mysql_global_status_qcache_lowmem_prunes|mysql_global_status_qcache_not_cached|mysql_global_status_qcache_queries_in_cache|mysql_global_status_queries|mysql_global_status_questions|mysql_global_status_select_full_join|mysql_global_status_select_full_range_join|mysql_global_status_select_range|mysql_global_status_select_range_check|mysql_global_status_select_scan|mysql_global_status_slow_queries|mysql_global_status_sort_merge_passes|mysql_global_status_sort_range|mysql_global_status_sort_rows|mysql_global_status_sort_scan|mysql_global_status_table_locks_immediate|mysql_global_status_table_locks_waited|mysql_global_status_table_open_cache_hits|mysql_global_status_table_open_cache_misses|mysql_global_status_table_open_cache_overflows|mysql_global_status_threads_cached|mysql_global_status_threads_connected|mysql_global_status_threads_created|mysql_global_status_threads_running|mysql_global_status_uptime|mysql_global_status_wsrep_local_recv_queue|mysql_global_status_wsrep_local_state|mysql_global_status_wsrep_ready|mysql_global_variables_innodb_additional_mem_pool_size|mysql_global_variables_innodb_buffer_pool_size|mysql_global_variables_innodb_log_buffer_size|mysql_global_variables_key_buffer_size|mysql_global_variables_max_connections|mysql_global_variables_open_files_limit|mysql_global_variables_query_cache_size|mysql_global_variables_table_definition_cache|mysql_global_variables_table_open_cache|mysql_global_variables_thread_cache_size|mysql_global_variables_tokudb_cache_size|mysql_global_variables_wsrep_desync|mysql_heartbeat_now_timestamp_seconds|mysql_heartbeat_stored_timestamp_seconds|mysql_info_schema_processlist_threads|mysql_slave_status_seconds_behind_master|mysql_slave_status_slave_io_running|mysql_slave_status_slave_sql_running|mysql_slave_status_sql_delay|mysql_up"
source_labels = ["__name__"]
}
}
prometheus.scrape "integrations_mysqld_exporter" {
targets = discovery.relabel.integrations_mysqld_exporter.output
forward_to = [prometheus.relabel.integrations_mysqld_exporter.receiver]
job_name = "integrations/mysqld_exporter"
}
local.file_match "logs_integrations_mysql" {
path_targets = [{
__address__ = "localhost",
__path__ = "/var/log/mysql/*.log",
instance = "DO_AFROAI_DB",
job = "integrations/mysql",
}]
}
loki.process "logs_integrations_mysql" {
forward_to = [loki.write.grafana_cloud_loki.receiver]
stage.regex {
expression = "(?P<timestamp>.+) (?P<thread>[\\d]+) \\[(?P<label>.+?)\\]( \\[(?P<err_code>.+?)\\] \\[(?P<subsystem>.+?)\\])? (?P<msg>.+)"
}
stage.labels {
values = {
err_code = null,
level = "label",
subsystem = null,
}
}
stage.drop {
drop_counter_reason = "drop empty lines"
expression = "^ *$"
}
}
loki.source.file "logs_integrations_mysql" {
targets = local.file_match.logs_integrations_mysql.targets
forward_to = [loki.process.logs_integrations_mysql.receiver]