diff --git a/core/emperor.c b/core/emperor.c index 9c532a7b..aa8ed0f3 100644 --- a/core/emperor.c +++ b/core/emperor.c @@ -1093,8 +1093,10 @@ static void vassal_fork_server_parser_hook(char *key, uint16_t key_len, char *va */ static pid_t emperor_connect_to_fork_server(char *socket, struct uwsgi_instance *n_ui) { int fd = uwsgi_connect(socket, uwsgi.socket_timeout, 0); - if (fd < 0) + if (fd < 0) { + uwsgi_error("emperor_connect_to_fork_server()/uwsgi_connect()"); return -1; + } int slot_to_free = -1; char **vassal_argv = vassal_new_argv(n_ui, &slot_to_free); diff --git a/core/uwsgi.c b/core/uwsgi.c index a70c1c18..001ca1e9 100644 --- a/core/uwsgi.c +++ b/core/uwsgi.c @@ -230,10 +230,10 @@ static struct uwsgi_option uwsgi_base_options[] = { {"vassals-cap", required_argument, 0, "set vassals capability", uwsgi_opt_set_emperor_cap, NULL, 0}, {"vassal-cap", required_argument, 0, "set vassals capability", uwsgi_opt_set_emperor_cap, NULL, 0}, #endif - {"emperor-collect-attribute", no_argument, 0, "collect the specified vassal attribute from imperial monitors", uwsgi_opt_add_string_list, &uwsgi.emperor_collect_attributes, 0}, - {"emperor-collect-attr", no_argument, 0, "collect the specified vassal attribute from imperial monitors", uwsgi_opt_add_string_list, &uwsgi.emperor_collect_attributes, 0}, - {"emperor-fork-server-attr", no_argument, 0, "set teh vassal's attribute to get when checking for fork-server", uwsgi_opt_set_str, &uwsgi.emperor_fork_server_attr, 0}, - {"emperor-wrapper-attr", no_argument, 0, "set teh vassal's attribute to get when checking for fork-wrapper", uwsgi_opt_set_str, &uwsgi.emperor_wrapper_attr, 0}, + {"emperor-collect-attribute", required_argument, 0, "collect the specified vassal attribute from imperial monitors", uwsgi_opt_add_string_list, &uwsgi.emperor_collect_attributes, 0}, + {"emperor-collect-attr", required_argument, 0, "collect the specified vassal attribute from imperial monitors", uwsgi_opt_add_string_list, &uwsgi.emperor_collect_attributes, 0}, + {"emperor-fork-server-attr", required_argument, 0, "set teh vassal's attribute to get when checking for fork-server", uwsgi_opt_set_str, &uwsgi.emperor_fork_server_attr, 0}, + {"emperor-wrapper-attr", required_argument, 0, "set teh vassal's attribute to get when checking for fork-wrapper", uwsgi_opt_set_str, &uwsgi.emperor_wrapper_attr, 0}, {"imperial-monitor-list", no_argument, 0, "list enabled imperial monitors", uwsgi_opt_true, &uwsgi.imperial_monitor_list, 0}, {"imperial-monitors-list", no_argument, 0, "list enabled imperial monitors", uwsgi_opt_true, &uwsgi.imperial_monitor_list, 0}, {"vassals-inherit", required_argument, 0, "add config templates to vassals config (uses --inherit)", uwsgi_opt_add_string_list, &uwsgi.vassals_templates, 0}, diff --git a/plugins/emperor_mongodb/emperor_mongodb.cc b/plugins/emperor_mongodb/emperor_mongodb.cc index 865a8cf2..bb41fc36 100644 --- a/plugins/emperor_mongodb/emperor_mongodb.cc +++ b/plugins/emperor_mongodb/emperor_mongodb.cc @@ -24,7 +24,14 @@ extern "C" void uwsgi_imperial_monitor_mongodb(struct uwsgi_emperor_scanner *ues try { // requested fields - mongo::BSONObj p = BSON( "name" << 1 << "config" << 1 << "ts" << 1 << "uid" << 1 << "gid" << 1 << "socket" << 1 ); + mongo::BSONObjBuilder builder; + builder.appendElements(BSON("name" << 1 << "config" << 1 << "ts" << 1 << "uid" << 1 << "gid" << 1 << "socket" << 1 )); + struct uwsgi_string_list *e_attrs = uwsgi.emperor_collect_attributes; + while(e_attrs) { + builder.appendElements(BSON(e_attrs->value << 1)); + e_attrs = e_attrs->next; + } + mongo::BSONObj p = builder.obj(); mongo::BSONObj q = mongo::fromjson(uems->json); // the connection object (will be automatically destroyed at each cycle) mongo::DBClientConnection c; @@ -86,7 +93,7 @@ extern "C" void uwsgi_imperial_monitor_mongodb(struct uwsgi_emperor_scanner *ues char *value = uwsgi_str((char *)attr_value); uwsgi_dyn_dict_new(&attrs, e_attrs->value, e_attrs->len, value, strlen(value)); } - e_attrs = NULL; + e_attrs = e_attrs->next; } if (attrs) {