Pages

Wednesday, May 29, 2024

crontab to monitor sar

crontab -e
59 23 * * * /software/oracle/oracle/.scripts/monitor/sar/sar_monitor.sh

sar_monitor.sh
WORK_DIR=/software/oracle/oracle/.scripts/monitor/sar
RUN_DATE=`date +"%Y%m%d"_"%H%M%S"`
DELIMITER="================="

#swap
echo ${DELIMITER} >> ${WORK_DIR}/sar_swap_usage.txt
echo "Run Date: ${RUN_DATE}" >> ${WORK_DIR}/sar_swap_usage.txt
sar -S >> ${WORK_DIR}/sar_swap_usage.txt

#memory
echo ${DELIMITER} >> ${WORK_DIR}/sar_memory_usage.txt
echo "Run Date: ${RUN_DATE}" >> ${WORK_DIR}/sar_memory_usage.txt
sar -r >> ${WORK_DIR}/sar_memory_usage.txt

#cpu
echo ${DELIMITER} >> ${WORK_DIR}/sar_cpu_usage.txt
echo "Run Date: ${RUN_DATE}" >> ${WORK_DIR}/sar_cpu_usage.txt
sar -p >> ${WORK_DIR}/sar_cpu_usage.txt

No comments:

Post a Comment