Plotting CPU and Ram utilization
I want to plot the CPU and memory utilisation of an Apache server hosted in Raspberry Pi 3B+ with Raspbian Stretch in it. For that I have followed the procedure mentioned here. The instructions work fine in a Ubuntu Desktop with the modification,
top -p $PID -bn 1 in place of
top -p $PID -bMn 1 in monitor-usage.sh file. But using the same in Raspberry Pi, it fails to extract the CPU and memory info. On further studying, I found out that the instruction,
egrep '^[0-9]+' is not working in Raspberry Pi. What could be the possible reason? And how can I achieve my goal if I have to find any alternative?