134 cout<<
"Starting the monitor agent->..";
155 cout<<
" started."<<endl;
163 cout<<
"unable to create directory: <"<<(
nodename+
"/incoming")+
"/exec"<<
"> ... exiting."<<endl;
170 cout<<
"unable to create directory: <"<<(
nodename+
"/outgoing")+
"/exec"<<
"> ... exiting."<<endl;
177 cout<<
"unable to create directory: <"<<(
nodename+
"/temp")+
"/exec"<<
"> ... exiting."<<endl;
184 if ((iretn=
agent->
add_request(
"del_event",
request_del_event,
"entry string",
"deletes the specified command event from the queue according to its JSON string")))
190 if ((iretn=
agent->
add_request(
"add_event",
request_add_event,
"{\"event_name\":\"\"}{\"event_utc\":0}{\"event_utcexec\":0}{\"event_flag\":0}{\"event_type\":0}{\"event_data\":\"\"}{\"event_condition\":\"\"}",
"adds the specified command event to the queue")))
214 printf(
"logstring: %s\n",
logstring.c_str());
229 dmjd = (
cmjd-lmjd)*86400.;
275 for (uint32_t k=0; k<
events.size(); ++k)
299 sleept = (int)((nextmjd-
currentmjd())*86400000000.);
300 if (sleept < 0) sleept = 0;
301 COSMOS_USLEEP(sleept);
static double cmjd
Definition: agent_monitor.cpp:121
static double newlogstride_soh
Definition: agent_monitor.cpp:115
int32_t request_del_event(string &request, string &response, Agent *agent)
Definition: agent_monitor.cpp:397
int32_t request_get_command_queue_size(string &request, string &response, Agent *agent)
Definition: agent_monitor.cpp:322
string json_list_of_soh(cosmosstruc *cinfo)
Definition: jsonlib.cpp:9252
#define DATA_LOG_TYPE_EVENT
Definition: datalib.h:109
static double logstride_soh
Definition: agent_monitor.cpp:116
FILE * get_debug_fd(double mjd=0.)
Definition: agentclass.cpp:2645
size_t calc_events(vector< eventstruc > &dictionary, cosmosstruc *cinfo, vector< eventstruc > &events)
Calculate current Events.
Definition: jsonlib.cpp:11356
static string temp_dir
Definition: agent_monitor.cpp:78
static Agent * agent
Definition: agent_monitor.cpp:74
string getNode()
Listen for heartbeat.
Definition: agentclass.cpp:2607
const char * json_of_table(string &jstring, vector< jsonentry * > table, cosmosstruc *cinfo)
Create JSON stream from entries.
Definition: jsonlib.cpp:8733
int32_t update_target(cosmosstruc *cinfo)
Update Track list.
Definition: jsonlib.cpp:11262
int32_t save_commands(string temp_dir, string name=".queue")
Save the queue of Events to a file.
Definition: command_queue.cpp:353
int32_t load_commands(string incoming_dir)
Load queue of Events from a file.
Definition: command_queue.cpp:420
int iretn
Definition: rw_test.cpp:37
void log_move(string oldpath, string newpath, bool compress)
Move log file - path version.
Definition: datalib.cpp:200
static thread cdthread
Definition: agent_monitor.cpp:109
int32_t wait(State state=State::RUN, double waitsec=10.)
Definition: agentclass.cpp:398
static vector< eventstruc > eventdict
Definition: agent_monitor.cpp:118
double utc
Overall Node time.
Definition: jsondef.h:3592
vector< vector< jsonequation > > emap
JSON Equation Map matrix.
Definition: jsondef.h:4211
string data_base_path(string node, string location, string agent, string filename)
Create data file path.
Definition: datalib.cpp:767
static int32_t newlogperiod
Definition: agent_monitor.cpp:114
static CommandQueue cmd_queue
Definition: agent_monitor.cpp:96
int32_t run_commands(Agent *agent, string nodename, double logdate_exec)
Traverse the entire queue of Events, clearing those that have finished.
Definition: command_queue.cpp:261
int32_t json_table_of_list(vector< jsonentry * > &table, string tokens, cosmosstruc *cinfo)
Output a vector of JSON entries.
Definition: jsonlib.cpp:3086
static string outgoing_dir
Definition: agent_monitor.cpp:77
void collect_data_loop()
Definition: agent_monitor.cpp:529
static string nodename
Definition: agent_monitor.cpp:80
nodestruc node
Structure for summary information in node.
Definition: jsondef.h:4220
string cosmos_error_string(int32_t cosmos_errno)
Definition: cosmos-errno.cpp:45
uint16_t running()
Check if we're supposed to be running.
Definition: agentclass.cpp:391
int32_t post(messstruc mess)
Post a Cosmos::Agent::messstruc.
Definition: agentclass.cpp:2074
static vector< eventstruc > events
Definition: agent_monitor.cpp:119
int32_t request_reopen_exec(string &request, string &response, Agent *agent)
Definition: agent_monitor.cpp:315
int32_t request_del_event_id(string &request, string &response, Agent *agent)
Definition: agent_monitor.cpp:362
string getAgent()
Definition: agentclass.cpp:2609
int32_t add_request(string token, external_request_function function, string synopsis="", string description="")
Add internal request to Agent request list with description and synopsis.
Definition: agentclass.cpp:312
char name[40+1]
Node Name.
Definition: jsondef.h:3556
static double newlogstride_exec
Definition: agent_monitor.cpp:83
Definition: agentclass.h:139
locstruc loc
Location structure.
Definition: jsondef.h:3596
int32_t request_set_logstride_exec(string &request, string &response, Agent *agent)
Definition: agent_monitor.cpp:309
size_t load_dictionary(vector< eventstruc > &dict, cosmosstruc *cinfo, const char *file)
Load Event Dictionary.
Definition: jsonlib.cpp:11313
int32_t shutdown()
Shutdown agent gracefully.
Definition: agentclass.cpp:366
Full COSMOS Event structure.
Definition: jsondef.h:1093
static double logdate_exec
Definition: agent_monitor.cpp:82
int32_t request_set_logstring(string &request, string &response, Agent *agent)
Definition: agent_monitor.cpp:509
const char * json_of_event(string &jstring, cosmosstruc *cinfo)
Create JSON for an event.
Definition: jsonlib.cpp:9854
int32_t request_get_logstring(string &request, string &response, Agent *agent)
Definition: agent_monitor.cpp:517
static double logstride_exec
Definition: agent_monitor.cpp:84
double data_ctime(string path)
Definition: datalib.cpp:1910
int32_t request_set_logperiod(string &request, string &response, Agent *agent)
Definition: agent_monitor.cpp:503
int32_t loc_update(locstruc *loc)
Synchronize all frames in location structure.
Definition: convertlib.cpp:2294
static vector< jsonentry * > logtable
Definition: agent_monitor.cpp:112
void log_write(string node, string agent, double utc, string extra, string type, string record, string location)
Write log entry - full.
Definition: datalib.cpp:75
double currentmjd(double offset)
Current UTC in Modified Julian Days.
Definition: timelib.cpp:65
static double logdate_soh
Definition: agent_monitor.cpp:113
static string logstring
Definition: agent_monitor.cpp:111
#define DATA_LOG_TYPE_SOH
Definition: datalib.h:108
string utc2iso8601(double utc)
ISO 8601 version of time.
Definition: timelib.cpp:1286
vector< agentstruc > agent
Single entry vector for agent information.
Definition: jsondef.h:4247
int32_t request_set_logstride_soh(string &request, string &response, Agent *agent)
Definition: agent_monitor.cpp:523
static int32_t logperiod
Definition: agent_monitor.cpp:114
cosmosstruc * cinfo
Definition: agentclass.h:346
int32_t request_add_event(string &request, string &response, Agent *agent)
Definition: agent_monitor.cpp:417
vector< eventstruc > event
Single entry vector for event information.
Definition: jsondef.h:4250
int32_t request_get_event(string &request, string &response, Agent *agent)
Definition: agent_monitor.cpp:328
static string jjstring
Definition: agent_monitor.cpp:105
string mjd2iso8601(double mjd)
Definition: timelib.cpp:1316
static string incoming_dir
Definition: agent_monitor.cpp:76
static string myjstring
Definition: agent_monitor.cpp:106
int32_t request_run(string &request, string &response, Agent *agent)
Definition: agent_monitor.cpp:438
int32_t request_reopen_soh(string &request, string &response, Agent *agent)
Definition: agent_monitor.cpp:496