Quote:
Originally Posted by syg00
If that's all you're looking for, might be easier to grep /proc/meminfo
|
Cheers, I'll try that method as well.
I'm also having a problem with converting the obtained memory/free disk space to string. I'm using this code:
PHP Code:
string DiskSensor::readSensorValue()
{
string diskspace;
diskspace = system("df /tmp | egrep tmpfs | awk '{print $4}'");
return diskspace;
}
// Return a name for our sensor
string DiskSensor::getSensorTitle()
{
return "Free Disk Space";
}
// Return the value read by the sensor
string DiskSensor::getSensorValue()
{
return readSensorValue();
}
And in another file linked to this:
PHP Code:
cout << "Sensor Title is: " << disksensor.getSensorTitle() << endl;
cout << "Sensor Value is: " << disksensor.getSensorValue() << endl;
And I get this as output:
PHP Code:
Sensor Title is: Free Disk Space
2096984
Sensor Value is:
When I want :
PHP Code:
Sensor Title is: Free Disk Space
Sensor Value is:2096984 kB
So how can I fix the string and how do I add a "kB" at the end of the disk space?
Cheers
--Kanik