Stackdriver-agent 未收集监控数据(KeyCache 的命中率)
Stackdriver-agent didn't collect monitoring data (HitRate for KeyCache)
我正在 GCE VM 中配置 Stackdriver-agent 以监控 Cassandra 指标。
(基于 GCP 指南:https://cloud.google.com/monitoring/agent/plugins/cassandra)
我使用了上面link的默认设置,它们工作正常。
但是,我添加的一项指标无法使用并出现以下错误。
我尝试了类型和值的仪表或计数器或属性的计数。然而,它们中的任何一个都不能很好地工作。
有什么建议,请。
- 错误
Feb 19 23:14:08 pgxxxxxxx1 collectd[16917]: write_gcm: Server response (CollectdTimeseriesRequest) contains errors:
{
"payloadErrors": [
{
"index": 161,
"valueErrors": [
{
"error": {
"code": 3,
"message": "Unsupported collectd id: plugin: \"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
卡桑德拉 3.11.1
按照自定义指标指南 和 ,我可以解决我的问题。
- 创建自定义指标
按照此处的指南操作:https://cloud.google.com/monitoring/custom-metrics/creating-metrics#monitoring-create-metric-python
(从自定义指标名称到调用创建方法。不需要时间序列)
还需要授权访问监控。 (遵循 IAM 指南)。
- 配置cassandra插件(.conf文件)
指南在这里:https://cloud.google.com/monitoring/agent/custom-metrics-agent
(从顶部开始直到加载新配置)
我的示例代码
创建自定义指标的代码
client_request_read-latency-1minrate.py
从google.cloud导入监控
客户=monitoring.Client()
描述符 = client.metric_descriptor(
'custom.googleapis.com/cassandra/client_request/latency/1minrate',
metric_kind=monitoring.MetricKind.GAUGE,
value_type=monitoring.ValueType.DOUBLE,
标签=[monitoring.label.LabelDescriptor("operation", 描述="The storage operation name.")],
描述='Cassandra read latency rate for 1 minitue',
display_name='Read latency 1 minutes rate')
descriptor.create()
cassandra 插件示例
(在同一配置文件中遵循 2-1 和 2-2)
2-1. cassandra 插件示例第 1 部分
在
<MBean "cassandra_custom_ClientRequest_Read-Latency">
ObjectName "org.apache.cassandra.metrics:type=ClientRequest,scope=Read,name=Latency"
<Value>
Type "gauge"
InstancePrefix "client_request_read-latency-1minrate"
Table false
Attribute "OneMinuteRate"
</Value>
</MBean>
<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_custom"
User "cassandra user name"
Password "your password"
Collect "cassandra_custom_ClientRequest_Read-Latency"
</Connection>
2-2。 cassandra 插件示例第 2 部分
<Chain "GenericJMX_cassandra_custom">
<Rule "rewrite_genericjmx_to_cassandra_custom">
<Match regex>
Plugin "^GenericJMX$"
PluginInstance "^cassandra_custom.*$"
</Match>
<Target "set">
MetaData "stackdriver_metric_type" "custom.googleapis.com/cassandra/client_request/latency/1minrate"
MetaData "label:operation" "%{plugin_instance}"
</Target>
<Target "replace">
MetaData "label:operation" "cassandra_custom_" ""
</Target>
</Rule>
<Rule "go_back">
Target "return"
</Rule>
</Chain>
<Chain "PreCache">
<Rule "jump_to_GenericJMX_cassandra_custom">
<Target "jump">
Chain "GenericJMX_cassandra_custom"
</Target>
</Rule>
</Chain>
PreCacheChain "PreCache"
Stackdriver监控手册的官方指南不太好读和理解。
我希望这会有所帮助..
我正在 GCE VM 中配置 Stackdriver-agent 以监控 Cassandra 指标。 (基于 GCP 指南:https://cloud.google.com/monitoring/agent/plugins/cassandra)
我使用了上面link的默认设置,它们工作正常。 但是,我添加的一项指标无法使用并出现以下错误。
我尝试了类型和值的仪表或计数器或属性的计数。然而,它们中的任何一个都不能很好地工作。
有什么建议,请。
- 错误
Feb 19 23:14:08 pgxxxxxxx1 collectd[16917]: write_gcm: Server response (CollectdTimeseriesRequest) contains errors: { "payloadErrors": [ { "index": 161, "valueErrors": [ { "error": { "code": 3, "message": "Unsupported collectd id: plugin: \"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 卡桑德拉 3.11.1
按照自定义指标指南 和 ,我可以解决我的问题。
- 创建自定义指标 按照此处的指南操作:https://cloud.google.com/monitoring/custom-metrics/creating-metrics#monitoring-create-metric-python (从自定义指标名称到调用创建方法。不需要时间序列)
还需要授权访问监控。 (遵循 IAM 指南)。
- 配置cassandra插件(.conf文件) 指南在这里:https://cloud.google.com/monitoring/agent/custom-metrics-agent (从顶部开始直到加载新配置)
我的示例代码
创建自定义指标的代码 client_request_read-latency-1minrate.py
从google.cloud导入监控
客户=monitoring.Client() 描述符 = client.metric_descriptor( 'custom.googleapis.com/cassandra/client_request/latency/1minrate', metric_kind=monitoring.MetricKind.GAUGE, value_type=monitoring.ValueType.DOUBLE, 标签=[monitoring.label.LabelDescriptor("operation", 描述="The storage operation name.")], 描述='Cassandra read latency rate for 1 minitue', display_name='Read latency 1 minutes rate') descriptor.create()
cassandra 插件示例 (在同一配置文件中遵循 2-1 和 2-2) 2-1. cassandra 插件示例第 1 部分 在
<MBean "cassandra_custom_ClientRequest_Read-Latency"> ObjectName "org.apache.cassandra.metrics:type=ClientRequest,scope=Read,name=Latency" <Value> Type "gauge" InstancePrefix "client_request_read-latency-1minrate" Table false Attribute "OneMinuteRate" </Value> </MBean> <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_custom" User "cassandra user name" Password "your password" Collect "cassandra_custom_ClientRequest_Read-Latency" </Connection>
2-2。 cassandra 插件示例第 2 部分
<Chain "GenericJMX_cassandra_custom">
<Rule "rewrite_genericjmx_to_cassandra_custom">
<Match regex>
Plugin "^GenericJMX$"
PluginInstance "^cassandra_custom.*$"
</Match>
<Target "set">
MetaData "stackdriver_metric_type" "custom.googleapis.com/cassandra/client_request/latency/1minrate"
MetaData "label:operation" "%{plugin_instance}"
</Target>
<Target "replace">
MetaData "label:operation" "cassandra_custom_" ""
</Target>
</Rule>
<Rule "go_back">
Target "return"
</Rule>
</Chain>
<Chain "PreCache">
<Rule "jump_to_GenericJMX_cassandra_custom">
<Target "jump">
Chain "GenericJMX_cassandra_custom"
</Target>
</Rule>
</Chain>
PreCacheChain "PreCache"
Stackdriver监控手册的官方指南不太好读和理解。 我希望这会有所帮助..