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
18 #define FILTER_STR { PCMK__FAIL_COUNT_PREFIX, PCMK__LAST_FAILURE_PREFIX, \
19 "shutdown", "terminate", "standby", "probe_complete", \
20 "#", NULL }
21
22 #if CURSES_ENABLED
23 # define print_dot(output_format) if (output_format == mon_output_console) { \
24 printw("."); \
25 clrtoeol(); \
26 refresh(); \
27 } else { \
28 fprintf(stdout, "."); \
29 }
30 #else
31 # define print_dot(output_format) fprintf(stdout, ".");
32 #endif
33
34 #if CURSES_ENABLED
35 # define print_as(output_format, fmt, args...) if (output_format == mon_output_console) { \
36 printw(fmt, ##args); \
37 clrtoeol(); \
38 refresh(); \
39 } else { \
40 fprintf(stdout, fmt, ##args); \
41 }
42 #else
43 # define print_as(output_format, fmt, args...) fprintf(stdout, fmt, ##args);
44 #endif
45
46 typedef enum mon_output_format_e {
47 mon_output_unset,
48 mon_output_none,
49 mon_output_monitor,
50 mon_output_plain,
51 mon_output_console,
52 mon_output_xml,
53 mon_output_legacy_xml,
54 mon_output_html,
55 mon_output_cgi
56 } mon_output_format_t;
57
58 #define mon_show_stack (1 << 0)
59 #define mon_show_dc (1 << 1)
60 #define mon_show_times (1 << 2)
61 #define mon_show_counts (1 << 3)
62 #define mon_show_options (1 << 4)
63 #define mon_show_nodes (1 << 5)
64 #define mon_show_resources (1 << 6)
65 #define mon_show_attributes (1 << 7)
66 #define mon_show_failcounts (1 << 8)
67 #define mon_show_operations (1 << 9)
68 #define mon_show_fence_failed (1 << 10)
69 #define mon_show_fence_pending (1 << 11)
70 #define mon_show_fence_worked (1 << 12)
71 #define mon_show_tickets (1 << 13)
72 #define mon_show_bans (1 << 14)
73 #define mon_show_failures (1 << 15)
74
75 #define mon_show_fencing_all (mon_show_fence_failed | mon_show_fence_pending | mon_show_fence_worked)
76 #define mon_show_summary (mon_show_stack | mon_show_dc | mon_show_times | mon_show_counts)
77 #define mon_show_all (mon_show_summary | mon_show_nodes | mon_show_resources | \
78 mon_show_attributes | mon_show_failcounts | mon_show_operations | \
79 mon_show_fencing_all | mon_show_tickets | mon_show_bans | \
80 mon_show_failures | mon_show_options)
81
82 #define mon_op_group_by_node (0x0001U)
83 #define mon_op_inactive_resources (0x0002U)
84 #define mon_op_one_shot (0x0004U)
85 #define mon_op_has_warnings (0x0008U)
86 #define mon_op_print_timing (0x0010U)
87 #define mon_op_watch_fencing (0x0020U)
88 #define mon_op_fence_history (0x0040U)
89 #define mon_op_fence_full_history (0x0080U)
90 #define mon_op_fence_connect (0x0100U)
91 #define mon_op_print_brief (0x0200U)
92 #define mon_op_print_pending (0x0400U)
93 #define mon_op_print_clone_detail (0x0800U)
94
95 #define mon_op_default (mon_op_print_pending | mon_op_fence_history | mon_op_fence_connect)
96
97 void print_status(pcmk__output_t *out, pe_working_set_t *data_set,
98 stonith_history_t *stonith_history, unsigned int mon_ops,
99 unsigned int show, char *prefix, char *only_node,
100 char *only_rsc);
101 void print_xml_status(pcmk__output_t *out, pe_working_set_t *data_set,
102 crm_exit_t history_rc, stonith_history_t *stonith_history,
103 unsigned int mon_ops, unsigned int show, char *prefix,
104 char *only_node, char *only_rsc);
105 int print_html_status(pcmk__output_t *out, pe_working_set_t *data_set,
106 stonith_history_t *stonith_history, unsigned int mon_ops,
107 unsigned int show, char *prefix, char *only_node,
108 char *only_rsc);
109
110 GList *append_attr_list(GList *attr_list, char *name);
111 void blank_screen(void);
112 void crm_mon_get_parameters(pe_resource_t *rsc, pe_working_set_t *data_set);
113 unsigned int get_resource_display_options(unsigned int mon_ops);
114
115 void crm_mon_register_messages(pcmk__output_t *out);
116
117 pcmk__output_t *crm_mon_mk_curses_output(char **argv);
118 void curses_indented_printf(pcmk__output_t *out, const char *format, ...) G_GNUC_PRINTF(2, 3);
119 void curses_indented_vprintf(pcmk__output_t *out, const char *format, va_list args) G_GNUC_PRINTF(2, 0);
120
121 #if CURSES_ENABLED
122 extern GOptionEntry crm_mon_curses_output_entries[];
123 #define CRM_MON_SUPPORTED_FORMAT_CURSES { "console", crm_mon_mk_curses_output, crm_mon_curses_output_entries }
124 #endif
125
126 pcmk__output_t *crm_mon_mk_xml_output(char **argv);
127 #define CRM_MON_SUPPORTED_FORMAT_XML { "xml", crm_mon_mk_xml_output, pcmk__xml_output_entries }