我为ambari和metrics小部件编写了一个组件。但是,我无法为该组件添加小部件。我想我需要一些帮助...
我的ambari版本是2.5.2,我检查了网络问题。
当我打开此组件页面的页面时,它显示为
app.js:66933 Uncaught TypeError: Cannot read property 'WidgetLayoutInfo' of undefined
at Class.createUserWidgetLayout (app.js:66933)
at Class.<anonymous> (app.js:66874)
at o (vendor.js:125)
at Object.fireWith [as resolveWith] (vendor.js:125)
at w (vendor.js:127)
at XMLHttpRequest.d (vendor.js:127)
当我尝试添加widget.it时显示为
app.js:26574 Uncaught TypeError: activeLayout.get is not a function
at Class.addWidget (app.js:26574)
at handler (vendor.js:21227)
at HTMLButtonElement.<anonymous> (vendor.js:13019)
at HTMLDivElement.dispatch (vendor.js:126)
at HTMLDivElement.i (vendor.js:126)
最后我尝试创建一个小部件,控制台显示为
app.js:85210 Uncaught TypeError: Cannot read property 'mapProperty' of undefined
at Class.createServiceWidget (app.js:85210)
at Class.sendRecursively (vendor.js:17348)
at Class.sendRecursively (vendor.js:17352)
at Class.sendRecursively (vendor.js:17352)
at Class.sendRecursively (vendor.js:17352)
at Class.send (vendor.js:17333)
at Class.createWidget (app.js:26730)
at Class.createWidget (app.js:26849)
at handler (vendor.js:21227)
at HTMLButtonElement.<anonymous> (vendor.js:13019)
这是我的metainfo.xml
<metainfo>
<schemaVersion>2.0</schemaVersion>
<services>
<service>
<name>REDISCLUSTER</name>
<displayName>Redis Cluster</displayName>
<comment>the component of redis cluster</comment>
<version>4.0.8</version>
<components>
<component>
<name>REDIS_SERVER</name>
<displayName>redis server</displayName>
<category>MASTER</category>
<cardinality>1+</cardinality>
<timelineAppid>rediscluster</timelineAppid>
<commandScript>
<script>scripts/server.py</script>
<scriptType>PYTHON</scriptType>
<timeout>600</timeout>
</commandScript>
</component>
</components>
<osSpecifics>
<osSpecific>
<osFamily>any</osFamily>
</osSpecific>
</osSpecifics>
</service>
</services>
</metainfo>
这是metrics.json
{
"REDIS_SERVER": {
"Component": [
{
"type": "ganglia",
"metrics": {
"default": {
"metrics/redis_cluster_used_memory": {
"metric": "redis_cluster_used_memory",
"pointInTime": true,
"temporal": true
},
"metrics/redis_cluster_maxmemory": {
"metric": "redis_cluster_maxmemory",
"pointInTime": true,
"temporal": true
},
"metrics/redis_cluster_used_memory_rss": {
"metric": "redis_cluster_used_memory_rss",
"pointInTime": true,
"temporal": true
},
"metrics/redis_cluster_used_memory_peak": {
"metric": "redis_cluster_used_memory_peak",
"pointInTime": true,
"temporal": true
},
"metrics/redis_cluster_mem_fragmentation_ratio": {
"metric": "redis_cluster_mem_fragmentation_ratio",
"pointInTime": true,
"temporal": true
},
"metrics/redis_cluster_instantaneous_input_kbps": {
"metric": "redis_cluster_instantaneous_input_kbps",
"pointInTime": true,
"temporal": true
},
"metrics/redis_cluster_instantaneous_output_kbps": {
"metric": "redis_cluster_instantaneous_output_kbps",
"pointInTime": true,
"temporal": true
},
"metrics/redis_cluster_rejected_connections": {
"metric": "redis_cluster_rejected_connections",
"pointInTime": true,
"temporal": true
},
"metrics/redis_cluster_keyspace_hits": {
"metric": "redis_cluster_keyspace_hits",
"pointInTime": true,
"temporal": true
},
"metrics/redis_cluster_keyspace_misses": {
"metric": "redis_cluster_keyspace_misses",
"pointInTime": true,
"temporal": true
},
"metrics/redis_cluster_used_cpu_sys": {
"metric": "redis_cluster_used_cpu_sys",
"pointInTime": true,
"temporal": true
}
}
}
}
]
}
}
这是widgets.json
{
"layouts": [
{
"layout_name": "default_redis_cluster_dashboard",
"display_name": "Standard Redis Cluster Dashboard",
"section_name": "REDISCLUSTER_SUMMARY",
"widgetLayoutInfo": [
{
"widget_name": "redis_cluster_used_memory",
"description": "Redis used memory widget",
"default_section_name": "REDISCLUSTER_SUMMARY",
"widget_type": "GRAPH",
"is_visible": true,
"metrics": [
{
"name": "redis_cluster_used_memory",
"metric_path": "metrics/redis_cluster_used_memory",
"service_name": "REDISCLUSTER",
"component_name": "REDIS_SERVER"
}
],
"values": [
{
"name": "redis_cluster_used_memory",
"value": "${redis_cluster_used_memory}"
}
],
"properties": {
"graph_type": "LINE",
"time_range": "1"
}
},
{
"widget_name": "redis_cluster_maxmemory",
"description": "Redis maxmemory widget",
"default_section_name": "REDISCLUSTER_SUMMARY",
"widget_type": "GRAPH",
"is_visible": true,
"metrics": [
{
"name": "redis_cluster_maxmemory",
"metric_path": "metrics/redis_cluster_maxmemory",
"service_name": "REDISCLUSTER",
"component_name": "REDIS_SERVER"
}
],
"values": [
{
"name": "redis_cluster_maxmemory",
"value": "${redis_cluster_maxmemory}"
}
],
"properties": {
"graph_type": "LINE",
"time_range": "1"
}
},
{
"widget_name": "redis_cluster_used_memory_rss",
"description": "Redis used_memory_rss widget",
"default_section_name": "REDISCLUSTER_SUMMARY",
"widget_type": "GRAPH",
"is_visible": true,
"metrics": [
{
"name": "redis_cluster_used_memory_rss",
"metric_path": "metrics/redis_cluster_used_memory_rss",
"service_name": "REDISCLUSTER",
"component_name": "REDIS_SERVER"
}
],
"values": [
{
"name": "redis_cluster_used_memory_rss",
"value": "${redis_cluster_used_memory_rss}"
}
],
"properties": {
"graph_type": "LINE",
"time_range": "1"
}
},
{
"widget_name": "redis_cluster_used_memory_peak",
"description": "Redis used_memory_peak widget",
"default_section_name": "REDISCLUSTER_SUMMARY",
"widget_type": "GRAPH",
"is_visible": true,
"metrics": [
{
"name": "redis_cluster_used_memory_peak",
"metric_path": "metrics/redis_cluster_used_memory_peak",
"service_name": "REDISCLUSTER",
"component_name": "REDIS_SERVER"
}
],
"values": [
{
"name": "redis_cluster_used_memory_peak",
"value": "${redis_cluster_used_memory_peak}"
}
],
"properties": {
"graph_type": "LINE",
"time_range": "1"
}
},
{
"widget_name": "redis_cluster_mem_fragmentation_ratio",
"description": "Redis mem_fragmentation_ratio widget",
"default_section_name": "REDISCLUSTER_SUMMARY",
"widget_type": "GRAPH",
"is_visible": true,
"metrics": [
{
"name": "redis_cluster_mem_fragmentation_ratio",
"metric_path": "metrics/redis_cluster_mem_fragmentation_ratio",
"service_name": "REDISCLUSTER",
"component_name": "REDIS_SERVER"
}
],
"values": [
{
"name": "redis_cluster_mem_fragmentation_ratio",
"value": "${redis_cluster_mem_fragmentation_ratio}"
}
],
"properties": {
"graph_type": "LINE",
"time_range": "1"
}
},
{
"widget_name": "redis_cluster_instantaneous_input_kbps",
"description": "Redis instantaneous_input_kbps widget",
"default_section_name": "REDISCLUSTER_SUMMARY",
"widget_type": "GRAPH",
"is_visible": true,
"metrics": [
{
"name": "redis_cluster_instantaneous_input_kbps",
"metric_path": "metrics/redis_cluster_instantaneous_input_kbps",
"service_name": "REDISCLUSTER",
"component_name": "REDIS_SERVER"
}
],
"values": [
{
"name": "redis_cluster_instantaneous_input_kbps",
"value": "${redis_cluster_instantaneous_input_kbps}"
}
],
"properties": {
"graph_type": "LINE",
"time_range": "1"
}
},
{
"widget_name": "redis_cluster_instantaneous_output_kbps",
"description": "Redis instantaneous_output_kbps widget",
"default_section_name": "REDISCLUSTER_SUMMARY",
"widget_type": "GRAPH",
"is_visible": true,
"metrics": [
{
"name": "redis_cluster_instantaneous_output_kbps",
"metric_path": "metrics/redis_cluster_instantaneous_output_kbps",
"service_name": "REDISCLUSTER",
"component_name": "REDIS_SERVER"
}
],
"values": [
{
"name": "redis_cluster_instantaneous_output_kbps",
"value": "${redis_cluster_instantaneous_output_kbps}"
}
],
"properties": {
"graph_type": "LINE",
"time_range": "1"
}
},
{
"widget_name": "redis_cluster_rejected_connections",
"description": "Redis rejected_connections widget",
"default_section_name": "REDISCLUSTER_SUMMARY",
"widget_type": "GRAPH",
"is_visible": true,
"metrics": [
{
"name": "redis_cluster_rejected_connections",
"metric_path": "metrics/redis_cluster_rejected_connections",
"service_name": "REDISCLUSTER",
"component_name": "REDIS_SERVER"
}
],
"values": [
{
"name": "redis_cluster_rejected_connections",
"value": "${redis_cluster_rejected_connections}"
}
],
"properties": {
"graph_type": "LINE",
"time_range": "1"
}
},
{
"widget_name": "redis_cluster_keyspace_hits",
"description": "Redis keyspace_hits widget",
"default_section_name": "REDISCLUSTER_SUMMARY",
"widget_type": "GRAPH",
"is_visible": true,
"metrics": [
{
"name": "redis_cluster_keyspace_hits",
"metric_path": "metrics/redis_cluster_keyspace_hits",
"service_name": "REDISCLUSTER",
"component_name": "REDIS_SERVER"
}
],
"values": [
{
"name": "redis_cluster_keyspace_hits",
"value": "${redis_cluster_keyspace_hits}"
}
],
"properties": {
"graph_type": "LINE",
"time_range": "1"
}
},
{
"widget_name": "redis_cluster_keyspace_misses",
"description": "Redis keyspace_misses widget",
"default_section_name": "REDISCLUSTER_SUMMARY",
"widget_type": "GRAPH",
"is_visible": true,
"metrics": [
{
"name": "redis_cluster_keyspace_misses",
"metric_path": "metrics/redis_cluster_keyspace_misses",
"service_name": "REDISCLUSTER",
"component_name": "REDIS_SERVER"
}
],
"values": [
{
"name": "redis_cluster_keyspace_misses",
"value": "${redis_cluster_keyspace_misses}"
}
],
"properties": {
"graph_type": "LINE",
"time_range": "1"
}
},
{
"widget_name": "redis_cluster_used_cpu_sys",
"description": "Redis used_cpu_sys widget",
"default_section_name": "REDISCLUSTER_SUMMARY",
"widget_type": "GRAPH",
"is_visible": true,
"metrics": [
{
"name": "redis_cluster_used_cpu_sys",
"metric_path": "metrics/redis_cluster_used_cpu_sys",
"service_name": "REDISCLUSTER",
"component_name": "REDIS_SERVER"
}
],
"values": [
{
"name": "redis_cluster_used_cpu_sys",
"value": "${redis_cluster_used_cpu_sys}"
}
],
"properties": {
"graph_type": "LINE",
"time_range": "1"
}
}
]
}
]
}