通过Cacti进行Centos CPU /进程监控

我看了一下,但还没有find任何模板来绘制每个进程在Linux设备(centos)上使用的CPU和内存的数量。 有没有人遇到任何?

谢谢,

在仙人掌,你可以尝试使用snmpwalk但将它应用到你的任务将完全是你的工作。

但是您可以尝试安装zabbix并使用此脚本来监视几个耗费CPU的进程的CPU使用情况,这些进程的消耗超过某个阈值

 #!/bin/bash ##################################################### # topcpu # returns names of most CPU time consuming processes # as reported by 'top' ##################################################### # 05-07-2010 by Jerry Lenk # 02-11-2010 by Frater (rewrite in bash) # # Use at your own risk! ##################################################### # Add lsof to /etc/sudoers (as root) with the following command ########################## # echo zabbix ALL = NOPASSWD: `which lsof` >> /etc/sudoers # Add to zabbix_agentd.conf ########################### # echo 'UserParameter=system.topcpu[*],/usr/local/sbin/topcpu $1' >>/etc/zabbix/zabbix_agentd.conf # Restart Zabbix ################ # /etc/init.d/zabbix-agent restart # Constants nodata='.' deflimit=4 use_lsof=1 GREP='grep --color=never -a' DEBUG=0 # set limit to 1st argument (given from zabbix), or deflimit if not specified lim=`echo "$1" | tr -cd '0-9.'` [ -z "${lim}" ] && lim=${deflimit} toptail="`top -b -d1 -n2 | ${GREP} -A1 '^ *PID ' | tail -n1`" cpu=`echo "${toptail}" | awk '{print $9}'` [ ${DEBUG} -ne 0 ] && echo "Debug: \$1=$1 limit=$lim cpu=$cpu" if expr ${cpu} \<= ${lim} >/dev/null ; then echo "${nodata}" else # get PID & FULL process name (it may contain more info) pid2=`echo "${toptail}" | awk '{print $1}'` procname="`ps --pid ${pid2} -o args --no-headers 2>/dev/null`" if [ -z "${procname}" ] ; then # process is not running anymore... I might as well return nothing and quit echo "${nodata}" else user=`echo "${toptail}" | awk '{print $2}'` # return CPU usage, process owner and process name echo "${cpu}% ${user}:${procname}" if [ ${use_lsof} -ne 0 ] ; then # calculate the limit when it should execute lsof lim=$(( 2 * ${lim} + 5 )) [ ${lim} -gt 50 ] && lim=50 # Run an lsof, but exclude log files, apache modules and several runtime/library directories expr ${cpu} \> ${lim} >/dev/null && sudo lsof -p ${pid2} -S -b -w -n -Fftn0 | ${GREP} -v '^fDEL' | ${GREP} 'tREG' | ${GREP} -o '/.*' | tr -d '\0' | ${GREP} -vE '(log$|\.mo$|^/var/lib|^/lib|^/var/run|^/tmp|^/usr/|^/var/log/)' | sort -u | head -n7 fi fi fi 

zabbix中的zabbix使用说明以及此脚本的修改可以在这里find( https://www.zabbix.com/forum/showthread.php?t=17874 )。