--- smsdaemon/plugins/HostStatusPlugin.cpp 2008/12/08 21:49:49 158 +++ smsdaemon/plugins/HostStatusPlugin.cpp 2008/12/15 09:10:05 185 @@ -3,6 +3,9 @@ #include "Sms.h" #include "Util.h" +#include +#include +#include using namespace std; @@ -11,6 +14,23 @@ { } +string ParseMemory(string mem) +{ + stringstream out; + + vector lines = Util::str_split(mem,"\n"); + vector line2 = Util::str_split( lines[1] ); + vector line3 = Util::str_split( lines[2] ); + + out << "Mem." << endl; + out << "Applications: " << line3[2] << "mb\n" ; + out << "Buffers: " << line2[5] << "mb\n" ; + out << "Cache: " << line2[6] << "mb\n"; + out << "Free: " << line2[3] << "mb\n\n"; + + return out.str(); +} + void HostStatusPlugin::Execute(ISmsTransceiver& modem, SMS& sms) { string message; @@ -22,6 +42,9 @@ Util::my_system("uptime", &out); message += out; + Util::my_system("free -m",&out); + message += ParseMemory(out); + Util::my_system("df -h | grep dev | awk '{ print $6 \" \" $5}'", &out); message += out;