59 const std::map< const string, const string > plugin_libldms_msg_publish_config_defaults =
67 inline static const char *plugin_prefix =
"ADC_LIBLDMS_MSG_PUBLISH_PLUGIN_";
70 const std::vector<string> tags;
81 if (mode != pi_config)
94 const string get(
const std::map< string, string >& m,
95 string field,
const string& env_prefix) {
97 auto it = m.find(field);
101 string en = env_prefix + field;
102 char *ec = getenv(en.c_str());
104 return plugin_libldms_msg_publish_config_defaults.at(field);
112 int libldms_msg_publish_send(
string& f)
116 string qcmd =
"(" + prog +
124 "> /dev/null 2>&1 ; /bin/rm " + f +
") &";
125 int err2 = std::system(qcmd.c_str());
126 std::cout << f << std::endl;
127 std::cout << err2 << std::endl;
134 std::cout <<
"Constructing libldms_msg_publish_plugin" << std::endl;
142 if (mode != pi_pub_or_final)
148 int config(
const std::map< std::string, std::string >& m) {
149 return config(m, plugin_prefix);
152 int config(
const std::map< std::string, std::string >& m,
const std::string& env_prefix) {
153 string host = get(m,
"HOST", env_prefix);
154 string port = get(m,
"PORT", env_prefix);
155 string auth = get(m,
"AUTH", env_prefix);
156 string channel = get(m,
"CHANNEL", env_prefix);
157 return config(d, host, port, auth, channel);
161 return plugin_libldms_msg_publish_config_defaults;
165 std::map <string, string >m;
168 if (mode != pi_init) {
171 if ( state == err ) {
172 std::cout <<
"libldms_msg_publish plugin initialize found pre-existing error" << std::endl;
178 mode = pi_pub_or_final;
183 if (mode == pi_pub_or_final) {
188 std::cout <<
"libldms_msg_publish plugin finalize on non-running plugin" << std::endl;
201 return "libldms_msg_publish";
209 std::cout <<
"Destructing libldms_msg_publish_plugin" << std::endl;
libldms_msg_publish publisher_api implementation. This plugin calls the ldms libraries for sending me...
void pause()
Pause publishing until a call to resume. Duplicate calls are allowed.
libldms_msg_publish_plugin()
int publish(std::shared_ptr< builder_api > b)
Publish the content of the builder.
static const char * adc_libldms_msg_publish_plugin_channel_default
name of the channel ADC messages go into LDMS aggregators must be subscribed to this name....
static const char * adc_libldms_msg_publish_plugin_port_default
port for channel connections; ldmsd listeners must match. Overridden with env("ADC_LIBLDMS_MSG_PUBLIS...
string_view version() const
void resume()
Resume publishing Duplicate calls are allowed.
static const char * adc_libldms_msg_publish_plugin_auth_default
authentication method for channel connections; ldmsd listeners must match. Overridden with env("ADC_L...
const std::map< const std::string, const std::string > & get_option_defaults()
Look up the settable options and their defaults.
int config(const std::map< std::string, std::string > &m, const std::string &env_prefix)
void finalize()
Stop publishing and release any resources held for managing publication.
int config(const std::map< std::string, std::string > &m)
Configure the plugin with the options given.
~libldms_msg_publish_plugin()
int initialize()
Ready the plugin to publish following the configuration options set or defaulted.
static const char * adc_libldms_msg_publish_plugin_host_default
host for channel connections; ldmsd must be listening on the host. Overridden with env("ADC_LIBLDMS_M...
Publisher plugin interface.
std::string_view string_view