Secondly I have schedule cron job to run this script every after 10 minutes --> so in file (/mnt/report.csv) I am getting data every after 10 minutes.
Requirement :
I have Microsoft SQL Server running on windows server 2019 already. I need to send output from this script (CPU,RAM,HDD - usage) directly to (Microsoft SQL Server database - table) rather then file (/mnt/report.csv) every after 10 minutes.
Any advice or help please what needs to be done ??
Hi,
SCENARIO : I have created script which is giving output for CPU,RAM,HDD (root) usage and saving output values in (.csv) file /mnt/report.csv.
!/bin/bash
--------Print Operating System Details--------
HOSTNAME=$(hostname)
--------Check for HDD--------
DISK_USAGE=
df -h / | awk '{ print $5}' | tail -1
--------Check for CPU Utilization--------
CPU_IDLE=
top -b -n 1 | grep Cpu | awk '{print $8}'|cut -f 1 -d "."
CPU_USED=expr 100 - $CPU_IDLE
--------Check for MEMORY Utilization--------
MEM_USGAE=
free | grep Mem | awk '{print $3/$2 * 100.0}' | cut -f1 -d'.'
TIME=date +%H:%M
DATE=date +%d/%m/%Y
echo "$HOSTNAME,$DATE,$TIME,${CPU_USED}%,${MEM_USGAE}%,${DISK_USAGE}" >> /mnt/report.csv
Secondly I have schedule cron job to run this script every after 10 minutes --> so in file (/mnt/report.csv) I am getting data every after 10 minutes.
Requirement : I have Microsoft SQL Server running on windows server 2019 already. I need to send output from this script (CPU,RAM,HDD - usage) directly to (Microsoft SQL Server database - table) rather then file (/mnt/report.csv) every after 10 minutes.
Any advice or help please what needs to be done ??