/ Published in: Bash

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
. May easily be adapted to multiple processes or to fire alerts for defined limits
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
#!/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
Comments
