]> git.proxmox.com Git - ceph.git/blame - ceph/src/mon/DataHealthService.h
update sources to v12.1.1
[ceph.git] / ceph / src / mon / DataHealthService.h
CommitLineData
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_MON_DATA_HEALTH_SERVICE_H
15#define CEPH_MON_DATA_HEALTH_SERVICE_H
16
17#include <errno.h>
18
19#include "include/types.h"
20#include "mon/mon_types.h"
21#include "mon/HealthService.h"
22#include "common/config.h"
23#include "global/signal_handler.h"
24
25struct MMonHealth;
26namespace ceph { class Formatter; }
27
28
29class DataHealthService :
30 public HealthService
31{
32 map<entity_inst_t,DataStats> stats;
33 int last_warned_percent;
34
35 void handle_tell(MonOpRequestRef op);
36 int update_store_stats(DataStats &ours);
37 int update_stats();
38 void share_stats();
39
40 void force_shutdown() {
41 generic_dout(0) << "** Shutdown via Data Health Service **" << dendl;
42 queue_async_signal(SIGINT);
43 }
44
45protected:
46 void service_tick() override;
47 bool service_dispatch_op(MonOpRequestRef op) override;
48 void service_shutdown() override { }
49
50 void start_epoch() override;
51 void finish_epoch() override { }
52 void cleanup() override { }
53
54public:
55 DataHealthService(Monitor *m) :
56 HealthService(m),
57 last_warned_percent(0)
58 {
59 set_update_period(g_conf->mon_health_data_update_interval);
60 }
61 ~DataHealthService() override { }
62
63 void init() override {
64 generic_dout(20) << "data_health " << __func__ << dendl;
65 start_tick();
66 }
67
224ce89b
WB
68 void get_health(
69 list<pair<health_status_t,string> >& summary,
70 list<pair<health_status_t,string> > *detail) override;
7c673cae
FG
71
72 int get_type() override {
73 return HealthService::SERVICE_HEALTH_DATA;
74 }
75
76 string get_name() const override {
77 return "data_health";
78 }
79};
80
81#endif /* CEPH_MON_DATA_HEALTH_SERVICE_H */