本文主要是介绍grafana+prometheus+hiveserver2(jmx_exporter+metrics),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
一、hiveserver2开启metrics,并启动jmx_exporter
1、修改hive-site.xml文件开启metrics
<property><name>hive.server2.metrics.enabled</name><value>true</value>
</property>
<property><name>hive.service.metrics.codahale.reporter.classes</name><value>org.apache.hadoop.hive.common.metrics.metrics2.JmxMetricsReporter</value>
</property>
2、启动时带上jmx_exporter
①下载jmx_exporter安装包放在服务器上
下载路径:
prometheus常用exporter下载地址大全
/usr/local/jmx_expoter/jmx_prometheus_javaagent-0.9.0.jar
/usr/local/jmx_expoter/hiveserver2.yaml
/usr/local/jmx_expoter/hiveserver2.yaml文件内容
rules:- pattern: '.*'
②修改hive安装目录bin/hive里的内容
##把这段内容
export HADOOP_CLIENT_OPTS="$HADOOP_CLIENT_OPTS -Dlog4j.configurationFile=hive-log4j2.properties"
##修改为,增加上 指定jar和yaml文件和指定jmx端口随意9909
export HADOOP_CLIENT_OPTS="$HADOOP_CLIENT_OPTS java -javaagent:/usr/local/jmx_expoter/jmx_prometheus_javaagent-0.9.0.jar=9909:/usr/local/jmx_expoter/hiveserver2.yaml -Dlog4j.configurationFile=hive-log4j2.properties"
3、查看都有哪些metrics
访问http://hiveIP:9909/metrics
二、配置prometheus
prometheus下载地址
1、prometheus.yaml增加一下配置
scrape_configs:- job_name: "hiveserver2"static_configs:- targets: ["hiveIp:9909","hiveIp:9909"]
2、启动
nohup ./prometheus --config.file=prometheus.yaml --web.listen-address=:9090 --storage.tsdb.retention=7d > ./prometheus.log 2>&1 &
三、配置grafana
1、配置prometheus数据源
如果数据源不是这个名字,下边的json记得改名字
2、dashboards import json
其他指标可以自行添加panels(嵌板)
{"__inputs": [{"name": "VAR_JOB","type": "constant","label": "job","value": "hiveserver2","description": ""}],"__requires": [{"type": "grafana","id": "grafana","name": "Grafana","version": "5.4.2"},{"type": "panel","id": "graph","name": "Graph","version": "5.0.0"},{"type": "datasource","id": "prometheus","name": "Prometheus","version": "5.0.0"},{"type": "panel","id": "singlestat","name": "Singlestat","version": "5.0.0"}],"annotations": {"list": [{"builtIn": 1,"datasource": "-- Grafana --","enable": true,"hide": true,"iconColor": "rgba(0, 211, 255, 1)","name": "Annotations & Alerts","type": "dashboard"}]},"description": "Complete dashboard using metrics from prometheus JMX exporter, with drill down per job > instance","editable": true,"gnetId": 8563,"graphTooltip": 0,"id": null,"iteration": 1545278553000,"links": [],"panels": [{"datasource": {"type": "prometheus","uid": "8mvN3liIz"},"fieldConfig": {"defaults": {"color": {"mode": "palette-classic"},"custom": {"axisLabel": "","axisPlacement": "auto","barAlignment": 0,"drawStyle": "line","fillOpacity": 0,"gradientMode": "none","hideFrom": {"legend": false,"tooltip": false,"viz": false},"lineInterpolation": "linear","lineWidth": 1,"pointSize": 5,"scaleDistribution": {"type": "linear"},"showPoints": "auto","spanNulls": false,"stacking": {"group": "A","mode": "none"},"thresholdsStyle": {"mode": "off"}},"mappings": [],"thresholds": {"mode": "absolute","steps": [{"color": "green","value": null},{"color": "red","value": 80}]}},"overrides": []},"gridPos": {"h": 9,"w": 7,"x": 0,"y": 0},"id": 52,"options": {"legend": {"calcs": [],"displayMode": "list","placement": "bottom"},"tooltip": {"mode": "single","sort": "none"}},"targets": [{"datasource": {"type": "prometheus","uid": "8mvN3liIz"},"expr": "metrics_open_connections_Count{instance=\"$instance\",job=\"$job\"}","refId": "A"}],"title": "当前打开的连接数","type": "timeseries"},{"datasource": {"type": "prometheus","uid": "8mvN3liIz"},"fieldConfig": {"defaults": {"color": {"mode": "palette-classic"},"custom": {"axisLabel": "count","axisPlacement": "auto","barAlignment": 0,"drawStyle": "line","fillOpacity": 0,"gradientMode": "none","hideFrom": {"legend": false,"tooltip": false,"viz": false},"lineInterpolation": "linear","lineStyle": {"fill": "solid"},"lineWidth": 1,"pointSize": 5,"scaleDistribution": {"type": "linear"},"showPoints": "auto","spanNulls": false,"stacking": {"group": "A","mode": "none"},"thresholdsStyle": {"mode": "off"}},"mappings": [],"thresholds": {"mode": "absolute","steps": [{"color": "green","value": null},{"color": "red","value": 80}]}},"overrides": []},"gridPos": {"h": 9,"w": 8,"x": 7,"y": 0},"id": 2,"options": {"legend": {"calcs": [],"displayMode": "list","placement": "bottom"},"tooltip": {"mode": "single","sort": "none"}},"targets": [{"datasource": {"type": "prometheus","uid": "8mvN3liIz"},"editorMode": "code","exemplar": false,"expr": "metrics_hs2_active_sessions_Value{instance=\"$instance\",job=\"$job\"}","format": "time_series","instant": false,"legendFormat": "__auto","range": true,"refId": "A"}],"title": "当前活跃的session个数","type": "timeseries"},{"datasource": {"type": "prometheus","uid": "8mvN3liIz"},"fieldConfig": {"defaults": {"color": {"mode": "palette-classic"},"custom": {"axisLabel": "","axisPlacement": "auto","barAlignment": 0,"drawStyle": "line","fillOpacity": 0,"gradientMode": "none","hideFrom": {"legend": false,"tooltip": false,"viz": false},"lineInterpolation": "linear","lineWidth": 1,"pointSize": 5,"scaleDistribution": {"type": "linear"},"showPoints": "auto","spanNulls": false,"stacking": {"group": "A","mode": "none"},"thresholdsStyle": {"mode": "off"}},"mappings": [],"thresholds": {"mode": "absolute","steps": [{"color": "green","value": null}]}},"overrides": []},"gridPos": {"h": 9,"w": 9,"x": 15,"y": 0},"id": 46,"options": {"legend": {"calcs": [],"displayMode": "list","placement": "bottom"},"tooltip": {"mode": "single","sort": "none"}},"pluginVersion": "9.0.0","targets": [{"datasource": {"type": "prometheus","uid": "8mvN3liIz"},"expr": "metrics_hive_tez_tasks_Count{instance=\"$instance\",job=\"$job\"}","refId": "A"}],"title": "提交的Hive on Tez作业总数","type": "timeseries"},{"datasource": {"type": "prometheus","uid": "8mvN3liIz"},"fieldConfig": {"defaults": {"color": {"mode": "palette-classic"},"custom": {"axisLabel": "","axisPlacement": "auto","barAlignment": 0,"drawStyle": "line","fillOpacity": 0,"gradientMode": "none","hideFrom": {"legend": false,"tooltip": false,"viz": false},"lineInterpolation": "linear","lineWidth": 1,"pointSize": 5,"scaleDistribution": {"type": "linear"},"showPoints": "auto","spanNulls": false,"stacking": {"group": "A","mode": "none"},"thresholdsStyle": {"mode": "off"}},"mappings": [],"thresholds": {"mode": "absolute","steps": [{"color": "green","value": null},{"color": "red","value": 80}]}},"overrides": []},"gridPos": {"h": 9,"w": 7,"x": 0,"y": 9},"id": 44,"options": {"legend": {"calcs": [],"displayMode": "list","placement": "bottom"},"tooltip": {"mode": "single","sort": "none"}},"targets": [{"datasource": {"type": "prometheus","uid": "8mvN3liIz"},"expr": "metrics_hs2_open_sessions_Value{instance=\"$instance\",job=\"$job\"}","refId": "A"}],"title": "当前打开的session数","type": "timeseries"},{"datasource": {"type": "prometheus","uid": "8mvN3liIz"},"fieldConfig": {"defaults": {"color": {"mode": "palette-classic"},"custom": {"axisLabel": "","axisPlacement": "auto","barAlignment": 0,"drawStyle": "line","fillOpacity": 0,"gradientMode": "none","hideFrom": {"legend": false,"tooltip": false,"viz": false},"lineInterpolation": "linear","lineWidth": 1,"pointSize": 5,"scaleDistribution": {"type": "linear"},"showPoints": "auto","spanNulls": false,"stacking": {"group": "A","mode": "none"},"thresholdsStyle": {"mode": "off"}},"decimals": 0,"mappings": [],"thresholds": {"mode": "absolute","steps": [{"color": "green","value": null},{"color": "red","value": 80}]},"unit": "none"},"overrides": []},"gridPos": {"h": 9,"w": 8,"x": 7,"y": 9},"id": 50,"options": {"legend": {"calcs": [],"displayMode": "list","placement": "bottom"},"tooltip": {"mode": "single","sort": "none"}},"targets": [{"datasource": {"type": "prometheus","uid": "8mvN3liIz"},"expr": "metrics_active_calls_api_runTasks_Count{instance=\"$instance\",job=\"$job\"}","refId": "A"}],"title": "当前runtask请求数","type": "timeseries"},{"datasource": {"type": "prometheus","uid": "8mvN3liIz"},"fieldConfig": {"defaults": {"color": {"mode": "thresholds"},"mappings": [],"thresholds": {"mode": "absolute","steps": [{"color": "green","value": null}]}},"overrides": []},"gridPos": {"h": 9,"w": 9,"x": 15,"y": 9},"id": 48,"options": {"colorMode": "value","graphMode": "area","justifyMode": "auto","orientation": "auto","reduceOptions": {"calcs": ["lastNotNull"],"fields": "","values": false},"textMode": "auto"},"pluginVersion": "9.0.0","targets": [{"datasource": {"type": "prometheus","uid": "8mvN3liIz"},"expr": "metrics_cumulative_connection_count_Count{instance=\"$instance\",job=\"$job\"}","refId": "A"}],"title": "累计连接数","type": "stat"},{"datasource": {"type": "prometheus","uid": "8mvN3liIz"},"fieldConfig": {"defaults": {"color": {"mode": "palette-classic"},"custom": {"axisLabel": "","axisPlacement": "auto","barAlignment": 0,"drawStyle": "line","fillOpacity": 0,"gradientMode": "none","hideFrom": {"legend": false,"tooltip": false,"viz": false},"lineInterpolation": "linear","lineWidth": 1,"pointSize": 5,"scaleDistribution": {"type": "linear"},"showPoints": "auto","spanNulls": false,"stacking": {"group": "A","mode": "none"},"thresholdsStyle": {"mode": "off"}},"mappings": [],"thresholds": {"mode": "absolute","steps": [{"color": "green","value": null},{"color": "red","value": 80}]},"unit": "decbytes"},"overrides": []},"gridPos": {"h": 10,"w": 7,"x": 0,"y": 18},"id": 14,"options": {"legend": {"calcs": [],"displayMode": "list","placement": "bottom"},"tooltip": {"mode": "single","sort": "none"}},"targets": [{"datasource": {"type": "prometheus","uid": "8mvN3liIz"},"expr": "metrics_memory_non_heap_committed_Value{instance=\"$instance\",job=\"$job\"}","refId": "A"}],"title": "JVM已预留堆外内存","type": "timeseries"},{"datasource": {"type": "prometheus","uid": "8mvN3liIz"},"fieldConfig": {"defaults": {"color": {"mode": "thresholds"},"mappings": [],"thresholds": {"mode": "absolute","steps": [{"color": "green","value": null}]},"unit": "decbytes"},"overrides": []},"gridPos": {"h": 10,"w": 4,"x": 7,"y": 18},"id": 5,"options": {"colorMode": "value","graphMode": "area","justifyMode": "auto","orientation": "auto","reduceOptions": {"calcs": ["lastNotNull"],"fields": "","values": false},"textMode": "auto"},"pluginVersion": "9.0.0","targets": [{"datasource": {"type": "prometheus","uid": "8mvN3liIz"},"editorMode": "code","expr": "metrics_memory_total_init_Value{instance=\"$instance\",job=\"$job\"}","legendFormat": "__auto","range": true,"refId": "A"}],"title": "JVM初始化总内存","type": "stat"},{"datasource": {"type": "prometheus","uid": "8mvN3liIz"},"fieldConfig": {"defaults": {"color": {"mode": "thresholds"},"mappings": [],"thresholds": {"mode": "absolute","steps": [{"color": "green","value": null}]},"unit": "decbytes"},"overrides": []},"gridPos": {"h": 10,"w": 4,"x": 11,"y": 18},"id": 38,"options": {"colorMode": "value","graphMode": "area","justifyMode": "auto","orientation": "auto","reduceOptions": {"calcs": ["lastNotNull"],"fields": "","values": false},"textMode": "auto"},"pluginVersion": "9.0.0","targets": [{"datasource": {"type": "prometheus","uid": "8mvN3liIz"},"expr": "metrics_memory_heap_max_Value{instance=\"$instance\",job=\"$job\"}","refId": "A"}],"title": "JVM最大可用堆内存","type": "stat"},{"datasource": {"type": "prometheus","uid": "8mvN3liIz"},"fieldConfig": {"defaults": {"color": {"mode": "thresholds"},"mappings": [],"thresholds": {"mode": "absolute","steps": [{"color": "green","value": null}]},"unit": "decbytes"},"overrides": []},"gridPos": {"h": 10,"w": 4,"x": 15,"y": 18},"id": 8,"options": {"colorMode": "value","graphMode": "area","justifyMode": "auto","orientation": "auto","reduceOptions": {"calcs": ["lastNotNull"],"fields": "","values": false},"textMode": "auto"},"pluginVersion": "9.0.0","targets": [{"datasource": {"type": "prometheus","uid": "8mvN3liIz"},"expr": "metrics_memory_total_max_Value{instance=\"$instance\",job=\"$job\"}","refId": "A"}],"title": "JVM最大可用总内存","type": "stat"},{"datasource": {"type": "prometheus","uid": "8mvN3liIz"},"fieldConfig": {"defaults": {"color": {"mode": "thresholds"},"mappings": [],"thresholds": {"mode": "absolute","steps": [{"color": "green","value": null}]},"unit": "decbytes"},"overrides": []},"gridPos": {"h": 10,"w": 3,"x": 19,"y": 18},"id": 12,"options": {"colorMode": "value","graphMode": "area","justifyMode": "auto","orientation": "auto","reduceOptions": {"calcs": ["lastNotNull"],"fields": "","values": false},"textMode": "auto"},"pluginVersion": "9.0.0","targets": [{"datasource": {"type": "prometheus","uid": "8mvN3liIz"},"expr": "metrics_memory_heap_init_Value{instance=\"$instance\",job=\"$job\"}","refId": "A"}],"title": "JVM初始化堆内存","type": "stat"},{"datasource": {"type": "prometheus","uid": "8mvN3liIz"},"fieldConfig": {"defaults": {"color": {"mode": "thresholds"},"mappings": [],"thresholds": {"mode": "absolute","steps": [{"color": "green","value": null}]}},"overrides": []},"gridPos": {"h": 10,"w": 2,"x": 22,"y": 18},"id": 60,"options": {"colorMode": "value","graphMode": "area","justifyMode": "auto","orientation": "auto","reduceOptions": {"calcs": ["lastNotNull"],"fields": "","values": false},"textMode": "auto"},"pluginVersion": "9.0.0","targets": [{"datasource": {"type": "prometheus","uid": "8mvN3liIz"},"expr": "jvm_threads_peak{instance=\"$instance\",job=\"$job\"}","refId": "A"}],"title": " 峰值线程数","type": "stat"},{"datasource": {"type": "prometheus","uid": "8mvN3liIz"},"fieldConfig": {"defaults": {"color": {"mode": "palette-classic"},"custom": {"axisLabel": "","axisPlacement": "auto","barAlignment": 0,"drawStyle": "line","fillOpacity": 0,"gradientMode": "none","hideFrom": {"legend": false,"tooltip": false,"viz": false},"lineInterpolation": "linear","lineWidth": 1,"pointSize": 5,"scaleDistribution": {"type": "linear"},"showPoints": "auto","spanNulls": false,"stacking": {"group": "A","mode": "none"},"thresholdsStyle": {"mode": "off"}},"mappings": [],"thresholds": {"mode": "absolute","steps": [{"color": "green","value": null},{"color": "red","value": 80}]},"unit": "decbytes"},"overrides": []},"gridPos": {"h": 10,"w": 7,"x": 0,"y": 28},"id": 18,"options": {"legend": {"calcs": [],"displayMode": "list","placement": "bottom"},"tooltip": {"mode": "single","sort": "none"}},"targets": [{"datasource": {"type": "prometheus","uid": "8mvN3liIz"},"expr": "metrics_memory_non_heap_max_Value{instance=\"$instance\",job=\"$job\"}","refId": "A"}],"title": "JVM最大可用堆外内存","type": "timeseries"},{"datasource": {"type": "prometheus","uid": "8mvN3liIz"},"fieldConfig": {"defaults": {"color": {"mode": "palette-classic"},"custom": {"axisLabel": "","axisPlacement": "auto","barAlignment": 0,"drawStyle": "line","fillOpacity": 0,"gradientMode": "none","hideFrom": {"legend": false,"tooltip": false,"viz": false},"lineInterpolation": "linear","lineWidth": 1,"pointSize": 5,"scaleDistribution": {"type": "linear"},"showPoints": "auto","spanNulls": false,"stacking": {"group": "A","mode": "none"},"thresholdsStyle": {"mode": "off"}},"mappings": [],"thresholds": {"mode": "absolute","steps": [{"color": "green","value": null},{"color": "red","value": 80}]},"unit": "decbytes"},"overrides": []},"gridPos": {"h": 10,"w": 8,"x": 7,"y": 28},"id": 40,"options": {"legend": {"calcs": ["lastNotNull"],"displayMode": "list","placement": "bottom"},"tooltip": {"mode": "single","sort": "none"}},"targets": [{"datasource": {"type": "prometheus","uid": "8mvN3liIz"},"expr": "metrics_memory_heap_used_Value{instance=\"$instance\",job=\"$job\"}","refId": "A"}],"title": "JVM已使用堆内存","type": "timeseries"},{"datasource": {"type": "prometheus","uid": "8mvN3liIz"},"fieldConfig": {"defaults": {"color": {"mode": "palette-classic"},"custom": {"axisLabel": "","axisPlacement": "auto","barAlignment": 0,"drawStyle": "line","fillOpacity": 0,"gradientMode": "none","hideFrom": {"legend": false,"tooltip": false,"viz": false},"lineInterpolation": "linear","lineWidth": 1,"pointSize": 5,"scaleDistribution": {"type": "linear"},"showPoints": "auto","spanNulls": false,"stacking": {"group": "A","mode": "none"},"thresholdsStyle": {"mode": "off"}},"mappings": [],"thresholds": {"mode": "absolute","steps": [{"color": "green","value": null},{"color": "red","value": 80}]},"unit": "percentunit"},"overrides": []},"gridPos": {"h": 10,"w": 9,"x": 15,"y": 28},"id": 54,"options": {"legend": {"calcs": ["lastNotNull"],"displayMode": "list","placement": "bottom"},"tooltip": {"mode": "single","sort": "none"}},"pluginVersion": "9.0.0","targets": [{"datasource": {"type": "prometheus","uid": "8mvN3liIz"},"expr": "metrics_memory_heap_used_Value{instance=\"$instance\",job=\"$job\"}/metrics_memory_heap_max_Value{instance=\"$instance\",job=\"$job\"}","refId": "A"}],"title": "JVM堆内存使用率","type": "timeseries"},{"datasource": {"type": "prometheus","uid": "8mvN3liIz"},"fieldConfig": {"defaults": {"color": {"mode": "palette-classic"},"custom": {"axisLabel": "","axisPlacement": "auto","barAlignment": 0,"drawStyle": "line","fillOpacity": 0,"gradientMode": "none","hideFrom": {"legend": false,"tooltip": false,"viz": false},"lineInterpolation": "linear","lineWidth": 1,"pointSize": 5,"scaleDistribution": {"type": "linear"},"showPoints": "auto","spanNulls": false,"stacking": {"group": "A","mode": "none"},"thresholdsStyle": {"mode": "off"}},"mappings": [],"thresholds": {"mode": "absolute","steps": [{"color": "green","value": null},{"color": "red","value": 80}]},"unit": "decbytes"},"overrides": []},"gridPos": {"h": 9,"w": 7,"x": 0,"y": 38},"id": 42,"options": {"legend": {"calcs": [],"displayMode": "list","placement": "bottom"},"tooltip": {"mode": "single","sort": "none"}},"targets": [{"datasource": {"type": "prometheus","uid": "8mvN3liIz"},"expr": "metrics_memory_non_heap_used_Value{instance=\"$instance\",job=\"$job\"}","refId": "A"}],"title": "JVM已使用堆外内存量","type": "timeseries"},{"datasource": {"type": "prometheus","uid": "8mvN3liIz"},"fieldConfig": {"defaults": {"color": {"mode": "palette-classic"},"custom": {"axisLabel": "","axisPlacement": "auto","barAlignment": 0,"drawStyle": "line","fillOpacity": 0,"gradientMode": "none","hideFrom": {"legend": false,"tooltip": false,"viz": false},"lineInterpolation": "linear","lineWidth": 1,"pointSize": 5,"scaleDistribution": {"type": "linear"},"showPoints": "auto","spanNulls": false,"stacking": {"group": "A","mode": "none"},"thresholdsStyle": {"mode": "off"}},"mappings": [],"thresholds": {"mode": "absolute","steps": [{"color": "green","value": null},{"color": "red","value": 80}]},"unit": "decbytes"},"overrides": []},"gridPos": {"h": 9,"w": 8,"x": 7,"y": 38},"id": 10,"options": {"legend": {"calcs": [],"displayMode": "list","placement": "bottom"},"tooltip": {"mode": "single","sort": "none"}},"targets": [{"datasource": {"type": "prometheus","uid": "8mvN3liIz"},"expr": "metrics_memory_heap_committed_Value{instance=\"$instance\",job=\"$job\"}","refId": "A"}],"title": "JVM已预留堆内存","type": "timeseries"},{"datasource": {"type": "prometheus","uid": "8mvN3liIz"},"fieldConfig": {"defaults": {"color": {"mode": "palette-classic"},"custom": {"axisLabel": "","axisPlacement": "auto","barAlignment": 0,"drawStyle": "line","fillOpacity": 0,"gradientMode": "none","hideFrom": {"legend": false,"tooltip": false,"viz": false},"lineInterpolation": "linear","lineWidth": 1,"pointSize": 5,"scaleDistribution": {"type": "linear"},"showPoints": "auto","spanNulls": false,"stacking": {"group": "A","mode": "none"},"thresholdsStyle": {"mode": "off"}},"mappings": [],"thresholds": {"mode": "absolute","steps": [{"color": "green","value": null},{"color": "red","value": 80}]},"unit": "decbytes"},"overrides": []},"gridPos": {"h": 9,"w": 9,"x": 15,"y": 38},"id": 6,"options": {"legend": {"calcs": [],"displayMode": "list","placement": "bottom"},"tooltip": {"mode": "single","sort": "none"}},"targets": [{"datasource": {"type": "prometheus","uid": "8mvN3liIz"},"expr": "metrics_memory_total_committed_Value{instance=\"$instance\",job=\"$job\"}","refId": "A"}],"title": "JVM已预留总内存","type": "timeseries"},{"datasource": {"type": "prometheus","uid": "8mvN3liIz"},"fieldConfig": {"defaults": {"color": {"mode": "palette-classic"},"custom": {"axisLabel": "","axisPlacement": "auto","barAlignment": 0,"drawStyle": "line","fillOpacity": 0,"gradientMode": "none","hideFrom": {"legend": false,"tooltip": false,"viz": false},"lineInterpolation": "linear","lineWidth": 1,"pointSize": 5,"scaleDistribution": {"type": "linear"},"showPoints": "auto","spanNulls": false,"stacking": {"group": "A","mode": "none"},"thresholdsStyle": {"mode": "off"}},"mappings": [],"thresholds": {"mode": "absolute","steps": [{"color": "green","value": null},{"color": "red","value": 80}]},"unit": "decbytes"},"overrides": []},"gridPos": {"h": 10,"w": 7,"x": 0,"y": 47},"id": 16,"options": {"legend": {"calcs": [],"displayMode": "list","placement": "bottom"},"tooltip": {"mode": "single","sort": "none"}},"pluginVersion": "9.0.0","targets": [{"datasource": {"type": "prometheus","uid": "8mvN3liIz"},"expr": "metrics_memory_non_heap_init_Value{instance=\"$instance\",job=\"$job\"}","refId": "A"}],"title": "JVM初始化堆外内存","type": "timeseries"},{"datasource": {"type": "prometheus","uid": "8mvN3liIz"},"fieldConfig": {"defaults": {"color": {"mode": "palette-classic"},"custom": {"axisLabel": "","axisPlacement": "auto","barAlignment": 0,"drawStyle": "line","fillOpacity": 0,"gradientMode": "none","hideFrom": {"legend": false,"tooltip": false,"viz": false},"lineInterpolation": "linear","lineWidth": 1,"pointSize": 5,"scaleDistribution": {"type": "linear"},"showPoints": "auto","spanNulls": false,"stacking": {"group": "A","mode": "none"},"thresholdsStyle": {"mode": "off"}},"mappings": [],"thresholds": {"mode": "absolute","steps": [{"color": "green","value": null},{"color": "red","value": 80}]}},"overrides": []},"gridPos": {"h": 10,"w": 8,"x": 7,"y": 47},"id": 22,"options": {"legend": {"calcs": [],"displayMode": "list","placement": "bottom"},"tooltip": {"mode": "single","sort": "none"}},"targets": [{"datasource": {"type": "prometheus","uid": "8mvN3liIz"},"expr": "metrics_threads_count_Value{instance=\"$instance\",job=\"$job\"}","refId": "A"}],"title": "JVM线程数","type": "timeseries"},{"datasource": {"type": "prometheus","uid": "8mvN3liIz"},"fieldConfig": {"defaults": {"color": {"mode": "palette-classic"},"custom": {"axisLabel": "","axisPlacement": "auto","barAlignment": 0,"drawStyle": "line","fillOpacity": 0,"gradientMode": "none","hideFrom": {"legend": false,"tooltip": false,"viz": false},"lineInterpolation": "linear","lineWidth": 1,"pointSize": 5,"scaleDistribution": {"type": "linear"},"showPoints": "auto","spanNulls": false,"stacking": {"group": "A","mode": "none"},"thresholdsStyle": {"mode": "off"}},"decimals": 0,"mappings": [],"min": 0,"thresholds": {"mode": "absolute","steps": [{"color": "green","value": null},{"color": "red","value": 80}]},"unit": "none"},"overrides": []},"gridPos": {"h": 10,"w": 9,"x": 15,"y": 47},"id": 24,"options": {"legend": {"calcs": [],"displayMode": "list","placement": "bottom"},"tooltip": {"mode": "single","sort": "none"}},"targets": [{"datasource": {"type": "prometheus","uid": "8mvN3liIz"},"expr": "metrics_threads_blocked_count_Value{instance=\"$instance\",job=\"$job\"}","refId": "A"}],"title": "JVM blocked线程数","type": "timeseries"},{"datasource": {"type": "prometheus","uid": "8mvN3liIz"},"fieldConfig": {"defaults": {"color": {"mode": "palette-classic"},"custom": {"axisLabel": "","axisPlacement": "auto","barAlignment": 0,"drawStyle": "line","fillOpacity": 0,"gradientMode": "none","hideFrom": {"legend": false,"tooltip": false,"viz": false},"lineInterpolation": "linear","lineWidth": 1,"pointSize": 5,"scaleDistribution": {"type": "linear"},"showPoints": "auto","spanNulls": false,"stacking": {"group": "A","mode": "none"},"thresholdsStyle": {"mode": "off"}},"mappings": [],"thresholds": {"mode": "absolute","steps": [{"color": "green","value": null},{"color": "red","value": 80}]}},"overrides": []},"gridPos": {"h": 9,"w": 7,"x": 0,"y": 57},"id": 26,"options": {"legend": {"calcs": [],"displayMode": "list","placement": "bottom"},"tooltip": {"mode": "single","sort": "none"}},"targets": [{"datasource": {"type": "prometheus","uid": "8mvN3liIz"},"expr": "metrics_threads_deadlock_count_Value{instance=\"$instance\",job=\"$job\"}","refId": "A"}],"title": "JVM deadlock线程数","type": "timeseries"},{"datasource": {"type": "prometheus","uid": "8mvN3liIz"},"fieldConfig": {"defaults": {"color": {"mode": "palette-classic"},"custom": {"axisLabel": "","axisPlacement": "auto","barAlignment": 0,"drawStyle": "line","fillOpacity": 0,"gradientMode": "none","hideFrom": {"legend": false,"tooltip": false,"viz": false},"lineInterpolation": "linear","lineWidth": 1,"pointSize": 5,"scaleDistribution": {"type": "linear"},"showPoints": "auto","spanNulls": false,"stacking": {"group": "A","mode": "none"},"thresholdsStyle": {"mode": "off"}},"mappings": [],"thresholds": {"mode": "absolute","steps": [{"color": "green","value": null},{"color": "red","value": 80}]}},"overrides": []},"gridPos": {"h": 9,"w": 8,"x": 7,"y": 57},"id": 20,"options": {"legend": {"calcs": [],"displayMode": "list","placement": "bottom"},"tooltip": {"mode": "single","sort": "none"}},"targets": [{"datasource": {"type": "prometheus","uid": "8mvN3liIz"},"expr": "metrics_threads_daemon_count_Value{instance=\"$instance\",job=\"$job\"}","refId": "A"}],"title": "JVM daemon线程数","type": "timeseries"},{"datasource": {"type": "prometheus","uid": "8mvN3liIz"},"fieldConfig": {"defaults": {"color": {"mode": "palette-classic"},"custom": {"axisLabel": "","axisPlacement": "auto","barAlignment": 0,"drawStyle": "line","fillOpacity": 0,"gradientMode": "none","hideFrom": {"legend": false,"tooltip": false,"viz": false},"lineInterpolation": "linear","lineStyle": {"fill": "solid"},"lineWidth": 1,"pointSize": 5,"scaleDistribution": {"type": "linear"},"showPoints": "auto","spanNulls": false,"stacking": {"group": "A","mode": "none"},"thresholdsStyle": {"mode": "off"}},"mappings": [],"thresholds": {"mode": "absolute","steps": [{"color": "green","value": null}]}},"overrides": []},"gridPos": {"h": 9,"w": 9,"x": 15,"y": 57},"id": 30,"options": {"legend": {"calcs": [],"displayMode": "list","placement": "bottom"},"tooltip": {"mode": "single","sort": "none"}},"targets": [{"datasource": {"type": "prometheus","uid": "8mvN3liIz"},"expr": "metrics_threads_runnable_count_Value{instance=\"$instance\",job=\"$job\"}","refId": "A"}],"title": "JVM runnable线程数","type": "timeseries"},{"datasource": {"type": "prometheus","uid": "8mvN3liIz"},"fieldConfig": {"defaults": {"color": {"mode": "palette-classic"},"custom": {"axisLabel": "","axisPlacement": "auto","barAlignment": 0,"drawStyle": "line","fillOpacity": 0,"gradientMode": "none","hideFrom": {"legend": false,"tooltip": false,"viz": false},"lineInterpolation": "linear","lineWidth": 1,"pointSize": 5,"scaleDistribution": {"type": "linear"},"showPoints": "auto","spanNulls": false,"stacking": {"group": "A","mode": "none"},"thresholdsStyle": {"mode": "off"}},"mappings": [],"thresholds": {"mode": "absolute","steps": [{"color": "green","value": null},{"color": "red","value": 80}]}},"overrides": []},"gridPos": {"h": 10,"w": 7,"x": 0,"y": 66},"id": 32,"options": {"legend": {"calcs": [],"displayMode": "list","placement": "bottom"},"tooltip": {"mode": "single","sort": "none"}},"targets": [{"datasource": {"type": "prometheus","uid": "8mvN3liIz"},"expr": "metrics_threads_terminated_count_Value{instance=\"$instance\",job=\"$job\"}","refId": "A"}],"title": "JVM terminated线程数","type": "timeseries"},{"datasource": {"type": "prometheus","uid": "8mvN3liIz"},"fieldConfig": {"defaults": {"color": {"mode": "palette-classic"},"custom": {"axisLabel": "","axisPlacement": "auto","barAlignment": 0,"drawStyle": "line","fillOpacity": 0,"gradientMode": "none","hideFrom": {"legend": false,"tooltip": false,"viz": false},"lineInterpolation": "linear","lineWidth": 1,"pointSize": 5,"scaleDistribution": {"type": "linear"},"showPoints": "auto","spanNulls": false,"stacking": {"group": "A","mode": "none"},"thresholdsStyle": {"mode": "off"}},"mappings": [],"thresholds": {"mode": "absolute","steps": [{"color": "green","value": null},{"color": "red","value": 80}]}},"overrides": []},"gridPos": {"h": 10,"w": 8,"x": 7,"y": 66},"id": 28,"options": {"legend": {"calcs": [],"displayMode": "list","placement": "bottom"},"tooltip": {"mode": "single","sort": "none"}},"targets": [{"datasource": {"type": "prometheus","uid": "8mvN3liIz"},"expr": "metrics_threads_new_count_Value{instance=\"$instance\",job=\"$job\"}","refId": "A"}],"title": "JVM new状态线程数","type": "timeseries"},{"datasource": {"type": "prometheus","uid": "8mvN3liIz"},"fieldConfig": {"defaults": {"color": {"mode": "palette-classic"},"custom": {"axisLabel": "","axisPlacement": "auto","barAlignment": 0,"drawStyle": "line","fillOpacity": 0,"gradientMode": "none","hideFrom": {"legend": false,"tooltip": false,"viz": false},"lineInterpolation": "linear","lineWidth": 1,"pointSize": 5,"scaleDistribution": {"type": "linear"},"showPoints": "auto","spanNulls": false,"stacking": {"group": "A","mode": "none"},"thresholdsStyle": {"mode": "off"}},"mappings": [],"thresholds": {"mode": "absolute","steps": [{"color": "green","value": null},{"color": "red","value": 80}]}},"overrides": []},"gridPos": {"h": 10,"w": 9,"x": 15,"y": 66},"id": 34,"options": {"legend": {"calcs": [],"displayMode": "list","placement": "bottom"},"tooltip": {"mode": "single","sort": "none"}},"targets": [{"datasource": {"type": "prometheus","uid": "8mvN3liIz"},"expr": "metrics_threads_waiting_count_Value{instance=\"$instance\",job=\"$job\"}","refId": "A"}],"title": "JVM waiting线程数","type": "timeseries"},{"datasource": {"type": "prometheus","uid": "8mvN3liIz"},"fieldConfig": {"defaults": {"color": {"mode": "palette-classic"},"custom": {"axisLabel": "","axisPlacement": "auto","barAlignment": 0,"drawStyle": "line","fillOpacity": 0,"gradientMode": "none","hideFrom": {"legend": false,"tooltip": false,"viz": false},"lineInterpolation": "linear","lineWidth": 1,"pointSize": 5,"scaleDistribution": {"type": "linear"},"showPoints": "auto","spanNulls": false,"stacking": {"group": "A","mode": "none"},"thresholdsStyle": {"mode": "off"}},"mappings": [],"thresholds": {"mode": "absolute","steps": [{"color": "green","value": null},{"color": "red","value": 80}]}},"overrides": []},"gridPos": {"h": 10,"w": 7,"x": 0,"y": 76},"id": 36,"options": {"legend": {"calcs": [],"displayMode": "list","placement": "bottom"},"tooltip": {"mode": "single","sort": "none"}},"targets": [{"datasource": {"type": "prometheus","uid": "8mvN3liIz"},"expr": "metrics_threads_timed_waiting_count_Value{instance=\"$instance\",job=\"$job\"}","refId": "A"}],"title": "JVM timed_waiting线程数","type": "timeseries"},{"datasource": {"type": "prometheus","uid": "8mvN3liIz"},"fieldConfig": {"defaults": {"color": {"mode": "palette-classic"},"custom": {"axisLabel": "","axisPlacement": "auto","barAlignment": 0,"drawStyle": "line","fillOpacity": 0,"gradientMode": "none","hideFrom": {"legend": false,"tooltip": false,"viz": false},"lineInterpolation": "linear","lineWidth": 1,"pointSize": 5,"scaleDistribution": {"type": "linear"},"showPoints": "auto","spanNulls": false,"stacking": {"group": "A","mode": "none"},"thresholdsStyle": {"mode": "off"}},"mappings": [],"thresholds": {"mode": "absolute","steps": [{"color": "green","value": null},{"color": "red","value": 80}]}},"overrides": []},"gridPos": {"h": 10,"w": 8,"x": 7,"y": 76},"id": 58,"options": {"legend": {"calcs": [],"displayMode": "list","placement": "bottom"},"tooltip": {"mode": "single","sort": "none"}},"targets": [{"datasource": {"type": "prometheus","uid": "8mvN3liIz"},"editorMode": "code","expr": "irate(jvm_gc_collection_seconds_sum{gc=\"G1 Old Generation\", ip=\"$instance\", job=\"$job\"}[5m])","legendFormat": "1分钟内FGC时长","range": true,"refId": "A"},{"datasource": {"type": "prometheus","uid": "8mvN3liIz"},"editorMode": "code","expr": "irate(jvm_gc_collection_seconds_sum{gc=\"G1 Old Generation\", ip=\"$instance\", job=\"$job\"}[5m])","hide": false,"legendFormat": " 分钟内FGC时长","range": true,"refId": "B"}],"title": "1 & 5 分钟内FGC时长","type": "timeseries"},{"datasource": {"type": "prometheus","uid": "8mvN3liIz"},"fieldConfig": {"defaults": {"color": {"mode": "palette-classic"},"custom": {"axisLabel": "","axisPlacement": "auto","barAlignment": 0,"drawStyle": "line","fillOpacity": 0,"gradientMode": "none","hideFrom": {"legend": false,"tooltip": false,"viz": false},"lineInterpolation": "linear","lineWidth": 1,"pointSize": 5,"scaleDistribution": {"type": "linear"},"showPoints": "auto","spanNulls": false,"stacking": {"group": "A","mode": "none"},"thresholdsStyle": {"mode": "off"}},"mappings": [],"thresholds": {"mode": "absolute","steps": [{"color": "green","value": null},{"color": "red","value": 80}]}},"overrides": [{"__systemRef": "hideSeriesFrom","matcher": {"id": "byNames","options": {"mode": "exclude","names": ["5分钟内FGC次数"],"prefix": "All except:","readOnly": true}},"properties": [{"id": "custom.hideFrom","value": {"legend": false,"tooltip": false,"viz": true}}]}]},"gridPos": {"h": 9,"w": 9,"x": 15,"y": 76},"id": 56,"options": {"legend": {"calcs": [],"displayMode": "list","placement": "bottom"},"tooltip": {"mode": "single","sort": "none"}},"targets": [{"datasource": {"type": "prometheus","uid": "8mvN3liIz"},"editorMode": "code","exemplar": false,"expr": "irate(jvm_gc_collection_seconds_count{gc=\"G1 Old Generation\", job=\"$job\", ip=\"$instance\"}[5m])","hide": false,"instant": false,"legendFormat": "1分钟内FGC次数","range": true,"refId": "A"},{"datasource": {"type": "prometheus","uid": "8mvN3liIz"},"editorMode": "code","expr": "irate(jvm_gc_collection_seconds_count{gc=\"G1 Old Generation\", job=\"$job\", ip=\"$instance\"}[5m])","hide": false,"legendFormat": "5分钟内FGC次数","range": true,"refId": "B"}],"title": "1 & 5 分钟内FGC次数","type": "timeseries"},{"datasource": {"type": "prometheus","uid": "8mvN3liIz"},"fieldConfig": {"defaults": {"color": {"mode": "palette-classic"},"custom": {"axisLabel": "","axisPlacement": "auto","barAlignment": 0,"drawStyle": "line","fillOpacity": 0,"gradientMode": "none","hideFrom": {"legend": false,"tooltip": false,"viz": false},"lineInterpolation": "linear","lineWidth": 1,"pointSize": 5,"scaleDistribution": {"type": "linear"},"showPoints": "auto","spanNulls": false,"stacking": {"group": "A","mode": "none"},"thresholdsStyle": {"mode": "off"}},"mappings": [],"thresholds": {"mode": "absolute","steps": [{"color": "green","value": null},{"color": "red","value": 80}]}},"overrides": []},"gridPos": {"h": 9,"w": 7,"x": 0,"y": 86},"id": 62,"options": {"legend": {"calcs": [],"displayMode": "list","placement": "bottom"},"tooltip": {"mode": "single","sort": "none"}},"targets": [{"datasource": {"type": "prometheus","uid": "8mvN3liIz"},"expr": "jvm_classes_loaded{ip=\"$instance\",job=\"$job\"}","refId": "A"}],"title": "获取当前jvm已加载类数量","type": "timeseries"}],"refresh": "10s","schemaVersion": 16,"style": "dark","tags": ["JVM"],"templating": {"list": [{"current": {"text": "prometheus","value": "prometheus"},"hide": 0,"label": null,"name": "datasource","options": [],"query": "prometheus","refresh": 1,"regex": "","skipUrlSync": false,"type": "datasource"},{"current": {"value": "${VAR_JOB}","text": "${VAR_JOB}"},"hide": 0,"label": "job","name": "job","options": [{"value": "${VAR_JOB}","text": "${VAR_JOB}"}],"query": "${VAR_JOB}","skipUrlSync": false,"type": "constant"},{"allValue": ".*","current": {},"datasource": "$datasource","definition": "","hide": 0,"includeAll": false,"label": "instance","multi": false,"name": "instance","options": [],"query": "label_values(jvm_info{job=\"$job\"},instance)","refresh": 1,"regex": "","skipUrlSync": false,"sort": 1,"tagValuesQuery": "","tags": [],"tagsQuery": "","type": "query","useTags": false},{"allValue": null,"current": {},"datasource": "$datasource","definition": "","hide": 2,"includeAll": true,"label": null,"multi": true,"name": "mempool","options": [],"query": "label_values(jvm_memory_pool_bytes_max{job=\"$job\", instance=\"$instance\"}, pool)","refresh": 1,"regex": "","skipUrlSync": false,"sort": 1,"tagValuesQuery": "","tags": [],"tagsQuery": "","type": "query","useTags": false},{"allValue": null,"current": {},"datasource": "$datasource","definition": "","hide": 2,"includeAll": true,"label": null,"multi": true,"name": "memarea","options": [],"query": "label_values(jvm_memory_bytes_used{job=\"$job\", instance=\"$instance\"}, area)","refresh": 1,"regex": "","skipUrlSync": false,"sort": 0,"tagValuesQuery": "","tags": [],"tagsQuery": "","type": "query","useTags": false}]},"time": {"from": "now-15m","to": "now"},"timepicker": {"refresh_intervals": ["5s","10s","30s","1m","5m"],"time_options": ["5m","15m","1h","6h","12h","24h","2d","7d","30d"]},"timezone": "","title": "hiveserver2-metrics","uid": "hiveserver2-jvm-dashboard","version": 3
}
这篇关于grafana+prometheus+hiveserver2(jmx_exporter+metrics)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!