WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Any way to monitor cpu temp, remaining ram and disk read write check  (Read 4424 times)

Offline malikawan

  • Full Member
  • ***
  • Posts: 243
I want to monitor read write disk, remaining ram and cpu temperature with script and write the output to file. I need just commands or any idea to write a script if any one can help. Thanks in advance

Offline patrikg

  • Wiki Author
  • Hero Member
  • *****
  • Posts: 723
Re: Any way to monitor cpu temp, remaining ram and disk read write check
« Reply #1 on: April 18, 2016, 06:47:12 AM »
Why just write the info to a text file ??
Just do a sqlite3 database.
For easy parse the values from the database afterwards.

https://www.sqlite.org/cli.html

http://stackoverflow.com/questions/4152321/how-to-automate-an-insert-into-process-in-sqlite?answertab=active#tab-top

Offline Misalf

  • Hero Member
  • *****
  • Posts: 1702
Download a copy and keep it handy: Core book ;)

Offline Misalf

  • Hero Member
  • *****
  • Posts: 1702
Re: Any way to monitor cpu temp, remaining ram and disk read write check
« Reply #3 on: April 18, 2016, 07:13:10 AM »
RAM: Try the  free  command.
Code: [Select]
free -m | awk '/Mem:/ {printf "Free: %s MB\n", $4}'

CPU temperature: Possible with  lm_sensors  which is currently not available in the 7.0 x86 repo.
Download a copy and keep it handy: Core book ;)

Offline Misalf

  • Hero Member
  • *****
  • Posts: 1702
Re: Any way to monitor cpu temp, remaining ram and disk read write check
« Reply #4 on: April 18, 2016, 07:40:09 AM »
Free memory including buffers and cache:
Code: [Select]
echo "Free: $(( $(( $(cat /proc/meminfo | awk '/^MemFree:/ {print $2}') + $(cat /proc/meminfo | awk '/^Cached:/ {print $2}') + $(cat /proc/meminfo | awk '/^Buffers:/ {print $2}') )) / 1024 )) MB"
Download a copy and keep it handy: Core book ;)

Offline patrikg

  • Wiki Author
  • Hero Member
  • *****
  • Posts: 723
Re: Any way to monitor cpu temp, remaining ram and disk read write check
« Reply #5 on: April 18, 2016, 08:30:25 AM »
For temp without decimals.
Code: (bash) [Select]
echo $(($(cat /sys/class/thermal/thermal_zone0/temp)/1000))
For more funny solution to support 2 decimals need bc.
Code: (bash) [Select]
echo $'scale=2\n'$(cat /sys/class/thermal/thermal_zone0/temp)/1000 | bc
« Last Edit: April 18, 2016, 08:59:51 AM by patrikg »