zoukankan      html  css  js  c++  java
  • nagios 监控shell脚本

                                 线上应用shell脚本                         

    参考链接:http://os.51cto.com/art/201301/376725.htm

    • 0--各方面都正常,检查成功完成。
    • 1--资源处于警告状态。某个地方不太妙。
    • 2--资源处于临界状态。原因可能是主机宕机或服务未运行。
    • 3--未知状态,这未必表明就有问题,而是表明检查没有给出一个清楚明确的状态。
    nagios监控游戏注册人数:
    
    #!/bin/bash
    REG=$(cat /data/bobo_online/res2.txt | grep "^3" | cut -d , -f 2)
    if [ $REG -gt 8500 ];then
            echo "Android ID:3,regist num is $REG man,Critical"
    exit 2
    elif [ $REG -gt 7500 ];then
            echo "Android ID:3,regist num is $REG man,Warning"
    exit 1
    else
            echo "Android ID:3,regist num is $REG man,OK"
    exit 0
    fi
    nagios监控mysql主从状态:
    
    #!/bin/sh
    slave_is=($(mysql -S /tmp/mysql3306.sock -uroot -e "show slave statusG"|grep "Slave_.*_Running" |awk '{print $2}')) 
    if [ "${slave_is[0]}" = "Yes" -a "${slave_is[1]}" = "Yes" ]
         then
         echo "OK SDK-slave3307 connect master3306 is running"
         exit 0
    else
         echo "Critical SDK-slave3307 connect master3306 is not running"
         exit 2
    fi 
    nagios监控keepalived进程:
    
    #!/bin/sh 
    KPD=`ps aux | grep 'keepalived -D' |grep -v grep |wc -l` 
    if [ $KPD -ne 3 ]
    then 
    echo "Critical!Keepalived process count is $KPD" 
    exit 2 
    fi 
    echo "OK . Keepalived process count is $KPD" 
    exit 0 
  • 相关阅读:
    vue项目开发流程
    板子-补充
    Python 类对象的JSON序列化与反序列化
    Maven中央仓库地址配置大全
    Docker 中搭建 MySQL 主从复制
    mac 上必备的工具
    iTerm 中 oh my zsh 主题去掉 git 目录多级显示
    iTerm2 主题设置
    MySQL查看表占用空间大小
    MySQL 语句报错:1093
  • 原文地址:https://www.cnblogs.com/tangshengwei/p/5144889.html
Copyright © 2011-2022 走看看