本文整理汇总了C++中Director::backendRole方法的典型用法代码示例。如果您正苦于以下问题:C++ Director::backendRole方法的具体用法?C++ Director::backendRole怎么用?C++ Director::backendRole使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Director
的用法示例。
在下文中一共展示了Director::backendRole方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: csv
void HaproxyApi::csv(HttpRequest* r)
{
Buffer buf;
buf.push_back("# pxname,svname,qcur,qmax,scur,smax,slim,stot,bin,bout,dreq,dresp,ereq,econ,eresp,wretr,wredis,status,weight,act,bck,chkfail,chkdown,lastchg,downtime,qlimit,pid,iid,sid,throttle,lbtot,tracked,type,rate,rate_lim,rate_max,check_status,check_code,check_duration,hrsp_1xx,hrsp_2xx,hrsp_3xx,hrsp_4xx,hrsp_5xx,hrsp_other,hanafail,req_rate,req_rate_max,req_tot,cli_abrt,srv_abrt,\n");
for (auto di: *directors_) {
Director* director = di.second;
buildFrontendCSV(buf, director);
director->eachBackend([&](Backend* backend) {
// 01 pxname: proxy name
buf.push_back(director->name());
buf.push_back(',');
// 02 svname: service name (FRONTEND for frontend, BACKEND for backend, any name for server)
buf.push_back(backend->name()); // svname
// 03 qcur: current queued requests
// 04 qmax: max queued requests
buf.push_back(",0,0,"); // qcur, qmax
// 05 scur: current sessions
buf.push_back(backend->load().current());
buf.push_back(',');
// 06 smax: max sessions
buf.push_back(backend->load().max());
buf.push_back(",");
// 07 slim: sessions limit
buf.push_back(",");
// 08 stot: total sessions
buf.push_back(backend->load().total());
// 09 bin: bytes in
// 10 bout: bytes out
buf.push_back(",0,0,"); // bin, bout
// 11 dreq: denied requests
// 12 dresp: denied responses
buf.push_back("0,0,"); // dreq, dresp
// 13 ereq: request errors
// 14 econ: connection errors
// 15 eresp: response errors (among which srv_abrt)
buf.push_back("0,0,0,"); // ereq, econ, resp
// 16 wretr: retries (warning)
// 17 wredis: redispatches (warning)
buf.push_back("0,0,"); // wretr, wredis
// 18 status
if (!backend->isEnabled()) { // status
buf.push_back("MAINT");
} else if (backend->healthMonitor()) {
switch (backend->healthMonitor()->state()) {
case HealthState::Online:
buf.push_back("UP");
break;
case HealthState::Offline:
buf.push_back("DOWN");
break;
case HealthState::Undefined:
buf.push_back("UNKNOWN");
break;
}
} else {
buf.push_back("UP");
}
// weight: server weight (server), total weight (backend)
buf.push_back(",0,"); // weight
// 20 act: server is active (server), number of active servers (backend)
// 21 bck: server is backup (server), number of backup servers (backend)
switch (director->backendRole(backend)) { // act, bck
case BackendRole::Active:
buf.push_back("1,0,");
break;
case BackendRole::Backup:
buf.push_back("0,1,");
break;
case BackendRole::Terminate:
buf.push_back("0,0,");
break;
}
// 22 chkfail: number of failed checks
buf.push_back(','); // TODO
// 23 chkdown: number of UP->DOWN transitions
buf.push_back(','); // TODO
// 24 lastchg: last status change (in seconds)
buf.push_back(','); // TODO
// 25 downtime: total downtime (in seconds)
buf.push_back(','); // TODO
//.........这里部分代码省略.........