mirror of
https://gitlab.xiph.org/xiph/icecast-server.git
synced 2024-12-04 14:46:30 -05:00
Cleanup: Added reportxml_helper_add_value_health()
This commit is contained in:
parent
21b600268c
commit
d3ad28a9cc
12
src/admin.c
12
src/admin.c
@ -1748,17 +1748,7 @@ static void command_dashboard (client_t *client, source_t *source, adm
|
||||
health = health_atbest(health, command_dashboard__getrlimit(config, reportnode, config->reportxml_db));
|
||||
#endif
|
||||
|
||||
switch (health) {
|
||||
case HEALTH_OK:
|
||||
reportxml_helper_add_value_enum(resource, "status", "green");
|
||||
break;
|
||||
case HEALTH_WARNING:
|
||||
reportxml_helper_add_value_enum(resource, "status", "yellow");
|
||||
break;
|
||||
case HEALTH_ERROR:
|
||||
reportxml_helper_add_value_enum(resource, "status", "red");
|
||||
break;
|
||||
}
|
||||
reportxml_helper_add_value_health(resource, "status", health);
|
||||
|
||||
reportxml_node_add_child(incident, resource);
|
||||
refobject_unref(resource);
|
||||
|
@ -43,6 +43,21 @@ void reportxml_helper_add_value_int(reportxml_node_t *parent, const char *member
|
||||
reportxml_helper_add_value(parent, "int", member, buf);
|
||||
}
|
||||
|
||||
void reportxml_helper_add_value_health(reportxml_node_t *parent, const char *member, health_t val)
|
||||
{
|
||||
switch (val) {
|
||||
case HEALTH_OK:
|
||||
reportxml_helper_add_value_enum(parent, member, "green");
|
||||
break;
|
||||
case HEALTH_WARNING:
|
||||
reportxml_helper_add_value_enum(parent, member, "yellow");
|
||||
break;
|
||||
case HEALTH_ERROR:
|
||||
reportxml_helper_add_value_enum(parent, member, "red");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void reportxml_helper_add_text(reportxml_node_t *parent, const char *definition, const char *text)
|
||||
{
|
||||
reportxml_node_t *textnode = reportxml_node_new(REPORTXML_NODE_TYPE_TEXT, NULL, definition, NULL);
|
||||
|
@ -20,6 +20,7 @@ void reportxml_helper_add_value(reportxml_node_t *parent, const char *type, cons
|
||||
#define reportxml_helper_add_value_boolean(parent,member,value) reportxml_helper_add_value((parent), "boolean", (member), (value) ? "true" : "false")
|
||||
#define reportxml_helper_add_value_flag(parent,member,value) reportxml_helper_add_value((parent), "flag", (member), (value) ? "true" : "false")
|
||||
void reportxml_helper_add_value_int(reportxml_node_t *parent, const char *member, long long int val);
|
||||
void reportxml_helper_add_value_health(reportxml_node_t *parent, const char *member, health_t val);
|
||||
|
||||
void reportxml_helper_add_text(reportxml_node_t *parent, const char *definition, const char *text);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user