• Hadoop记录-queue使用率


    #!/bin/sh
    ip=xxx
    port=8088
    export HADOOP_HOME=xxx
    rmstate1=$($HADOOP_HOME/yarn rmadmin -getServiceState rm1)
    rmstate2=$($HADOOP_HOME/yarn rmadmin -getServiceState rm2)
    if [[ $rmstate1 == *active* ]]
    then
       ip=xxx
    fi
    cd /home/yarn/queuecheck
    curl http://$ip:$port/ws/v1/cluster/scheduler | jq . | sed 's/"//g' > cpu.json
    tail -n 32 cpu.json > ncpu.json
    cat ncpu.json | grep -i "vCores" | awk -F ": " '{print $2}' | awk -F "," '{print $1}' > vcores.txt
    usedvcores=$(sed -n "3 p" vcores.txt | awk '{print $1}')
    maxvcores=$(sed -n "2 p" vcores.txt | awk '{print $1}')
    vrate=$(printf "%.2f" `echo "scale=2;$usedvcores/$maxvcores"|bc`)
    echo "当前已使用vcores个数:"$usedvcores
    echo "当前共分配vcores个数:"$maxvcores
    echo "当前使用率:"$vrate

        #curl http://xxx:50070/jmx?qry=Hadoop:service=NameNode,name=RpcActivityForPort8020
        #curl http://xxx:8088/jmx?qry=Hadoop:service=ResourceManager,name=QueueMetrics,q0=root

    #!/bin/sh
    ip=xxx
    port=8088
    export HADOOP_HOME=/app/hadoop/bin
    rmstate1=$($HADOOP_HOME/yarn rmadmin -getServiceState rm1)
    rmstate2=$($HADOOP_HOME/yarn rmadmin -getServiceState rm2)
    if [[ $rmstate1 == *active* ]]
    then
       ip=xxx
    fi
    cd /home/yarn/queuecheck
    curl http://$ip:$port/ws/v1/cluster/scheduler | jq . | sed 's/"//g' > mem.json
    tail -n 32 mem.json > nmem.json
    cat nmem.json | grep -i "memory" | awk -F ": " '{print $2}' | awk -F "," '{print $1}' > mem.txt
    usedmem=$(sed -n "3 p" mem.txt | awk '{print $1/1024/1024}')
    maxmem=$(sed -n "2 p" mem.txt | awk '{print $1/1024/1024}')
    mrate=$(printf "%.2f" `echo "scale=2;$usedmem/$maxmem"|bc`)
    echo "当前已使用内存(TB):"$usedmem
    echo "当前共分配内存(TB):"$maxmem
    echo "当前使用率:"$mrate
  • 相关阅读:
    宝塔nginx配置
    宝塔apache配置
    公司代码规范
    发送短信倒计时
    js layui 分页脚本
    常用mysql
    win10子系统ubuntu下安装nodejs,并使用n管理版本
    Cocos Creator 热更新文件MD5计算和需要注意的问题
    android app 闪屏
    关于模板测试几个问题
  • 原文地址:https://www.cnblogs.com/xinfang520/p/10773963.html
Copyright © 2020-2023  润新知