summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthias Schiffer <matthias@gamezock.de>2009-06-18 18:16:40 +0200
committerMatthias Schiffer <matthias@gamezock.de>2009-06-18 18:16:40 +0200
commitbf561f8226e97f4ace4f04bddf198175e91ee7f0 (patch)
tree338ed9884982a39d4a9ef8cc8d896eb7cf28367d /src
parent0b0d883a00751c946fab4c897bab01859c598a88 (diff)
downloadmad-bf561f8226e97f4ace4f04bddf198175e91ee7f0.tar
mad-bf561f8226e97f4ace4f04bddf198175e91ee7f0.zip
StatusRequestHandler: Nur verf?gbare Daten ?bermitteln
Diffstat (limited to 'src')
-rw-r--r--src/Common/RequestHandlers/StatusRequestHandler.cpp47
1 files changed, 29 insertions, 18 deletions
diff --git a/src/Common/RequestHandlers/StatusRequestHandler.cpp b/src/Common/RequestHandlers/StatusRequestHandler.cpp
index 95bdd30..7abcd7f 100644
--- a/src/Common/RequestHandlers/StatusRequestHandler.cpp
+++ b/src/Common/RequestHandlers/StatusRequestHandler.cpp
@@ -27,32 +27,43 @@ namespace RequestHandlers {
void StatusRequestHandler::handleRequest(boost::shared_ptr<const Common::XmlPacket> packet _UNUSED_PARAMETER_, Common::XmlPacket *ret) {
// TODO Require authentication
- unsigned long uptime, idleTime;
- unsigned long totalMem, freeMem, totalSwap, freeSwap;
- unsigned long currentLoad, nProcesses;
- float loadAvg1, loadAvg5, loadAvg15;
-
+ ret->setType("OK");
try {
+ unsigned long uptime, idleTime;
+
SystemManager::get()->getUptimeInfo(&uptime, &idleTime);
+
+ ret->add("uptime", uptime);
+ ret->add("idleTime", idleTime);
+ }
+ catch(Core::Exception e) {}
+
+ try {
+ unsigned long totalMem, freeMem, totalSwap, freeSwap;
+
SystemManager::get()->getMemoryInfo(&totalMem, &freeMem, &totalSwap, &freeSwap);
- SystemManager::get()->getLoadInfo(&currentLoad, &nProcesses, &loadAvg1, &loadAvg5, &loadAvg15);
+
+ ret->add("totalMem", totalMem);
+ ret->add("freeMem", freeMem);
+ ret->add("totalSwap", totalSwap);
+ ret->add("freeSwap", freeSwap);
}
catch(Core::Exception e) {}
- ret->setType("OK");
+ try {
+ unsigned long currentLoad, nProcesses;
+ float loadAvg1, loadAvg5, loadAvg15;
- ret->add("uptime", uptime);
- ret->add("idleTime", idleTime);
- ret->add("totalMem", totalMem);
- ret->add("freeMem", freeMem);
- ret->add("totalSwap", totalSwap);
- ret->add("freeSwap", freeSwap);
- ret->add("currentLoad", currentLoad);
- ret->add("nProcesses", nProcesses);
- ret->add("loadAvg1", loadAvg1);
- ret->add("loadAvg5", loadAvg5);
- ret->add("loadAvg15", loadAvg15);
+ SystemManager::get()->getLoadInfo(&currentLoad, &nProcesses, &loadAvg1, &loadAvg5, &loadAvg15);
+
+ ret->add("currentLoad", currentLoad);
+ ret->add("nProcesses", nProcesses);
+ ret->add("loadAvg1", loadAvg1);
+ ret->add("loadAvg5", loadAvg5);
+ ret->add("loadAvg15", loadAvg15);
+ }
+ catch(Core::Exception e) {}
}
}