aboutsummaryrefslogtreecommitdiff
path: root/monitor.h
blob: f39441cb01f1c503ad8091761cb477c874ad61ca (plain) (blame)
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
#ifndef _MONITOR_H
#define _MONITOR_H

#include <time.h>

typedef enum {
    TYPE_REACH,
    TYPE_DNS,
    TYPE_WEB
} mon_type_t;

typedef enum {
    STATUS_DOWN,
    STATUS_UP
} status_t;

typedef struct {
    time_t time;
    status_t status;
} event_t;

typedef struct {
    mon_type_t type;
    char *name;
    char *target;

    status_t status, status_1;

    event_t *events;
    size_t events_size, events_capacity;
} target_t;


extern target_t *targets;
extern size_t targets_size;

int monitor_init();
const char *monitor_generate_status_html();
const char *monitor_generate_incidents_html();
void monitor_check();
void monitor_update_events(const char *log_path);

#endif /* _MONITOR_H */