我正在GCE VM中配置Stackdriver-agent来监控Cassandra指标 . (基于GCP指南:https://cloud.google.com/monitoring/agent/plugins/cassandra)
我使用了上面链接的默认设置,它们工作正常 . 但是,我添加的一个指标不适用于以下错误 .
我为Type和Value或Count for Attribute尝试了计量器或计数器 . 但是,它们中的任何一个都不能很好地工作 .
请提出任何建议 .
- 错误
Feb 19 23:14:08 pgxxxxxxx1 collectd [16917]:write_gcm:服务器响应(CollectdTimeseriesRequest)包含错误:{“payloadErrors”:[{“index”:161,“valueErrors”:[{“error”:{“code “:3,”message“:”不支持的collectd id:插件:\“cassandra \”type:\“gauge \”type_instance:\“cache_key_cache-hitrate \”“}}]}]}
配置(将KeyCache-Hitrate指标添加到指南中的原始配置)
- 连接部分:
<Connection>
# When using non-standard Cassandra configurations, replace the below with
#ServiceURL "service:jmx:rmi:///jndi/rmi://CASSANDRA_HOST:CASSANDRA_PORT/jmxrmi"
ServiceURL "service:jmx:rmi:///jndi/rmi://localhost:7199/jmxrmi"
InstancePrefix "cassandra"
User "cassandra"
Password "xxxxxxxx"
Collect "cassandra_storageservice-load"
Collect "cassandra_Cache_KeyCache-Hits"
Collect "cassandra_Cache_KeyCache-HitRate" <===== Added line
...
Collect "cassandra_DroppedMessage_MUTATION-Dropped"
Collect "cassandra_DroppedMessage_READ-Dropped"
- MBean部分:
<MBean "cassandra_Cache_KeyCache-HitRate">
ObjectName "org.apache.cassandra.metrics:type=Cache,scope=KeyCache,name=HitRate"
<Value>
Type "gauge"
InstancePrefix "cache_key_cache-hitrate"
Table false
Attribute "Value"
</Value>
</MBean>
我的环境stackdriver-agent 5.5.2-379.sdl.stretch cassandra 3.11.1
1 回答
遵循自定义指标指南,我可以解决我的问题 .
还需要获得授权才能访问监控 . (按照IAM指南) .
我的示例代码
来自google.cloud导入监控
client = monitoring.Client()descriptor = client.metric_descriptor('custom.googleapis.com/cassandra/client_request/latency/1minrate',metric_kind = monitoring.MetricKind.GAUGE,value_type = monitoring.ValueType.DOUBLE,labels = [monitoring . label.LabelDescriptor(“operation”,description =“存储操作名称 . ”)],description ='Cassandra读取延迟率1分钟',display_name ='读取延迟1分钟速率')descriptor.create()
2-2 . cassandra插件示例第2部分
Stackdriver监控手册的官方指南不易阅读和理解 . 我希望这个能帮上忙..