1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 * Ceph - scalable distributed file system
6 * Copyright (C) 2013 Inktank, Inc
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.
14 #ifndef CEPH_HEALTH_MONITOR_H
15 #define CEPH_HEALTH_MONITOR_H
17 #include "mon/PaxosService.h"
19 class HealthMonitor
: public PaxosService
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
;
26 std::map
<std::string
,health_mute_t
> pending_mutes
;
29 HealthMonitor(Monitor
&m
, Paxos
&p
, const std::string
& service_name
);
32 * @defgroup HealthMonitor_Inherited_h Inherited abstract methods
37 bool preprocess_query(MonOpRequestRef op
) override
;
38 bool prepare_update(MonOpRequestRef op
) override
;
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
;
46 void encode_full(MonitorDBStore::TransactionRef t
) override
{ }
50 void gather_all_health_checks(health_check_map_t
*all
);
51 health_status_t
get_health_status(
55 const char *sep1
= " ",
56 const char *sep2
= "; ");
59 * @} // HealthMonitor_Inherited_h
62 bool preprocess_command(MonOpRequestRef op
);
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();
75 #endif // CEPH_HEALTH_MONITOR_H