diff options
author | antirez <antirez@gmail.com> | 2015-07-29 12:27:25 +0200 |
---|---|---|
committer | antirez <antirez@gmail.com> | 2015-07-29 12:29:12 +0200 |
commit | 6233d210cd624ba3645426f1a6b52f5de0388dc1 (patch) | |
tree | 76a519b08326bdee1da05166761875815a8fecca | |
parent | 4bc42ca7f6608c3e77c451c580c4b9c629480169 (diff) | |
download | redis-6233d210cd624ba3645426f1a6b52f5de0388dc1.tar.gz |
Sentinel: add more commonly useful sections to INFO.
Debugging is hard without those when there are problems like the one
investigated in issue #2700.
-rw-r--r-- | src/sentinel.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/sentinel.c b/src/sentinel.c index 06622d022..05b4f0398 100644 --- a/src/sentinel.c +++ b/src/sentinel.c @@ -3165,6 +3165,16 @@ numargserr: (char*)c->argv[1]->ptr); } +#define info_section_from_redis(section_name) do { \ + if (defsections || allsections || !strcasecmp(section,section_name)) { \ + sds redissection; \ + if (sections++) info = sdscat(info,"\r\n"); \ + redissection = genRedisInfoString(section_name); \ + info = sdscatlen(info,redissection,sdslen(redissection)); \ + sdsfree(redissection); \ + } \ +} while(0) + /* SENTINEL INFO [section] */ void sentinelInfoCommand(client *c) { if (c->argc > 2) { @@ -3183,12 +3193,11 @@ void sentinelInfoCommand(client *c) { int sections = 0; sds info = sdsempty(); - if (defsections || allsections || !strcasecmp(section,"server")) { - if (sections++) info = sdscat(info,"\r\n"); - sds serversection = genRedisInfoString("server"); - info = sdscatlen(info,serversection,sdslen(serversection)); - sdsfree(serversection); - } + + info_section_from_redis("server"); + info_section_from_redis("clients"); + info_section_from_redis("cpu"); + info_section_from_redis("stats"); if (defsections || allsections || !strcasecmp(section,"sentinel")) { dictIterator *di; |