]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
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 | ||
224ce89b | 17 | #include "mon/PaxosService.h" |
7c673cae | 18 | |
224ce89b | 19 | class HealthMonitor : public PaxosService |
7c673cae | 20 | { |
224ce89b | 21 | version_t version = 0; |
f67539c2 | 22 | std::map<int,health_check_map_t> quorum_checks; // for each quorum member |
224ce89b | 23 | health_check_map_t leader_checks; // leader only |
f67539c2 | 24 | std::map<std::string,health_mute_t> mutes; |
9f95a23c | 25 | |
f67539c2 | 26 | std::map<std::string,health_mute_t> pending_mutes; |
7c673cae FG |
27 | |
28 | public: | |
f67539c2 | 29 | HealthMonitor(Monitor &m, Paxos &p, const std::string& service_name); |
7c673cae | 30 | |
7c673cae FG |
31 | /** |
32 | * @defgroup HealthMonitor_Inherited_h Inherited abstract methods | |
33 | * @{ | |
34 | */ | |
35 | void init() override; | |
7c673cae | 36 | |
224ce89b WB |
37 | bool preprocess_query(MonOpRequestRef op) override; |
38 | bool prepare_update(MonOpRequestRef op) override; | |
7c673cae | 39 | |
224ce89b WB |
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; | |
11fdf7f2 | 44 | version_t get_trim_to() const override; |
224ce89b WB |
45 | |
46 | void encode_full(MonitorDBStore::TransactionRef t) override { } | |
47 | ||
48 | void tick() override; | |
7c673cae | 49 | |
9f95a23c TL |
50 | void gather_all_health_checks(health_check_map_t *all); |
51 | health_status_t get_health_status( | |
52 | bool want_detail, | |
f67539c2 | 53 | ceph::Formatter *f, |
9f95a23c TL |
54 | std::string *plain, |
55 | const char *sep1 = " ", | |
56 | const char *sep2 = "; "); | |
57 | ||
7c673cae FG |
58 | /** |
59 | * @} // HealthMonitor_Inherited_h | |
60 | */ | |
f67539c2 TL |
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(); | |
7c673cae FG |
73 | }; |
74 | ||
75 | #endif // CEPH_HEALTH_MONITOR_H |