Hi Ilya,

> "df" has some formating issues. i.e. if you have a very long string
> that defines your partition, it will insert new lines.
>
> Example:
> Filesystem            Size  Used Avail Use% Mounted on
> /dev/mapper/rootvg-rootvol
>                       256G  122G  121G  51% /
> Mynfsserver:/med/linux.some-share
>                            256G  122G  123G  51% /
>
> Though I can reformat as I like, I thought there would be an easier
> way via proc/sys. I guess I was wrong.
>
> I may have to use python script by JCH.

I had a similar issue a while back, which was messing up my space
reporting since it picked the wrong numbers when df was split up
into multiple lines. I got around it in bash like this:

result=`/bin/df -B 1 $spacetoken | grep -v Filesystem`
result=`echo $result | awk '{print $3}'`

I.e., the variable $result will have everything space separated,
therefore "in one line" as you will, so it no longer matters
that the original df output was split up into multiple lines.

Hope this helps,

        Horst

-----Original Message-----
From: rhelv5-list-boun...@redhat.com [mailto:rhelv5-list-boun...@redhat.com] On Behalf Of Procaccini, Tony J.
Sent: Monday, November 14, 2011 10:52 AM
To: 'rhelv5-list@redhat.com'
Subject: Re: [rhelv5-list] free space via proc or sys

>> >>On 11/10/2011 12:21 PM, Musayev, Ilya wrote:
>> >>
>> >> Would anyone know of a way to check the free disk space on local
>> >> partition via proc or sys? Or anything else except for "df"?
>> >>
>> >> I'd like to avoid use of python/perl if possible and stay within bash.
>> >>
>> >>
> >Configure snmpd and query it via snmpget.
> >
> >--
> >Benjamin Franz
Agree with snmp but try snmpdf vice snmpget if formats nicely.
#snmpdf -v2c -c <community> localhost

What don't you like about "df"? I wrapped df in python nicely once, with some df options like exclude and local etc....
The statvfs seems to be a bit unreadable using in the past.

Tony
_______________________________________________
rhelv5-list mailing list
rhelv5-list@redhat.com
https://www.redhat.com/mailman/listinfo/rhelv5-list

_______________________________________________
rhelv5-list mailing list
rhelv5-list@redhat.com
https://www.redhat.com/mailman/listinfo/rhelv5-list

Reply via email to