mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-08-29 21:18:02 +00:00
sample code responding to statistics requests
git-svn-id: svn://bind10.isc.org/svn/bind10/branches/f2f200910@270 e5f2f494-b856-4b98-b285-d166d9295462
This commit is contained in:
parent
8f9a4c381f
commit
0c998ea23f
@ -58,3 +58,21 @@ CommandSession::getCommand() {
|
||||
|
||||
return std::pair<string, string>("unknown", "");
|
||||
}
|
||||
|
||||
void
|
||||
handleStatRequest()
|
||||
{
|
||||
ISC::Data::ElementPtr ep, routing, data;
|
||||
|
||||
session.group_recvmsg(routing, data, false);
|
||||
ep = data->get("command");
|
||||
if (ep != NULL && ep->string_value() == "getstat") {
|
||||
struct timeval now;
|
||||
ElementPtr resp = Element::create(std::map<std::string, ElementPtr>());
|
||||
gettimeofday(&now, NULL);
|
||||
resp->set("sent", Element::create(now.tv_sec +
|
||||
(double)now.tv_usec / 1000000));
|
||||
resp->set("counter", Element::create(++counter));
|
||||
session.group_sendmsg(resp, "statistics");
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user