76 uint32_t show, uint32_t show_opts,
77 const char *only_node,
const char *only_rsc,
78 const char *neg_location_prefix,
bool simple_output)
85 GList *resources = NULL;
138 out->
message(out,
"cluster-status",
140 stonith_history, fence_history, show, show_opts,
141 neg_location_prefix, unames, resources);
144 g_list_free_full(unames, free);
145 g_list_free_full(resources, free);
148 stonith_history = NULL;
181 show_opts, NULL, NULL, NULL,
false, 0);
226 uint32_t show_opts,
const char *only_node,
const char *only_rsc,
227 const char *neg_location_prefix,
bool simple_output,
228 unsigned int timeout_ms)
230 xmlNode *current_cib = NULL;
234 time_t last_updated = 0;
247 last_updated = time(NULL);
249 switch (pcmkd_state) {
259 out->
message(out,
"pacemakerd-health",
260 NULL, pcmkd_state, NULL, last_updated);
265 stonith = fencing_connect();
273 out->
message(out,
"pacemakerd-health",
274 NULL, pcmkd_state, NULL, last_updated);
280 pcmkd_state, fence_history, show,
281 show_opts, only_node, only_rsc,
282 neg_location_prefix, simple_output);
284 out->
err(out,
"Error outputting status info from the fencer or CIB");
308 int nodes_online = 0;
309 int nodes_standby = 0;
311 GString *offline_nodes = NULL;
313 bool offline =
false;
314 bool has_warnings =
false;
321 for (GList *iter =
scheduler->
nodes; iter != NULL; iter = iter->next) {
331 pcmk__add_word(&offline_nodes, 1024,
"offline node:");
332 pcmk__add_word(&offline_nodes, 0, pcmk__node_name(node));
339 out->
info(out,
"CLUSTER WARN: %s%s%s",
340 no_dc ?
"No DC" :
"",
341 no_dc && offline ?
", " :
"",
342 (offline? (
const char *) offline_nodes->str :
""));
344 if (offline_nodes != NULL) {
345 g_string_free(offline_nodes, TRUE);
349 char *nodes_standby_s = NULL;
350 char *nodes_maint_s = NULL;
352 if (nodes_standby > 0) {
358 if (nodes_maint > 0) {
364 out->
info(out,
"CLUSTER OK: %d node%s online%s%s, " 365 "%d resource instance%s configured",
367 nodes_standby_s != NULL ? nodes_standby_s :
"",
368 nodes_maint_s != NULL ? nodes_maint_s :
"",
371 free(nodes_standby_s);
xmlNode * pcmk__xml_copy(xmlNode *parent, xmlNode *src)
int pcmk__status(pcmk__output_t *out, cib_t *cib, enum pcmk__fence_history fence_history, uint32_t show, uint32_t show_opts, const char *only_node, const char *only_rsc, const char *neg_location_prefix, bool simple_output, unsigned int timeout_ms)
Control output from tools.
void stonith__register_messages(pcmk__output_t *out)
cib_t * cib_new(void)
Create a new CIB connection object.
int cib__signon_query(pcmk__output_t *out, cib_t **cib, xmlNode **cib_object)
int(* message)(pcmk__output_t *out, const char *message_id,...)
pcmk__fence_history
Control how much of the fencing history is output.
crm_exit_t pcmk_rc2exitc(int rc)
Map a function return code to the most similar exit code.
int pcmk__update_configured_schema(xmlNode **xml, bool to_logs)
Update XML from its configured schema to the latest major series.
int pcmk__pacemakerd_status(pcmk__output_t *out, const char *ipc_name, unsigned int message_timeout_ms, bool show_output, enum pcmk_pacemakerd_state *state)
void pcmk__xml_output_finish(pcmk__output_t *out, crm_exit_t exit_status, xmlNodePtr *xml)
int(* info)(pcmk__output_t *out, const char *format,...) G_GNUC_PRINTF(2
GList * pe__build_rsc_list(pcmk_scheduler_t *scheduler, const char *s)
const char * pcmk_rc_str(int rc)
Get a user-friendly description of a return code.
gboolean cluster_status(pcmk_scheduler_t *scheduler)
void cib_delete(cib_t *cib)
Free all memory used by CIB connection.
stonith_t * stonith_api_new(void)
int pcmk__output_cluster_status(pcmk__output_t *out, stonith_t *stonith, cib_t *cib, xmlNode *current_cib, enum pcmk_pacemakerd_state pcmkd_state, enum pcmk__fence_history fence_history, uint32_t show, uint32_t show_opts, const char *only_node, const char *only_rsc, const char *neg_location_prefix, bool simple_output)
void pcmk__unpack_constraints(pcmk_scheduler_t *scheduler)
int pcmk__xml_output_new(pcmk__output_t **out, xmlNodePtr *xml)
char * crm_strdup_printf(char const *format,...) G_GNUC_PRINTF(1
#define pcmk_is_set(g, f)
Convenience alias for pcmk_all_flags_set(), to check single flag.
struct pe_node_shared_s * details
int(*) int(*) void(* err)(pcmk__output_t *out, const char *format,...) G_GNUC_PRINTF(2
void pcmk__register_lib_messages(pcmk__output_t *out)
int pcmk__output_simple_status(pcmk__output_t *out, const pcmk_scheduler_t *scheduler)
GList * pe__build_node_name_list(pcmk_scheduler_t *scheduler, const char *s)
void pe__register_messages(pcmk__output_t *out)
void free_xml(xmlNode *child)
int(* connect)(stonith_t *st, const char *name, int *stonith_fd)
Connect to the local fencer.
int cib__clean_up_connection(cib_t **cib)
pcmk_scheduler_t * pe_new_working_set(void)
Create a new object to hold scheduler data.
Function and executable result codes.
void pe_free_working_set(pcmk_scheduler_t *scheduler)
Free scheduler data.
void stonith_api_delete(stonith_t *st)
pcmk_scheduler_t * scheduler
char * pcmk__our_nodename
Node name of the local node.
stonith_api_operations_t * cmds
void stonith_history_free(stonith_history_t *history)
#define pcmk__mem_assert(ptr)
This structure contains everything that makes up a single output formatter.
int pcmk__get_fencing_history(stonith_t *st, stonith_history_t **stonith_history, enum pcmk__fence_history fence_history)
Fetch fencing history, optionally reducing it.
#define pcmk__plural_s(i)
int pcmk_status(xmlNodePtr *xml)
Output cluster status formatted like crm_mon --output-as=xml
#define pcmk__set_scheduler_flags(scheduler, flags_to_set)