2023-03-03 服務(wù)發(fā)現(xiàn)

在prometheus.yml中配置的靜態(tài)功能static_configs 來(lái)手工添加主機(jī)IP地址與端口。
首先在應(yīng)用JVM中配置,例如在namenode中配置

-XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=65  -XX:+CMSParallelRemarkEnabled  -Xmn8G -XX:MetaspaceSize=512m -XX:MaxMetaspaceSize=512m -XX:+DisableExplicitGC  -XX:+PrintGCDateStamps  -XX:+PrintGCDetails -XX:+PrintReferenceGC   -XX:+PrintGCTimeStamps  -XX:PrintFLSStatistics=1    -XX:+PrintGCCause  -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=20 -XX:GCLogFileSize=20M  -Xloggc:/var/log/hadoop-hdfs/hdfs-namenode-gc.log  -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=true -Dcom.sun.management.jmxremote.access.file=/opt/prometheus/conf/cdh/hadoop/hadoop.jmxremote.access -Dcom.sun.management.jmxremote.password.file=/opt/prometheus/conf/cdh/hadoop/hdfs.jmxremote.password -Dcom.sun.management.jmxremote.port=11000 -javaagent:/opt/prometheus/exporter/jmx/jmx_prometheus_javaagent-0.12.0.jar=21000:/opt/prometheus/conf/cdh/hadoop/namenode.yaml

在prometheus.yml配置相應(yīng)的json路徑

 - job_name: 'Hadoop'
    file_sd_configs:
    - files:
      - conf/targets/hadoop/hdfs-namenodes.json
    relabel_configs:
    - source_labels: ["__address__"]
      regex: "(.*?.yto.clound):.*"
      action: replace
      replacement: "$1"
      target_label: "hostname"
    - source_labels: ["__address__"]
      regex: "(.*).yto.clound.*"
      action: replace
      replacement: "$1"
      target_label: "shorthostname"

在hdfs-namenodes.json中定義被監(jiān)控組件的暴露的端口。
例如

[
    {
        "targets": [
            "srvbd17.yto.clound:21000",
            "srvbd33.yto.clound:21000",
            "srvbd17.yto.clound:9070",
            "srvbd33.yto.clound:9070",
            "srvbd33.yto.clound:9709"
        ],
        "labels": {
            "environment": "Production",
            "scope": "CDH",
            "service": "HDFS",
            "role": "NameNode"
        }
    }
]
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容