mirror of
https://github.com/ceph/ceph
synced 2025-02-23 19:17:37 +00:00
mon/HealthMonitor: add sticky flag to mutes
Signed-off-by: Sage Weil <sage@redhat.com>
This commit is contained in:
parent
ffc98aa606
commit
2dff777ba9
@ -274,12 +274,14 @@ bool HealthMonitor::prepare_command(MonOpRequestRef op)
|
||||
|
||||
if (prefix == "health mute") {
|
||||
string code;
|
||||
bool sticky = false;
|
||||
if (!cmd_getval(g_ceph_context, cmdmap, "code", code) ||
|
||||
code == "") {
|
||||
r = -EINVAL;
|
||||
ss << "must specify an alert code to mute";
|
||||
goto out;
|
||||
}
|
||||
cmd_getval(g_ceph_context, cmdmap, "sticky", sticky);
|
||||
string ttl_str;
|
||||
utime_t ttl;
|
||||
if (cmd_getval(g_ceph_context, cmdmap, "ttl", ttl_str)) {
|
||||
@ -295,6 +297,7 @@ bool HealthMonitor::prepare_command(MonOpRequestRef op)
|
||||
auto& m = pending_mutes[code];
|
||||
m.code = code;
|
||||
m.ttl = ttl;
|
||||
m.sticky = sticky;
|
||||
} else if (prefix == "health unmute") {
|
||||
string code;
|
||||
if (cmd_getval(g_ceph_context, cmdmap, "code", code)) {
|
||||
|
@ -211,9 +211,13 @@ COMMAND_WITH_FLAG("injectargs " \
|
||||
COMMAND("status", "show cluster status", "mon", "r")
|
||||
COMMAND("health name=detail,type=CephChoices,strings=detail,req=false", \
|
||||
"show cluster health", "mon", "r")
|
||||
COMMAND("health mute name=code,type=CephString name=ttl,type=CephString,req=false",
|
||||
COMMAND("health mute "\
|
||||
"name=code,type=CephString " \
|
||||
"name=ttl,type=CephString,req=false " \
|
||||
"name=sticky,type=CephBool,req=false",
|
||||
"mute health alert", "mon", "w")
|
||||
COMMAND("health unmute name=code,type=CephString,req=false",
|
||||
COMMAND("health unmute "\
|
||||
"name=code,type=CephString,req=false",
|
||||
"unmute existing health alert mute(s)", "mon", "w")
|
||||
COMMAND("time-sync-status", "show time sync status", "mon", "r")
|
||||
COMMAND("df name=detail,type=CephChoices,strings=detail,req=false", \
|
||||
|
@ -2881,6 +2881,9 @@ health_status_t Monitor::get_health_status(
|
||||
*plain += "0s";
|
||||
}
|
||||
}
|
||||
if (q->second.sticky) {
|
||||
*plain += ", STICKY";
|
||||
}
|
||||
*plain += ") ";
|
||||
}
|
||||
*plain += "["s + short_health_string(p.second.severity) + "] " +
|
||||
|
@ -64,11 +64,13 @@ WRITE_CLASS_DENC(health_check_t)
|
||||
struct health_mute_t {
|
||||
std::string code;
|
||||
utime_t ttl;
|
||||
bool sticky = false;
|
||||
|
||||
DENC(health_mute_t, v, p) {
|
||||
DENC_START(1, 1, p);
|
||||
denc(v.code, p);
|
||||
denc(v.ttl, p);
|
||||
denc(v.sticky, p);
|
||||
DENC_FINISH(p);
|
||||
}
|
||||
|
||||
@ -77,6 +79,7 @@ struct health_mute_t {
|
||||
if (ttl != utime_t()) {
|
||||
f->dump_stream("ttl") << ttl;
|
||||
}
|
||||
f->dump_bool("sticky", sticky);
|
||||
}
|
||||
|
||||
static void generate_test_instances(std::list<health_mute_t*>& ls) {
|
||||
@ -84,6 +87,7 @@ struct health_mute_t {
|
||||
ls.push_back(new health_mute_t);
|
||||
ls.back()->code = "OSD_DOWN";
|
||||
ls.back()->ttl = utime_t(1, 2);
|
||||
ls.back()->sticky = true;
|
||||
}
|
||||
};
|
||||
WRITE_CLASS_DENC(health_mute_t)
|
||||
|
Loading…
Reference in New Issue
Block a user