-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart_monitor.c
More file actions
57 lines (40 loc) · 1.46 KB
/
Copy pathstart_monitor.c
File metadata and controls
57 lines (40 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "config.h"
#include "monitor.h"
#define FIELD_SIZE 100
int main(int argc,
const char ** const argv)
{
struct Monitor *monitor;
char clock_endpoint[FIELD_SIZE];
char rg_ru_endpoint[FIELD_SIZE];
char topic_storage_endpoint[FIELD_SIZE];
char sink_endpoint[FIELD_SIZE];
char field[FIELD_SIZE];
FILE *fp;
int ret;
fp = fopen("monitor.ini", "r");
if (fp == NULL) {
printf(">>> [Start_Monitor]: IO ERROR. can't open \"monitor.ini\"\n");
return 1;
}
fscanf(fp,"%s %*s %s", field, clock_endpoint);
printf(">>> [Start_Monitor]: field: %s; value: %s;\n", field, clock_endpoint);
fscanf(fp,"%s %*s %s", field, rg_ru_endpoint);
printf(">>> [Start_Topic_Monitor]: field: %s; value: %s;\n", field, rg_ru_endpoint);
fscanf(fp,"%s %*s %s", field, topic_storage_endpoint);
printf(">>> [Start_Topic_Monitor]: field: %s; value: %s;\n", field, topic_storage_endpoint);
fscanf(fp,"%s %*s %s", field, sink_endpoint);
printf(">>> [Start_Topic_Monitor]: field: %s; value: %s;\n", field, sink_endpoint);
fclose(fp);
ret = Monitor_new(&monitor);
if (ret != OK) return FAIL;
monitor->rg_ru_endpoint = rg_ru_endpoint;
monitor->clock_endpoint = clock_endpoint;
monitor->topic_storage_endpoint = topic_storage_endpoint;
monitor->sink_endpoint = sink_endpoint;
monitor->serve_forever(monitor);
return OK;
}