截至 2016 年 8 月 28 日,我在使用 Stackdriver 监控 MongoDB 3.2 时遇到了问题。
没有提到mongo
任何内容,/var/log/syslog
但是如果我在文件上犯了配置错误.conf
,它会抱怨,所以我知道它正在正确加载文件......
因此没有错误,但没有提到mongo
和/var/log/syslog
https://app.google.stackdriver.com/services/mongodb声称我还没有安装代理。
gke-fatih-standard-fb894cbb-d7ue:/opt/stackdriver/collectd/etc$ sudo service stackdriver-agent restart
[....] Restarting Stackdriver metrics collection agent: stackdriver-agentoption = Interval; value = 60.000000;
Created new plugin context.
option = Interval; value = 60.000000;
Created new plugin context.
option = PIDFile; value = /var/run/stackdriver-agent.pid;
option = Interval; value = 60.000000;
Created new plugin context.
. ok
$ tail -F /var/log/syslog
Aug 28 06:53:01 gke-fatih-standard-fb894cbb-d7ue /USR/SBIN/CRON[21824]: (root) CMD (/etc/supervisor/supervisor_watcher.sh 2>&1 | logger)
Aug 28 06:53:03 gke-fatih-standard-fb894cbb-d7ue collectd[21844]: type = syslog, key = LogLevel, value = info
Aug 28 06:53:03 gke-fatih-standard-fb894cbb-d7ue collectd[21844]: write_gcm: inside module_register for stackdriver_agent/5.5.0-340.wheezy
Aug 28 06:53:03 gke-fatih-standard-fb894cbb-d7ue collectd[21845]: type = syslog, key = LogLevel, value = info
Aug 28 06:53:03 gke-fatih-standard-fb894cbb-d7ue collectd[21845]: write_gcm: inside module_register for stackdriver_agent/5.5.0-340.wheezy
Aug 28 06:53:03 gke-fatih-standard-fb894cbb-d7ue collectd[21846]: Initialization complete, entering read-loop.
Aug 28 06:53:03 gke-fatih-standard-fb894cbb-d7ue collectd[21846]: match_throttle_metadata_keys: 1 history entries, 1 distinct keys, 78 bytes server memory.
Aug 28 06:53:03 gke-fatih-standard-fb894cbb-d7ue collectd[21846]: tcpconns plugin: Reading from netlink succeeded. Will use the netlink method from now on.
Aug 28 06:53:03 gke-fatih-standard-fb894cbb-d7ue collectd[21846]: write_gcm: Asking metadata server for auth token
Aug 28 06:53:04 gke-fatih-standard-fb894cbb-d7ue collectd[21846]: match_throttle_metadata_keys: 2 history entries, 1025 distinct keys, 102801 bytes server memory.
注意实例/节点监控正确,只有MongoDB有问题。
/opt/stackdriver/collectd/etc/collect.d/mongo0.conf
:
# scheduled to node: gke-fatih-standard-fb894cbb-d7ue
# This is the monitoring configuration for MongoDB.
# Look for STATS_USER, STATS_PASS, MONGODB_HOST and MONGODB_PORT to adjust your configuration file.
LoadPlugin mongodb
<Plugin "mongodb">
# When using non-standard MongoDB configurations, replace the below with
#Host "MONGODB_HOST"
#Port "MONGODB_PORT"
# Must use the load balancer because we don't know the fixed nodePort
Host "xxx"
Port "27017"
# If you restricted access to the database, you can set the username and
# password here:
User "stats"
Password "xxx"
</Plugin>
答案1
Google 正在弃用非 GCP 重点 Stackdriver 集成(如 Mongo),并转向 BindPlane MIaaS 平台作为其支持非 GCP 数据源的监控集成平台。
更多详情可在这找到:
https://cloud.google.com/monitoring/agent/plugins/bindplane-transition
和这里:
https://bluemedora.com/how-to-monitor-mongodb-bindplane-for-stackdriver-blue-medora/
答案2
sudo service stackdriver-agent restart
再次执行此操作(我以前也做过)并经过约 30 分钟的原始事件后,Stackdriver 现在可以检测到这些指标。
因此,如果你确定你已正确完成所有操作且没有错误,你可以尝试stackdriver-agent
多次重新启动和等待约 30 分钟。
缺少任何mongo
与 相关的内容/var/log/syslog
是一个问题。我希望@Corey-Kosak 可以提供更多信息。