--- smsdaemon/plugins/HostStatusPlugin.cpp 2008/12/07 15:51:02 142 +++ smsdaemon/plugins/HostStatusPlugin.cpp 2008/12/15 09:10:05 185 @@ -1,8 +1,11 @@ #include "HostStatusPlugin.h" -#include "IGsmModem.h" +#include "ISmsTransceiver.h" #include "Sms.h" -#include "util.h" +#include "Util.h" +#include +#include +#include using namespace std; @@ -11,7 +14,24 @@ { } -void HostStatusPlugin::Execute(IGsmModem& modem, SMS& sms) +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; string out; @@ -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;