diff options
| author | arf20 <aruizfernandez05@gmail.com> | 2025-11-10 00:28:43 +0100 |
|---|---|---|
| committer | arf20 <aruizfernandez05@gmail.com> | 2025-11-10 00:28:43 +0100 |
| commit | 2ad586295dcd5dcef3d29af32998d55bb5c09843 (patch) | |
| tree | 8b4128ad080bfa063f36ffb2ccc28642a87f19fc /monitor.c | |
| parent | c766bf7134b8179401b7e05f00d5a3693e2b56f4 (diff) | |
| download | arfnet2-status-2ad586295dcd5dcef3d29af32998d55bb5c09843.tar.gz arfnet2-status-2ad586295dcd5dcef3d29af32998d55bb5c09843.zip | |
WIP api alert
Diffstat (limited to 'monitor.c')
| -rw-r--r-- | monitor.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -24,7 +24,8 @@ typedef struct { } incident_t; -const char *type_str[] = { "reach", "dns", "web" }; +static const char *status_str[] = { "down", "up" }; +static const char *type_str[] = { "reach", "dns", "web" }; target_t *targets = NULL; size_t targets_size = 0, targets_capacity = INIT_VEC_CAPACITY; @@ -35,7 +36,6 @@ static size_t incidents_size = 0, incidents_capacity = 0; static char timestr[256]; -static char *status_str[] = { "down", "up" }; static void @@ -215,7 +215,7 @@ monitor_init() char *name = strtok(NULL, ","); char *target = strtok(NULL, ","); - if (!target || !name || !target) { + if (!type || !name || !target) { fprintf(stderr, "malformed config line: %s\n", line); continue; } @@ -226,6 +226,10 @@ monitor_init() targets[targets_size].type = TYPE_DNS; else if (strcmp(type, "web") == 0) targets[targets_size].type = TYPE_WEB; + else { + fprintf(stderr, "unknown target type: %s\n", line); + continue; + } targets[targets_size].name = strdup(name); targets[targets_size].target = strdup(target); @@ -246,7 +250,7 @@ monitor_init() ); targets_size++; - } + } incidents = malloc(sizeof(incident_t) * INIT_VEC_CAPACITY); incidents_capacity = INIT_VEC_CAPACITY; |
