首页 文章 精选 留言 我的

精选列表

搜索[服务器监控],共10000篇文章
优秀的个人博客,低调大师

hbase监控简单实用脚本

我们以前使用过的对hbase和hdfs进行健康检查,及剩余hdfs容量告警,简单易用 1.针对hadoop2的脚本: #/bin/bashbin=`dirname $0`bin=`cd $bin;pwd`STATE_OK=0STATE_WARNING=1STATE_CRITICAL=2STATE_UNKNOWN=3STATE_DEPENDENT=4source /etc/profileDFS_REMAINING_WARNING=15DFS_REMAINING_CRITICAL=5ABNORMAL_QUERY="INCONSISTENT|CORRUPT|FAILED|Exception"HADOOP_WEB_INTERFACE=h001.hadoopHBASE_WEB_INTERFACE=h008.hadoop# hbck and fsck reportoutput=/var/log/cluster-statushbase hbck >> $outputhadoop fsck /apps/hbase >> $output# check reportcount=`egrep -c "$ABNORMAL_QUERY" $output`if [ $count -eq 0 ]; thenecho "[OK] Cluster is healthy." >> $outputelseecho "[ABNORMAL] Cluster is abnormal!" >> $output# Get the last matching entry in the report filelast_entry=`egrep "$ABNORMAL_QUERY" $output | tail -1`echo "($count) $last_entry"exit $STATE_CRITICALfi# HDFS usagedfs_remaining=`curl -s http://${HADOOP_WEB_INTERFACE}:50070/jmx?qry=Hadoop:service=NameNode,name=NameNodeInfo |egrep -o "PercentRemaining.*" | egrep -o "[0-9]*\.[0-9]*"`dfs_remaining_word="DFS Remaining%: ${dfs_remaining}%"echo "$dfs_remaining_word" >> $output# check HDFS usagedfs_remaining=`echo $dfs_remaining | awk -F '.' '{print $1}'`if [ $dfs_remaining -lt $DFS_REMAINING_CRITICAL ]; thenecho "Low DFS space. $dfs_remaining_word"exit_status=$STATE_CRITICALelif [ $dfs_remaining -lt $DFS_REMAINING_WARNING ]; thenecho "Low DFS space. $dfs_remaining_word"exit_status=$STATE_WARNINGelseecho "HBase check OK - DFS and HBase healthy.$dfs_remaining_word"exit_status=$STATE_OKfiexit $exit_status 2.针对hadoop1的脚本: #/bin/bash bin=`dirname $0` bin=`cd $bin;pwd` STATE_OK=0 STATE_WARNING=1 STATE_CRITICAL=2 STATE_UNKNOWN=3 STATE_DEPENDENT=4 source /etc/profile DFS_REMAINING_WARNING=15 DFS_REMAINING_CRITICAL=5 ABNORMAL_QUERY="INCONSISTENT|CORRUPT|FAILED|Exception" HADOOP_WEB_INTERFACE= hadoop的Namenode对外接口ip # hbck and fsck report output=/data/logs/cluster-status $HBASE_HOME/bin/hbase hbck >> $output $HADOOP_HOME/bin/hadoop fsck /hbase >> $output # check report count=`egrep -c "$ABNORMAL_QUERY" $output` if [ $count -eq 0 ]; then echo "[OK] Cluster is healthy." >> $output else echo "[ABNORMAL] Cluster is abnormal!" >> $output # Get the last matching entry in the report file last_entry=`egrep "$ABNORMAL_QUERY" $output | tail -1` echo "($count) $last_entry" exit $STATE_CRITICAL fi # Check RegionServer Status dead_region_servers=`curl -s http://${HADOOP_WEB_INTERFACE}:60010/master-status | grep "Dead Region Servers" -A 500 | grep "Regions in Transition" -B 500 | egrep -o 'target="_blank">.*</a>' | awk -F">" '{print $2}' | awk -F"<" '{print $1}'` if [ -z $dead_region_servers ];then echo "[OK] All RegionServers is healthy." echo "[OK] All RegionServers is healthy." >> $output else echo "[ABNORMAL] the dead regionserver list:" >> $output echo $dead_region_servers >> $output exit $STATE_CRITICAL fi # HDFS usage dfs_remaining=`curl -s http://${HADOOP_WEB_INTERFACE}:50070/dfshealth.jsp |egrep -o "DFS Remaining%.*%" | egrep -o "[0-9]*\.[0-9]*"` dfs_remaining_word="DFS Remaining%: ${dfs_remaining}%" echo "$dfs_remaining_word" >> $output # check HDFS usage dfs_remaining=`echo $dfs_remaining | awk -F '.' '{print $1}'` if [ $dfs_remaining -lt $DFS_REMAINING_CRITICAL ]; then echo "Low DFS space. $dfs_remaining_word" exit_status=$STATE_CRITICAL elif [ $dfs_remaining -lt $DFS_REMAINING_WARNING ]; then echo "Low DFS space. $dfs_remaining_word" exit_status=$STATE_WARNING else echo "HBase check OK - DFS and HBase healthy. $dfs_remaining_word" exit_status=$STATE_OK fi exit $exit_status

资源下载

更多资源
Mario

Mario

马里奥是站在游戏界顶峰的超人气多面角色。马里奥靠吃蘑菇成长,特征是大鼻子、头戴帽子、身穿背带裤,还留着胡子。与他的双胞胎兄弟路易基一起,长年担任任天堂的招牌角色。

Nacos

Nacos

Nacos /nɑ:kəʊs/ 是 Dynamic Naming and Configuration Service 的首字母简称,一个易于构建 AI Agent 应用的动态服务发现、配置管理和AI智能体管理平台。Nacos 致力于帮助您发现、配置和管理微服务及AI智能体应用。Nacos 提供了一组简单易用的特性集,帮助您快速实现动态服务发现、服务配置、服务元数据、流量管理。Nacos 帮助您更敏捷和容易地构建、交付和管理微服务平台。

Sublime Text

Sublime Text

Sublime Text具有漂亮的用户界面和强大的功能,例如代码缩略图,Python的插件,代码段等。还可自定义键绑定,菜单和工具栏。Sublime Text 的主要功能包括:拼写检查,书签,完整的 Python API , Goto 功能,即时项目切换,多选择,多窗口等等。Sublime Text 是一个跨平台的编辑器,同时支持Windows、Linux、Mac OS X等操作系统。

WebStorm

WebStorm

WebStorm 是jetbrains公司旗下一款JavaScript 开发工具。目前已经被广大中国JS开发者誉为“Web前端开发神器”、“最强大的HTML5编辑器”、“最智能的JavaScript IDE”等。与IntelliJ IDEA同源,继承了IntelliJ IDEA强大的JS部分的功能。

用户登录
用户注册