89{
90
91
92
93
94 string rbufin = string(m_conf->getconf("system", "unitname")) + ":" +
95 string(m_conf->getconf("collector", "ringbufin"));
96
97 string rbufout = string(m_conf->getconf("system", "unitname")) + ":" +
98 string(m_conf->getconf("collector", "ringbufout"));
99
100
101 string shmname = string(m_conf->getconf("system", "unitname")) + ":" +
102 string(m_conf->getconf("collector", "nodename"));
103
104
105
106 char* hport = m_conf->getconf("collector", "historecv", "port");
107
108
109
110
111
112
113
114
115
116
117
118 char* src = m_conf->getconf("collector", "destination");
119 if (strstr(src, "net") != 0) {
120
121 char* sender = m_conf->getconf("collector", "sender", "script");
122 char* port = m_conf->getconf("collector", "sender", "port");
123 char idbuf[3];
124 sprintf(idbuf, "%2.2d", RF_OUTPUT_ID);
125 m_pid_sender = m_proc->Execute(sender, const_cast<char*>(rbufout.c_str()), port, const_cast<char*>(shmname.c_str()), idbuf);
126 m_flow->clear(RF_OUTPUT_ID);
127 } else if (strstr(src, "file") != 0) {
128
129 char* writer = m_conf->getconf("collector", "writer", "script");
130 char* file = m_conf->getconf("collector", "writer", "filename");
131 char* nnode = m_conf->getconf("processor", "nnodes");
132 m_pid_sender = m_proc->Execute(writer, const_cast<char*>(rbufout.c_str()), file, nnode);
133 } else {
134
135 }
136
137
138 char* basf2 = m_conf->getconf("collector", "basf2", "script");
139 if (nsmm != NULL && nsmm->len > 0) {
140 basf2 = const_cast<char*>(nsmm->datap);
141 printf("Configure: basf2 script overridden : %s\n", basf2);
142 }
143 m_pid_basf2 = m_proc->Execute(basf2, const_cast<char*>(rbufin.c_str()), const_cast<char*>(rbufout.c_str()), hport);
144
145
146 m_nnodes = 0;
147 int maxnodes = m_conf->getconfi("processor", "nnodes");
148 int idbase = m_conf->getconfi("processor", "idbase");
149
150 const char* hostbase = m_conf->getconf("processor", "hostbase");
151 char* badlist = m_conf->getconf("processor", "badlist");
152 char* port = m_conf->getconf("processor", "sender", "port");
153
154 char* receiver = m_conf->getconf("collector", "receiver", "script");
155 char hostname[512], idname[12], shmid[12];
156 for (int i = 0; i < maxnodes; i++) {
157 snprintf(idname, sizeof(idname), "%2.2d", idbase + i);
158 snprintf(shmid, sizeof(shmid), "%2.2d", i);
159 if (badlist == NULL ||
160 strstr(badlist, idname) == 0) {
161 sprintf(hostname, "%s%2.2d", hostbase, idbase + i);
162 m_pid_receiver[m_nnodes] = m_proc->Execute(receiver, const_cast<char*>(rbufin.c_str()), hostname, port,
163 const_cast<char*>(shmname.c_str()), shmid);
164 m_flow->clear(i);
165 m_nnodes++;
166 }
167 }
168
169 m_rbufin->forceClear();
170 m_rbufout->forceClear();
171 return 0;
172}