简体   繁体   English

MongoDB Prometheus-Community exporter 无法获取由 TLS 启用的 MongoDB 的指标

[英]MongoDB Prometheus-Community exporter not able to fetch the metrics of MongoDB which is enabled by TLS

Using Prometheus-community Exporter for fetching metrics from MongoDB Which is TLS enabled.使用 Prometheus-community Exporter 从启用 TLS 的 MongoDB 获取指标。 but metrics are not showing in the Prometheus and in logs of Exporter pod as:但指标未在 Prometheus 和 Exporter pod 的日志中显示为:

kubectl logs expo-prometheus-mongodb-exporter-55865c7f86-kvg4r -n final-test kubectl 记录 expo-prometheus-mongodb-exporter-55865c7f86-kvg4r -n 最终测试

time="2022-03-15T11:25:27Z" level=info msg="Starting mongodb_exporter (version=, branch=, revision=)" source="mongodb_exporter.go:94" time="2022-03-15T11:25:27Z" level=info msg="Build context (go=go1.11.13, user=, date=19700101-00:00:00)" source="mongodb_exporter.go:95" time="2022-03-15T11:25:27Z" level=error msg="(CommandNotSupportedOnView) Namespace local.system.tenantMigration.oplogView is a view, not a collection. Collection stats will not be collected for this collection. This log message will be suppressed from now." time="2022-03-15T11:25:27Z" level=info msg="Starting mongodb_exporter (version=, branch=, revision=)" source="mongodb_exporter.go:94" time="2022-03-15T11: 25:27Z" level=info msg="构建上下文 (go=go1.11.13, user=, date=19700101-00:00:00)" source="mongodb_exporter.go:95" time="2022-03-15T11 :25:27Z" level=error msg="(CommandNotSupportedOnView) 命名空间 local.system.tenantMigration.oplogView 是一个视图,而不是一个集合。不会收集此集合的集合统计信息。此日志消息将从现在开始被禁止。" source="collections_status.go:169" time="2022-03-15T11:25:27Z" level=error msg="(Unauthorized) not authorized on admin to execute command { aggregate: "system.version", pipeline: [ { $indexStats: {} } ], cursor: {}, lsid: { id: UUID("8224906c-49b8-4699-8b3a-972d5518caa0") }, $clusterTime: { clusterTime: Timestamp(1647343521, 1), signature: { hash: BinData(0, F43E74F913B4AECCA2BC772062CFA55B067693D8), keyId: 7073820031389270020 } }, $db: "admin", $readPreference: { mode: "nearest" } }. Index usage stats will not be collected for this collection. This log message will be suppressed from now." source="collections_status.go:169" time="2022-03-15T11:25:27Z" level=error msg="(Unauthorized) 未授权管理员执行命令 { 聚合:"system.version",管道:[ { $indexStats: {} } ], cursor: {}, lsid: { id: UUID("8224906c-49b8-4699-8b3a-972d5518caa0") }, $clusterTime: { clusterTime: Timestamp(1647343521), 签名: 1 { hash: BinData(0, F43E74F913B4AECCA2BC772062CFA55B067693D8), keyId: 7073820031389270020 } }, $db: "admin", $readPreference: { mode: "nearest usage" }从现在开始被压制。” source="index_usage.go:104" time="2022-03-15T11:25:27Z" level=error msg="(Unauthorized) not authorized on admin to execute command { aggregate: "system.keys", pipeline: [ { $indexStats: {} } ], cursor: {}, lsid: { id: UUID("8224906c-49b8-4699-8b3a-972d5518caa0") }, $clusterTime: { clusterTime: Timestamp(1647343521, 1), signature: { hash: BinData(0, F43E74F913B4AECCA2BC772062CFA55B067693D8), keyId: 7073820031389270020 } }, $db: "admin", $readPreference: { mode: "nearest" } }. Index usage stats will not be collected for this collection. This log message will be suppressed from now." source="index_usage.go:104" time="2022-03-15T11:25:27Z" level=error msg="(Unauthorized) 管理员未授权执行命令 { 聚合:“system.keys”,管道:[ { $indexStats: {} } ], cursor: {}, lsid: { id: UUID("8224906c-49b8-4699-8b3a-972d5518caa0") }, $clusterTime: { clusterTime: Timestamp(1647343521), 签名: 1 { hash: BinData(0, F43E74F913B4AECCA2BC772062CFA55B067693D8), keyId: 7073820031389270020 } }, $db: "admin", $readPreference: { mode: "nearest usage" }从现在开始被压制。” source="index_usage.go:104" time="2022-03-15T11:25:27Z" level=error msg="(Unauthorized) not authorized on admin to execute command { aggregate: "system.users", pipeline: [ { $indexStats: {} } ], cursor: {}, lsid: { id: UUID("8224906c-49b8-4699-8b3a-972d5518caa0") }, $clusterTime: { clusterTime: Timestamp(1647343521, 1), signature: { hash: BinData(0, F43E74F913B4AECCA2BC772062CFA55B067693D8), keyId: 7073820031389270020 } }, $db: "admin", $readPreference: { mode: "nearest" } }. Index usage stats will not be collected for this collection. This log message will be suppressed from now." source="index_usage.go:104" time="2022-03-15T11:25:27Z" level=error msg="(Unauthorized) 管理员未授权执行命令 { 聚合:“system.users”,管道:[ { $indexStats: {} } ], cursor: {}, lsid: { id: UUID("8224906c-49b8-4699-8b3a-972d5518caa0") }, $clusterTime: { clusterTime: Timestamp(1647343521), 签名: 1 { hash: BinData(0, F43E74F913B4AECCA2BC772062CFA55B067693D8), keyId: 7073820031389270020 } }, $db: "admin", $readPreference: { mode: "nearest usage" }从现在开始被压制。” source="index_usage.go:104" time="2022-03-15T11:25:27Z" level=error msg="(Unauthorized) not authorized on config to execute command { aggregate: "system.indexBuilds", pipeline: [ { $indexStats: {} } ], cursor: {}, lsid: { id: UUID("8224906c-49b8-4699-8b3a-972d5518caa0") }, $clusterTime: { clusterTime: Timestamp(1647343521, 1), signature: { hash: BinData(0, F43E74F913B4AECCA2BC772062CFA55B067693D8), keyId: 7073820031389270020 } }, $db: "config", $readPreference: { mode: "nearest" } }. Index usage stats will not be collected for this collection. This log message will be suppressed from now." source="index_usage.go:104" time="2022-03-15T11:25:27Z" level=error msg="(Unauthorized) 未授权配置执行命令 { 聚合:"system.indexBuilds",管道:[ { $indexStats: {} } ], cursor: {}, lsid: { id: UUID("8224906c-49b8-4699-8b3a-972d5518caa0") }, $clusterTime: { clusterTime: Timestamp(1647343521), 签名: 1 { hash: BinData(0, F43E74F913B4AECCA2BC772062CFA55B067693D8), keyId: 7073820031389270020 } }, $db: "config", $readPreference: { mode: "nearest usage" } 此集合的索引将不会被收集。从现在开始被压制。” source="index_usage.go:104" time="2022-03-15T11:25:27Z" level=error msg="(Unauthorized) not authorized on config to execute command { aggregate: "system.sessions", pipeline: [ { $indexStats: {} } ], cursor: {}, lsid: { id: UUID("8224906c-49b8-4699-8b3a-972d5518caa0") }, $clusterTime: { clusterTime: Timestamp(1647343521, 1), signature: { hash: BinData(0, F43E74F913B4AECCA2BC772062CFA55B067693D8), keyId: 7073820031389270020 } }, $db: "config", $readPreference: { mode: "nearest" } }. Index usage stats will not be collected for this collection. This log message will be suppressed from now." source="index_usage.go:104" time="2022-03-15T11:25:27Z" level=error msg="(Unauthorized) 配置未授权执行命令 { 聚合:“system.sessions”,管道:[ { $indexStats: {} } ], cursor: {}, lsid: { id: UUID("8224906c-49b8-4699-8b3a-972d5518caa0") }, $clusterTime: { clusterTime: Timestamp(1647343521), 签名: 1 { hash: BinData(0, F43E74F913B4AECCA2BC772062CFA55B067693D8), keyId: 7073820031389270020 } }, $db: "config", $readPreference: { mode: "nearest usage" } 此集合的索引将不会被收集。从现在开始被压制。” source="index_usage.go:104" time="2022-03-15T11:25:27Z" level=error msg="(Unauthorized) not authorized on local to execute command { aggregate: "replset.minvalid", pipeline: [ { $indexStats: {} } ], cursor: {}, lsid: { id: UUID("8224906c-49b8-4699-8b3a-972d5518caa0") }, $clusterTime: { clusterTime: Timestamp(1647343521, 1), signature: { hash: BinData(0, F43E74F913B4AECCA2BC772062CFA55B067693D8), keyId: 7073820031389270020 } }, $db: "local", $readPreference: { mode: "nearest" } }. Index usage stats will not be collected for this collection. This log message will be suppressed from now." source="index_usage.go:104" time="2022-03-15T11:25:27Z" level=error msg="(Unauthorized) 未授权在本地执行命令 { 聚合:"replset.minvalid",管道:[ { $indexStats: {} } ], cursor: {}, lsid: { id: UUID("8224906c-49b8-4699-8b3a-972d5518caa0") }, $clusterTime: { clusterTime: Timestamp(1647343521), 签名: 1 { hash: BinData(0, F43E74F913B4AECCA2BC772062CFA55B067693D8), keyId: 7073820031389270020 } }, $db: "local", $readPreference: { mode: "nearest usage" }从现在开始被压制。” source="index_usage.go:104" [ { $indexStats: {} } ], cursor: {}, lsid: { id: UUID("8224906c-49b8-4699-8b3a-972d5518caa0") }, $clusterTime: { clusterTime: Timestamp(1647343521, 1), signature: { hash: BinData(0, F43E74F913B4AECCA2BC772062CFA55B067693D8), keyId: 7073820031389270020 } }, $db: "local", $readPreference: { mode: "nearest" } }. source="index_usage.go:104" [ { $indexStats: {} } ], cursor: {}, lsid: { id: UUID("8224906c-49b8-4699-8b3a-972d5518caa0") }, $clusterTime: { clusterTime : Timestamp(1647343521, 1), signature: { hash: BinData(0, F43E74F913B4AECCA2BC772062CFA55B067693D8), keyId: 7073820031389270020 } }, $db: "local", $readPreference: { mode: "nearest" } }. Index usage stats will not be collected for this collection.不会为此集合收集索引使用统计信息。 This log message will be suppressed from now." source="index_usage.go:104" time="2022-03-15T11:25:27Z" level=info msg="Starting HTTP server for http://:9216/metrics..." source="server.go:140" This log message will be suppressed from now." source="index_usage.go:104" time="2022-03-15T11:25:27Z" level=info msg="Starting HTTP server for http://:9216/metrics ..."源="服务器.go:140"

MongoDB is Enabled by TLS Connection string is: "mongodb://mongo:mongo123@mongodb-2.mongodb.final-test.svc.cluster.local:27017/admin?replicaSet=rs1&tls=true&tlsCertificateKeyFile=/tmp/tls-combined.pem&tlsCAFile=/tmp/ca.crt" MongoDB 由 TLS 启用 连接字符串为:“mongodb://mongo:mongo123@mongodb-2.mongodb.final-test.svc.cluster.local:27017/admin?replicaSet=rs1&tlstmpKey/tls-com .pem&tlsCAFile=/tmp/ca.crt"

Any Suggestions would be helpful.任何的意见都将会有帮助。

I have encountered this issue with a mongodb-exporter deployed through bitnami's helm chart where in order to get mongodb metrics besides mongodb_up was to provide "--collect-all" flag to exporter.我在通过 bitnami 的 helm chart 部署的 mongodb-exporter 遇到了这个问题,为了获得 mongodb 指标,除了 mongodb_up 之外,还需要向 exporter 提供“--collect-all”标志。 If you are using the same chart then you need to provide it through extraFlags in the values.yaml如果您使用相同的图表,则需要通过 values.yaml 中的 extraFlags 提供它

extraFlags: "--collect-all"

if the exporter is spinned-up via compose then you will need to have it under command such as (it will obviously be different considering that you will tls flags in there):如果导出器是通过 compose 启动的,那么您将需要在命令下使用它(考虑到您将在其中使用 tls 标志,这显然会有所不同):

    command: 
      - "--mongodb.uri=mongodb://mongo:27017"
      - "--mongodb.collstats-colls=Test.Listings"
      - "--discovering-mode"
      - "--mongodb.direct-connect"  
      - "--collect-all"  

The image being used within our chart was "bitnami/mongodb-exporter:0.32.0-debian-10-r3".我们图表中使用的图像是“bitnami/mongodb-exporter:0.32.0-debian-10-r3”。

However, the available dashboards make use of older metric names so my dashboards that I picked from under percona's repository even after modifying the datasources did not get populated.但是,可用的仪表板使用较旧的指标名称,因此即使在修改数据源之后,我从 percona 的存储库中选择的仪表板也没有被填充。

One suggestion regarding when I was searching online was that is adding "--compatible-mode" as well but that has been reported to be not working with mongo:5 and up.关于我何时在线搜索的一个建议是同时添加“--compatible-mode”,但据报道这不适用于 mongo:5 及更高版本。 I have yet to confirm with previous releases such as mongo:4.2我还没有确认以前的版本,比如 mongo:4.2

I am currently trying to convert the queries of the dashboards accordingly with the new metric names though it ain't pretty.我目前正在尝试使用新的指标名称相应地转换仪表板的查询,尽管它并不漂亮。

Hope this helps.希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM