首页 > 技术文章 > 【性能测试】:操作NMON的shell脚本

fy-- 2018-10-31 10:58 原文

nmon是监控服务器的一个工具,可以自动生成快照,每次执行命令就可以了

这里写了一个小的shell脚本,练习一下

#!/bin/sh
OSType=`uname`
#判断系统类型,选择不同命令
    if [ $OSType = "Linux" ];then
        if [ -x "nmon" ];then
            ./nmon -s ${1} -c ${2} -t -F ${3}_${4}_$(date +%y%m%d%H%M%S).nmon
            echo "${1}"
            echo "${2}"
            echo "${3}"
            echo "${4}"
        else
            echo "you need to put the file of nmon to this path,or chmod +x nmon"
        fi
    elif [ $OSType != "Linux" ];then
        nmon -s ${1} -c ${2} -t -F ${3}_${4}_$(date +%y%m%d%H%M%S).nmon
    fi

 

推荐阅读