1
2
3
4
5
6
7
8
9
10 #include <glib.h>
11
12 #include <crm/common/output_internal.h>
13 #include <crm/common/curses_internal.h>
14 #include <crm/pengine/pe_types.h>
15 #include <crm/stonith-ng.h>
16
17 typedef enum mon_output_format_e {
18 mon_output_unset,
19 mon_output_none,
20 mon_output_monitor,
21 mon_output_plain,
22 mon_output_console,
23 mon_output_xml,
24 mon_output_legacy_xml,
25 mon_output_html,
26 mon_output_cgi
27 } mon_output_format_t;
28
29 #define mon_show_stack (1 << 0)
30 #define mon_show_dc (1 << 1)
31 #define mon_show_times (1 << 2)
32 #define mon_show_counts (1 << 3)
33 #define mon_show_options (1 << 4)
34 #define mon_show_nodes (1 << 5)
35 #define mon_show_resources (1 << 6)
36 #define mon_show_attributes (1 << 7)
37 #define mon_show_failcounts (1 << 8)
38 #define mon_show_operations (1 << 9)
39 #define mon_show_fence_failed (1 << 10)
40 #define mon_show_fence_pending (1 << 11)
41 #define mon_show_fence_worked (1 << 12)
42 #define mon_show_tickets (1 << 13)
43 #define mon_show_bans (1 << 14)
44 #define mon_show_failures (1 << 15)
45
46 #define mon_show_fencing_all (mon_show_fence_failed | mon_show_fence_pending | mon_show_fence_worked)
47 #define mon_show_summary (mon_show_stack | mon_show_dc | mon_show_times | mon_show_counts)
48 #define mon_show_all (mon_show_summary | mon_show_nodes | mon_show_resources | \
49 mon_show_attributes | mon_show_failcounts | mon_show_operations | \
50 mon_show_fencing_all | mon_show_tickets | mon_show_bans | \
51 mon_show_failures | mon_show_options)
52
53 #define mon_op_group_by_node (0x0001U)
54 #define mon_op_inactive_resources (0x0002U)
55 #define mon_op_one_shot (0x0004U)
56 #define mon_op_has_warnings (0x0008U)
57 #define mon_op_print_timing (0x0010U)
58 #define mon_op_watch_fencing (0x0020U)
59 #define mon_op_fence_history (0x0040U)
60 #define mon_op_fence_full_history (0x0080U)
61 #define mon_op_fence_connect (0x0100U)
62 #define mon_op_print_brief (0x0200U)
63 #define mon_op_print_pending (0x0400U)
64 #define mon_op_print_clone_detail (0x0800U)
65 #define mon_op_cib_native (0x1000U)
66
67 #define mon_op_default (mon_op_print_pending | mon_op_fence_history | mon_op_fence_connect)
68
69 void print_status(pe_working_set_t *data_set, crm_exit_t history_rc,
70 stonith_history_t *stonith_history, unsigned int mon_ops,
71 unsigned int print_opts,
72 unsigned int show, const char *prefix, GList *unames, GList *resources);
73 void print_xml_status(pe_working_set_t *data_set, crm_exit_t history_rc,
74 stonith_history_t *stonith_history, unsigned int mon_ops,
75 unsigned int print_opts,
76 unsigned int show, const char *prefix, GList *unames,
77 GList *resources);
78 int print_html_status(pe_working_set_t *data_set, crm_exit_t history_rc,
79 stonith_history_t *stonith_history, unsigned int mon_ops,
80 unsigned int print_opts,
81 unsigned int show, const char *prefix, GList *unames,
82 GList *resources);
83
84 void crm_mon_register_messages(pcmk__output_t *out);
85
86 pcmk__output_t *crm_mon_mk_curses_output(char **argv);
87 void curses_formatted_printf(pcmk__output_t *out, const char *format, ...) G_GNUC_PRINTF(2, 3);
88 void curses_formatted_vprintf(pcmk__output_t *out, const char *format, va_list args) G_GNUC_PRINTF(2, 0);
89 void curses_indented_printf(pcmk__output_t *out, const char *format, ...) G_GNUC_PRINTF(2, 3);
90 void curses_indented_vprintf(pcmk__output_t *out, const char *format, va_list args) G_GNUC_PRINTF(2, 0);
91
92 #if CURSES_ENABLED
93 extern GOptionEntry crm_mon_curses_output_entries[];
94 #define CRM_MON_SUPPORTED_FORMAT_CURSES { "console", crm_mon_mk_curses_output, crm_mon_curses_output_entries }
95 #endif
96
97 pcmk__output_t *crm_mon_mk_xml_output(char **argv);
98 #define CRM_MON_SUPPORTED_FORMAT_XML { "xml", crm_mon_mk_xml_output, pcmk__xml_output_entries }