[users at i-scream] Cannot read file system stats

Patrick Nowak student.nowak at nordsys.de
Thu Feb 7 08:33:50 GMT 2013


Am 05.02.2013 14:12, schrieb Patrick Nowak:
> Am 05.02.2013 14:01, schrieb Patrick Nowak:
>> Am 05.02.2013 13:25, schrieb Jens Rehsack:
>>> On 05.02.13 12:33, Patrick Nowak wrote:
>>>> Hello,
>>>>
>>>> I am currently trying to use libstatgrab to read certain system
>>>> information. Reading CPU and RAM info worked perfectly. But when I try
>>>> to read file system stats using sg_get_fs_stats() I don't get any
>>>> information. The integer passed to this function returns zero, meaning
>>>> no array was created.
>>>>
>>>> My code:
>>>>
>>>> #include <iostream>
>>>> #include <cstlib>
>>>>
>>>> #include <statgrab>
>>>>
>>>> int main(void) {
>>>>      int mounted_fs;
>>>>
>>>>      sg_fs_stats *hd_stats = sg_get_fs_stats(&mounted_fs);
>>>>
>>>>      std::cout << "Number of mounted file systems: " << mounted_fs <<
>>>> std::endl << std::endl;
>>>>
>>>>      for (int i = 0; i < mounted_fs; i++) {
>>>>          std::cout << "Mount point: " << hd_stats->mnt_point << 
>>>> std::endl;
>>>>          std::cout << "Bytes total: " << hd_stats->size << std::endl;
>>>>          std::cout << "Bytes used: " << hd_stats->used << std::endl;
>>>>          std::cout << "Bytes free: " << hd_stats->avail << 
>>>> std::endl <<
>>>> std::endl;
>>>>
>>>>          hd_stats++;
>>>>      }
>>>> }
>>>>
>>>> I am using libstatgrab6, version 0.17-0ubuntu1 on an Ubuntu 12.04.
>>>>
>>>> I hope somebody can point out my error.
>>> Hi Patrick,
>>>
>>> can you try to use the version from 
>>> http://www.netbsd.org/~sno/smart-snmpd/libstatgrab-0.17.20120906.01.tar.gz 
>>> (or the github repo tdb created: https://github.com/tdb/libstatgrab) 
>>> and report whether that works or not?
>>>
>>> Thanks in advance,
>>> Jens
>> Hi Jens,
>>
>> thanks for your reply. Unfortunately that didn't help. I still get no 
>> file systems. As far as I can tell the lib I build got the same 
>> version number (6.2.3) anyway then the one installed by Ubuntu.
>>
>> Best Regards,
>> Patrick
>>
>>
>> _______________________________________________
>> users mailing list
>> users at i-scream.org
>> https://lists.i-scream.org/mailman/listinfo/users
> I stand corrected. It seems to be working now. I have no clue why 
> though. Trying to verify it now in a fresh VM with either versions of 
> libstatgrab.
>
> I will report. Thanks for now.
>
> Best Regards,
> Patrick
>
> _______________________________________________
> users mailing list
> users at i-scream.org
> https://lists.i-scream.org/mailman/listinfo/users
Hello again,

as I said before, it works with the newest version from the repo. 
Unfortunately the requirement is to use the version provided by Ubuntu 
12.04 ( 0.17-0ubuntu1) or even 10.04 (0.16-0.1).

Can anybody tell me what changed between this versions and is there a 
way to get this working with the older version?

Best regards,
Patrick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.i-scream.org/pipermail/users/attachments/20130207/32633c71/attachment.html>


More information about the users mailing list