]> git.proxmox.com Git - ceph.git/blob - ceph/src/mon/HealthMonitor.h
import ceph quincy 17.2.6
[ceph.git] / ceph / src / mon / HealthMonitor.h
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
3 /*
4 * Ceph - scalable distributed file system
5 *
6 * Copyright (C) 2013 Inktank, Inc
7 *
8 * This is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License version 2.1, as published by the Free Software
11 * Foundation. See file COPYING.
12 *
13 */
14 #ifndef CEPH_HEALTH_MONITOR_H
15 #define CEPH_HEALTH_MONITOR_H
16
17 #include "mon/PaxosService.h"
18
19 class HealthMonitor : public PaxosService
20 {
21 version_t version = 0;
22 std::map<int,health_check_map_t> quorum_checks; // for each quorum member
23 health_check_map_t leader_checks; // leader only
24 std::map<std::string,health_mute_t> mutes;
25
26 std::map<std::string,health_mute_t> pending_mutes;
27
28 public:
29 HealthMonitor(Monitor &m, Paxos &p, const std::string& service_name);
30
31 /**
32 * @defgroup HealthMonitor_Inherited_h Inherited abstract methods
33 * @{
34 */
35 void init() override;
36
37 bool preprocess_query(MonOpRequestRef op) override;
38 bool prepare_update(MonOpRequestRef op) override;
39
40 void create_initial() override;
41 void update_from_paxos(bool *need_bootstrap) override;
42 void create_pending() override;
43 void encode_pending(MonitorDBStore::TransactionRef t) override;
44 version_t get_trim_to() const override;
45
46 void encode_full(MonitorDBStore::TransactionRef t) override { }
47
48 void tick() override;
49
50 void gather_all_health_checks(health_check_map_t *all);
51 health_status_t get_health_status(
52 bool want_detail,
53 ceph::Formatter *f,
54 std::string *plain,
55 const char *sep1 = " ",
56 const char *sep2 = "; ");
57
58 /**
59 * @} // HealthMonitor_Inherited_h
60 */
61 private:
62 bool preprocess_command(MonOpRequestRef op);
63
64 bool prepare_command(MonOpRequestRef op);
65 bool prepare_health_checks(MonOpRequestRef op);
66 void check_for_older_version(health_check_map_t *checks);
67 void check_for_mon_down(health_check_map_t *checks);
68 void check_for_clock_skew(health_check_map_t *checks);
69 void check_if_msgr2_enabled(health_check_map_t *checks);
70 bool check_leader_health();
71 bool check_member_health();
72 bool check_mutes();
73 };
74
75 #endif // CEPH_HEALTH_MONITOR_H