[Linux-HA] Output of crm_mon in different format
Andrew Beekhof
beekhof at gmail.com
Fri Aug 10 07:19:08 MDT 2007
On 8/10/07, matilda matilda <matilda at grandel.de> wrote:
> >>> "Andrew Beekhof" <beekhof at gmail.com> 10.08.2007 14:55 >>>
> >>> What do you think besides having no time, Andrew?
> >
> > I'm happy to include other output modes in crm_mon.. just send me a patch :-)
>
>
> Ok, ok, ok. Let's make a deal:
> * You include the code fragment needed to query different resource attributes
> and explain it to me (the last will be the hardest part, be warned ;-))
from crm/admin/crm_resource.c (should be mostly self explanatory)
static int
dump_resource_attr(
const char *rsc, const char *attr, pe_working_set_t *data_set)
{
node_t *current = NULL;
resource_t *the_rsc = pe_find_resource(data_set->resources, rsc);
const char *value = NULL;
if(the_rsc == NULL) {
return cib_NOTEXISTS;
}
if(g_list_length(the_rsc->running_on) == 1) {
current = the_rsc->running_on->data;
} else if(g_list_length(the_rsc->running_on) > 1) {
fprintf(stderr, "%s is active on more than one node,"
" returning the default value for %s\n",
the_rsc->id, crm_str(value));
}
unpack_instance_attributes(
the_rsc->xml, attr_set_type, current?current->details->attrs:NULL,
the_rsc->parameters, NULL, data_set->now);
if(the_rsc->parameters != NULL) {
crm_debug("Looking up %s in %s", attr, the_rsc->id);
value = g_hash_table_lookup(the_rsc->parameters, attr);
}
if(value != NULL) {
fprintf(stdout, "%s\n", value);
return 0;
}
return cib_NOTEXISTS;
}
>
> * I'll make a patch for crm_mon to include a parseable output (xml , ahhh
> or json to be so cute and cool)
>
>
> ____
> .'` __/_______
> ---' -'` ______)
> _______)
> _______)
> -----..___________)
>
> Hand on that!
>
> Andreas
>
>
>
>
> _______________________________________________
> Linux-HA mailing list
> Linux-HA at lists.linux-ha.org
> http://lists.linux-ha.org/mailman/listinfo/linux-ha
> See also: http://linux-ha.org/ReportingProblems
>
More information about the Linux-HA
mailing list