atarallo / TECMINT_MONITOR

A Shell Script to Monitor Network, Disk Usage, Uptime, Load Average and RAM Usage in Linux. Originally published on http://www.tecmint.com
Apache License 2.0
248 stars 145 forks source link

Disk Usage only displays headings - CentOS6 #15

Open martinmenge opened 8 years ago

martinmenge commented 8 years ago

Tried this on two CentOS 6 servers. Disk Usages : "Filesystem Size Used Avail Use% Mounted on" No other data provided. I tried df -h| grep 'Filesystem\|/dev/sda*' on its own, same effect.

I tried df -h| grep 'Filesystem\|/dev/xvda1' which worked. I edited the script to have df -h| grep 'Filesystem\|/dev/xvda*' but it was unchanged. I then tried xvda1 (no wildcard) and it worked on the one server.

When I edited the scripts with the specific mount drives, I still only got the headers when I ran the script.

atarallo commented 8 years ago

I currently don't have access to redhat centos systems. Feel free to fix it and add a patch on development branch.

svicknesh commented 6 years ago

Sorry, I know this is old but I made a change to the code to detect all the disks and have them displayed. The above situation occurs when the OS is running on a VM. Below are my changes that works on physical or VM installs.

hddisk=$(lsblk | grep disk | awk '{print $1}')
df -h| grep "Filesystem\|/dev/${hddisk}*" > /tmp/diskusage