grafana+prometheus+hiveserver2(jmx_exporter+metrics)

2024-02-08 02:20

本文主要是介绍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)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/689650

相关文章

【Prometheus】PromQL向量匹配实现不同标签的向量数据进行运算

✨✨ 欢迎大家来到景天科技苑✨✨ 🎈🎈 养成好习惯,先赞后看哦~🎈🎈 🏆 作者简介:景天科技苑 🏆《头衔》:大厂架构师,华为云开发者社区专家博主,阿里云开发者社区专家博主,CSDN全栈领域优质创作者,掘金优秀博主,51CTO博客专家等。 🏆《博客》:Python全栈,前后端开发,小程序开发,人工智能,js逆向,App逆向,网络系统安全,数据分析,Django,fastapi

Prometheus与Grafana在DevOps中的应用与最佳实践

Prometheus 与 Grafana 在 DevOps 中的应用与最佳实践 随着 DevOps 文化和实践的普及,监控和可视化工具已成为 DevOps 工具链中不可或缺的部分。Prometheus 和 Grafana 是其中最受欢迎的开源监控解决方案之一,它们的结合能够为系统和应用程序提供全面的监控、告警和可视化展示。本篇文章将详细探讨 Prometheus 和 Grafana 在 DevO

图解可观测Metrics, tracing, and logging

最近在看Gophercon大会PPT的时候无意中看到了关于Metrics,Tracing和Logging相关的一篇文章,凑巧这些我基本都接触过,也是去年后半年到现在一直在做和研究的东西。从去年的关于Metrics的goappmonitor,到今年在排查问题时脑洞的基于log全链路(Tracing)追踪系统的设计,正好是对这三个话题的实践。这不禁让我对它们的关系进行思考:Metrics和Loggi

java后端服务监控与告警:Prometheus与Grafana集成

Java后端服务监控与告警:Prometheus与Grafana集成 大家好,我是微赚淘客返利系统3.0的小编,是个冬天不穿秋裤,天冷也要风度的程序猿! 在现代的微服务架构中,监控和告警是确保服务稳定性的关键组成部分。Prometheus和Grafana是两个强大的工具,它们可以集成在一起,为Java后端服务提供实时监控和可视化告警。 服务监控的重要性 服务监控可以帮助我们实时了解服务的健

如何使用Prometheus与Grafana监控Kubernetes集群

使用Prometheus与Grafana监控Kubernetes集群 一、引言 Kubernetes作为目前最受欢迎的容器编排工具,已经成为现代应用部署和管理的核心平台。然而,随着集群规模的扩大和复杂性的增加,对其进行有效的监控变得至关重要。Prometheus与Grafana是广泛使用的开源监控和可视化工具,能够提供强大的监控、报警和数据可视化功能。本文将详细介绍如何使用Prometheus

prometheus删除指定metrics下收集的值

Prometheus 删除指定 Metric 官方文档: ​ - https://prometheus.io/docs/prometheus/latest/querying/api/#tsdb-admin-apis Prometheus 的管理 API 接口,官方到现在一共提供了三个接口,对应的分别是快照功能、数据删除功能、数据清理功能,想要使用 API 需要先添加启动参数 --web.en

Grafana+prometheus+php 自动创建监控图

背景 在grafana+ prometheus+php 监控系统实践文章当中已经实现了我们的第一个监控图表,现在我们有了一个新需求,需要对多个节点实现不同的监控,以及一个汇总的监控; 按照我们之前手动创建仪表盘的方法,每新增一个节点都需要手动去修改prometheus配置,并且需要去grafana系统当中创建一个仪表盘,在节点很少的时候这种方式也能满足,但当节点数量多起来的时候,就会增加很大一

grafana+ prometheus+php 监控系统实践

背景 团队在开发流媒体服务,需要实现一个监控在线人数的功能,可以看到历史有多少人在线,当前有多少人在线的功能。 如果用mysql等关系型数据库来实现,可以用事件记录日志,然后通过PHP加上一些绘图的插件来实现,但这种方式并不好,首先用关系型数据库随着时间累积,会存在数据量越来越大,导致查询缓慢,再者需要编写这部分统计代码,因此并不是最佳选择。 我们很快找到了一个“时序性数据库”(promet

Prometheus异常处理

文章目录 Prometheus 的功能和使用场景功能使用场景 Docker 服务的创建和启动1. 安装 Docker2. 创建 Prometheus 配置文件3. 启动 Prometheus Docker 容器4. 访问 Prometheus 常见报错及解决方法1. 配置文件错误2. 端口冲突3. 容器无法启动4. 配置文件挂载失败5. 无法访问 Prometheus Web 界面6. 服务

干掉ELK | 使用Prometheus+Grafana搭建监控平台

点击上方蓝色字体,选择“设为星标” 回复”资源“获取更多资源 大数据技术与架构 点击右侧关注,大数据开发领域最强公众号! 暴走大数据 点击右侧关注,暴走大数据! 什么是Prometheus? Prometheus是由SoundCloud开发的开源监控报警系统和时序列数据库(TSDB)。Prometheus使用Go语言开发,是Google BorgMon监控系统的开源版本。 Promet