注:脚本为.sh的文件,修改其中的PROCESSNAME值为你要监控的进程名即可,且进行名不能太长,否则监控不到进程的数值.
如:PROCESSNAME="dataserver CnmCommonDm CnmCwmpMain businessframemain java u2560_acs"
#!/bin/bash
# default setting
#PROCESSNAME="dataserver EmfPerfDm EmfSyslogAgent EmfSchdSvr EmfSysMoniDm EmfFaultDm EmfExamDm EmfTrapReceiver EmfProjDocDm EmfTopoDm EmfSecuDm EmfAlarmAgent EmfSyslog EmfProxyServer EmfDBBackup EmfGnlDevDm BmsCommon BmsDam BmsTrunkMgrDm BmsTimingTask mdp EmfSysMoniDm BmsGdm BmsDct BmsVoip BmsXpon BmsTdmVoice BmsAtm BmsPvc BmsAtur BmsProfile BmsProtocol BmsPollMgr BmsIgmp BmsEth BmsAclQos BmsXdsl BmsVlan "
PROCESSNAME="dataserver CnmCommonDm CnmCwmpMain businessframemain java u2560_acs"
DISKNAME=""
#--------------------------------------
#Show help information
#--------------------------------------
help()
{
echo "################################################################################################################"
echo "# Name: collectMan"
echo "# Version: V2.01"
echo "#"
echo "# Purpose:"
echo "# Collect Solaris system information, save it to file."
echo "# Make it easy to get Solaris system performance information in performance testing."
echo "#"
echo "#Usage:"
echo "# Make a folder and copy CollectMan.sh to this folder."
echo "# Use 'sh ./collectMan.sh' to collect all data for CMF testing."
echo "# Use 'sh ./collectMan.sh -h' to see more help."
echo "#"
echo "# Report will save in './report' folder."
echo "# [PS_ProcessName].txt : Process's cpu, memory data for each process."
echo "# server_summary_report.txt : The summary report for server's cpu, memory, diskio, network."
echo "# "
echo "# temp_iostat.txt : Each disk's io data."
echo "# temp_iostat_cpu.txt : Summary iostat."
echo "# temp_mpstat.txt : Data for each CPU."
echo "# temp_vmstat.txt : Server memory data."
echo "# temp_netstat_[netif].txt : Net interface data."
echo "# "
echo "#Note:"
echo "# 1. You can open PS_[ProcessName].txt and server_summary_report.txt by excel. "
echo "# It is easy to make chart for performance test report."
echo "# 2. summary report include three disk partitions information. "
echo "# You can use '-disk c1t1d0s4 c1t2d0s6 c1t3d0s6' to assign partition you want collect."
echo "# If you not assign any disk, default is the first three disk partition in 'df -k' list."
echo "# 3. summary report include two net interfaces information. "
echo "# You can use '-net ce0 ce1' to assign net interface."
echo "# If you not assign, default is the first two net interface in 'netstat -i' list."
echo "#"
如:PROCESSNAME="dataserver CnmCommonDm CnmCwmpMain businessframemain java u2560_acs"
#!/bin/bash
# default setting
#PROCESSNAME="dataserver EmfPerfDm EmfSyslogAgent EmfSchdSvr EmfSysMoniDm EmfFaultDm EmfExamDm EmfTrapReceiver EmfProjDocDm EmfTopoDm EmfSecuDm EmfAlarmAgent EmfSyslog EmfProxyServer EmfDBBackup EmfGnlDevDm BmsCommon BmsDam BmsTrunkMgrDm BmsTimingTask mdp EmfSysMoniDm BmsGdm BmsDct BmsVoip BmsXpon BmsTdmVoice BmsAtm BmsPvc BmsAtur BmsProfile BmsProtocol BmsPollMgr BmsIgmp BmsEth BmsAclQos BmsXdsl BmsVlan "
PROCESSNAME="dataserver CnmCommonDm CnmCwmpMain businessframemain java u2560_acs"
DISKNAME=""
#--------------------------------------
#Show help information
#--------------------------------------
help()
{
echo "################################################################################################################"
echo "# Name: collectMan"
echo "# Version: V2.01"
echo "#"
echo "# Purpose:"
echo "# Collect Solaris system information, save it to file."
echo "# Make it easy to get Solaris system performance information in performance testing."
echo "#"
echo "#Usage:"
echo "# Make a folder and copy CollectMan.sh to this folder."
echo "# Use 'sh ./collectMan.sh' to collect all data for CMF testing."
echo "# Use 'sh ./collectMan.sh -h' to see more help."
echo "#"
echo "# Report will save in './report' folder."
echo "# [PS_ProcessName].txt : Process's cpu, memory data for each process."
echo "# server_summary_report.txt : The summary report for server's cpu, memory, diskio, network."
echo "# "
echo "# temp_iostat.txt : Each disk's io data."
echo "# temp_iostat_cpu.txt : Summary iostat."
echo "# temp_mpstat.txt : Data for each CPU."
echo "# temp_vmstat.txt : Server memory data."
echo "# temp_netstat_[netif].txt : Net interface data."
echo "# "
echo "#Note:"
echo "# 1. You can open PS_[ProcessName].txt and server_summary_report.txt by excel. "
echo "# It is easy to make chart for performance test report."
echo "# 2. summary report include three disk partitions information. "
echo "# You can use '-disk c1t1d0s4 c1t2d0s6 c1t3d0s6' to assign partition you want collect."
echo "# If you not assign any disk, default is the first three disk partition in 'df -k' list."
echo "# 3. summary report include two net interfaces information. "
echo "# You can use '-net ce0 ce1' to assign net interface."
echo "# If you not assign, default is the first two net interface in 'netstat -i' list."
echo "#"
本文介绍了一个用于收集Solaris系统信息的bash脚本。该脚本能够收集系统的CPU使用率、内存使用情况、磁盘I/O及网络状态等信息,并将数据保存到指定文件中,便于后续分析。

被折叠的 条评论
为什么被折叠?



