;配置Grafana Agent;integrations_config;mongodb_exporter_config

mongodb_exporter_config

mongodb_exporter_configBlock配置mongodb_exporter集成,这是percona的嵌入式版本mongodb_exporter

为了使这种集成正常工作,您必须将mongoDB集群的每个节点连接到一个代理实例。这是因为这个导出器不从多个节点收集度量。此外,您需要使用relabel_configs为您的指标定义两个自定义标签。第一个是service_name,用于标识集群中的这个节点(例如:ReplicaSet1-Node1)。第二个是mongodb_cluster,这是mongodb集群的名称,必须为组成集群的所有节点设置相同的值(例如:prod-cluster)。这里有一个例子:

Relabel_configs:—source_labels: [__address__] target_label: service_name replacement: 'replicaset1-node1'—source_labels: [__address__] target_label: mongodb_cluster replacement: 'prod-cluster'

我们强烈建议您为Agent配置一个单独的用户,并仅为其提供监视节点所需的严格强制的安全特权官方文档

除此之外,没有太多要配置的东西。请参阅选项的完整参考:

#启用mongodb_export集成[enabled:  | default = false] #设置集成#自抓取时实例标签的显式值。重写推断的值。此集成的默认值是从mongodb_uri字段的hostname #部分推断出来的。[instance: ] #从此集成中自动收集指标。如果禁用,# mongodb_export集成将运行,但不会被删除,因此不会被远程编写。集成的度量将在# /integration /mongodb_export / Metrics中公开,并且可以通过外部#进程获取。[scrape_integration:  | default =  | default = ] # The timeout before considering the scrape a failure. Defaults to # metrics.global.scrape_timeout. [scrape_timeout:  | default = ] # Allows for relabeling labels on the target. relabel_configs: [-  ... ] # Relabel metrics coming from the integration, allowing to drop series # from the integration that you don't care about. metric_relabel_configs: [ -  ... ] # How frequent to truncate the WAL for this integration. [wal_truncate_frequency:  | default = "60m"] # Monitor the exporter itself and include those metrics in the results. [include_exporter_metrics:  | default = false] # # Exporter-specific configuration options # # MongoDB node connection URL, which must be in the [`Standard Connection String Format`](https://docs.mongodb.com/manual/reference/connection-string/#std-label-connections-standard-connection-string-format) [mongodb_uri: ]