void LUAScript::query_fallback(const Plugin::QueryRequestMessage::Request &request, Plugin::QueryResponseMessage::Response *response, const Plugin::QueryRequestMessage &request_message) { std::string response_buffer; boost::optional<scripts::command_definition<lua::lua_traits> > cmd = scripts_->find_command(scripts::nscp::tags::query_tag, request.command()); if (!cmd) { cmd = scripts_->find_command(scripts::nscp::tags::simple_query_tag, request.command()); if (!cmd) return nscapi::protobuf::functions::set_response_bad(*response, "Failed to find command: " + request.command()); return lua_runtime_->on_query(request.command(), cmd->information, cmd->function, true, request, response, request_message); } return lua_runtime_->on_query(request.command(), cmd->information, cmd->function, false, request, response, request_message); }
void NRPEClient::query_fallback(const Plugin::QueryRequestMessage::Request &request, Plugin::QueryResponseMessage::Response *response, const Plugin::QueryRequestMessage &request_message) { client::configuration config(nrpe_client::command_prefix, boost::shared_ptr<nrpe_client::clp_handler_impl>(new nrpe_client::clp_handler_impl(boost::shared_ptr<socket_helpers::client::client_handler>(new client_handler()))), boost::shared_ptr<nrpe_client::target_handler>(new nrpe_client::target_handler(targets))); nrpe_client::setup(config, request_message.header()); commands.parse_query(nrpe_client::command_prefix, nrpe_client::default_command, request.command(), config, request, *response, request_message); }
void CheckExternalScripts::query_fallback(const Plugin::QueryRequestMessage::Request &request, Plugin::QueryResponseMessage::Response *response, const Plugin::QueryRequestMessage &) { //nscapi::functions::decoded_simple_command_data data = nscapi::functions::parse_simple_query_request(char_command, request); commands::optional_command_object command_def = commands_.find_object(request.command()); std::list<std::string> args; for (int i=0;i<request.arguments_size();++i) { args.push_back(request.arguments(i)); } if (command_def) { handle_command(*command_def, args, response); return; } alias::optional_command_object alias_def = aliases_.find_object(request.command()); if (alias_def) { handle_alias(*alias_def, args, response); return; } NSC_LOG_ERROR_STD("No command or alias found matching: " + request.command()); nscapi::protobuf::functions::set_response_bad(*response, "No command or alias found matching: " + request.command()); }
void CheckExternalScripts::query_fallback(const Plugin::QueryRequestMessage::Request &request, Plugin::QueryResponseMessage::Response *response, const Plugin::QueryRequestMessage &) { if (!provider_) { NSC_LOG_ERROR_STD("No provider found: " + request.command()); nscapi::protobuf::functions::set_response_bad(*response, "No command or alias found matching: " + request.command()); return; } commands::command_object_instance command_def = provider_->find_command(request.command()); std::list<std::string> args; for (int i = 0; i < request.arguments_size(); ++i) { args.push_back(request.arguments(i)); } if (command_def) { handle_command(*command_def, args, response); return; } alias::command_object_instance alias_def = aliases_.find_object(request.command()); if (alias_def) { handle_alias(*alias_def, args, response); return; } NSC_LOG_ERROR_STD("No command or alias found matching: " + request.command()); nscapi::protobuf::functions::set_response_bad(*response, "No command or alias found matching: " + request.command()); }
void CheckMKClient::query_fallback(const Plugin::QueryRequestMessage::Request &request, Plugin::QueryResponseMessage::Response *response, const Plugin::QueryRequestMessage &request_message) { client::configuration config(command_prefix, boost::shared_ptr<clp_handler_impl>(new clp_handler_impl(this)), boost::shared_ptr<target_handler>(new target_handler(targets))); setup(config, request_message.header()); commands.parse_query(command_prefix, default_command, request.command(), config, request, *response, request_message); }
cli_helper(const Plugin::QueryRequestMessage::Request &request, Plugin::QueryResponseMessage::Response *response, data_container &data) : data(data) , desc("Allowed options for " + request.command()) , request(request) , response(response) , show_all(false) {}
void SMTPClient::query_fallback(const Plugin::QueryRequestMessage::Request &request, Plugin::QueryResponseMessage::Response *response, const Plugin::QueryRequestMessage &request_message) { client::configuration config(command_prefix); setup(config, request_message.header()); commands.parse_query(command_prefix, default_command, request.command(), config, request, *response, request_message); }
void SamplePluginSimple::sample_raw_command(const Plugin::QueryRequestMessage::Request &request, Plugin::QueryResponseMessage::Response *response) { response->set_command(request.command()); response->set_message("Yaaay it works"); response->set_result(Plugin::Common_ResultCode_OK); }