Return to Snippet

Revision: 24590
at March 5, 2010 05:17 by blackthorne


Updated Code
#!/bin/bash
TIME_UNIT=60
PROCESS="SQLSubscriber"
LOG_FILE="/var/log/ap/sql_subscriber.log"
while [ 1 ]; do sleep $TIME_UNIT; MEM=`ps -eo cmd,pcpu,rss|grep -i $PROCESS|grep -v grep|awk '{print $4","$5}'`; echo `date +"%m-%d-%Y %H:%M:%S"`,$MEM >> $LOG_FILE; done

Revision: 24589
at March 4, 2010 15:01 by blackthorne


Initial Code
#!/bin/bash
TIME_UNIT=3
PROCESS="SQLSubscriber"
LOG_FILE="/var/log/ap/sql_subscriber.log"
while [ 1 ]; do sleep $TIME_UNIT; MEM=`ps -eo cmd,pcpu,rss|grep -i $PROCESS|grep -v grep|awk '{print $4","$5}'`; echo `date +"%m-%d-%Y"`,$MEM >> $LOG_FILE; done

Initial URL

                                

Initial Description
generates CSV log file with CPU and memory usage as metrics for a desired process
. May easily be adapted to multiple processes or to fire alerts for defined limits

Initial Title
process monitor (CPU,memory)

Initial Tags

                                

Initial Language
Bash