MySQL 26.10.0
Source Code Documentation
health_monitor_system_state.h
Go to the documentation of this file.
1/* Copyright (c) 2022, 2026, Oracle and/or its affiliates.
2
3This program is free software; you can redistribute it and/or modify
4it under the terms of the GNU General Public License, version 2.0,
5as published by the Free Software Foundation.
6
7This program is designed to work with certain software (including
8but not limited to OpenSSL) that is licensed under separate terms,
9as designated in a particular file or component or in included license
10documentation. The authors of MySQL hereby grant you an additional
11permission to link the program and your derivative works with the
12separately licensed software that they have either included with
13the program or referenced in the documentation.
14
15This program is distributed in the hope that it will be useful,
16but WITHOUT ANY WARRANTY; without even the implied warranty of
17MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18GNU General Public License, version 2.0, for more details.
19
20You should have received a copy of the GNU General Public License
21along with this program; if not, write to the Free Software
22Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23
24#pragma once
25
26#include <string>
27
28namespace hm {
29
30class System_Collector;
31
32namespace ss {
33
35 public:
37
38 System_State() = default;
39 System_State(const char *state_name, State state)
40 : m_name(state_name), m_state(state) {}
41
42 virtual ~System_State() = default;
43 virtual void enter() {}
44 virtual void check_levels() {}
45 virtual void exit() {}
47 enum State state() const { return m_state; }
48
50
51 private:
52 const std::string m_name;
54};
55
56/**
57 Start State
58
59 The System Collector process thread is starting.
60*/
61class Start_State : public System_State {
62 public:
64 void check_levels() override;
65};
66
67/**
68 Stop State
69
70 The System Collector process thread is stopping. Clean up any remaining tasks.
71*/
72class Stop_State : public System_State {
73 public:
75 void check_levels() override;
76};
77
78/**
79 Normal State
80
81 Typical operating run state.
82*/
83class Normal_State : public System_State {
84 public:
86 void check_levels() override;
87};
88
89/**
90 Warning State
91
92 The System Collector is running but there was an error or condition that
93 might need attention.
94*/
96 public:
98 void enter() override; // cppcheck-suppress uselessOverride
99 void check_levels() override;
100};
101
102/**
103 Error State
104
105 The System Collector is running but there is an error that prevents it from
106 collecting system stats.
107*/
108class Error_State : public System_State {
109 public:
111 void enter() override;
112 void check_levels() override;
113};
114
115} // namespace ss
116} // namespace hm
System Collector.
Definition: health_monitor_system.h:47
Error State.
Definition: health_monitor_system_state.h:108
void enter() override
Error_State()
Definition: health_monitor_system_state.h:110
void check_levels() override
Normal State.
Definition: health_monitor_system_state.h:83
Normal_State()
Definition: health_monitor_system_state.h:85
void check_levels() override
Start State.
Definition: health_monitor_system_state.h:61
void check_levels() override
Start_State()
Definition: health_monitor_system_state.h:63
Stop State.
Definition: health_monitor_system_state.h:72
Stop_State()
Definition: health_monitor_system_state.h:74
void check_levels() override
Definition: health_monitor_system_state.h:34
static System_Collector * sc
Definition: health_monitor_system_state.h:49
System_State(const char *state_name, State state)
Definition: health_monitor_system_state.h:39
virtual void exit()
Definition: health_monitor_system_state.h:45
virtual ~System_State()=default
virtual void enter()
Definition: health_monitor_system_state.h:43
virtual void check_levels()
Definition: health_monitor_system_state.h:44
enum State state() const
Definition: health_monitor_system_state.h:47
const std::string m_name
Definition: health_monitor_system_state.h:52
static void set_collector(System_Collector *collector)
Definition: health_monitor_system_state.h:46
State m_state
Definition: health_monitor_system_state.h:53
State
Definition: health_monitor_system_state.h:36
@ START
Definition: health_monitor_system_state.h:36
@ NORMAL
Definition: health_monitor_system_state.h:36
@ STOP
Definition: health_monitor_system_state.h:36
@ WARNING
Definition: health_monitor_system_state.h:36
@ ERROR
Definition: health_monitor_system_state.h:36
@ UNDEF
Definition: health_monitor_system_state.h:36
Warning State.
Definition: health_monitor_system_state.h:95
Warning_State()
Definition: health_monitor_system_state.h:97
void enter() override
void check_levels() override
Definition: mrs_component_embedded_mysql_cache.h:33
Definition: component_command.h:29