-
Notifications
You must be signed in to change notification settings - Fork 0
/
config_hub.py
128 lines (100 loc) · 3.17 KB
/
config_hub.py
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# Watchtower sample period(in s)
sample_period: float = 1
# Output CSV file path (relative to the executable, or absolute)
csv_path = "out.csv"
# Path to a reference output, considered safe
csv_safe = "safe.csv"
# Number of STD of deviation allowed
nb_std = 4
# MQTT client name
client_name = "watchtower_hub"
# MQTT broker address
# Make sure that this address is the one in the broker certificate
broker_addr = "localhost"
broker_port: int = 8883
# Root CA path
ca_cert = "/certs/CA.pem"
# Client certificate and key paths
certfile = "/certs/hub.crt"
keyfile = "/certs/hub.key"
# DB path
db_path = "postgresql://pi:password@localhost/sentinel"
# Info about all files to sample
files: list = [
{"path": "/sys/kernel/sentinel/nb_cpus",
"name": "Number of CPUs cores",
"unit": "N/A",
"differential": 0},
{"path": "/sys/kernel/sentinel/CPU_0",
"name": "CPU 0 freq",
"unit": "kHz",
"differential": 0},
{"path": "/sys/kernel/sentinel/CPU_1",
"name": "CPU 1 freq",
"unit": "kHz",
"differential": 0},
{"path": "/sys/kernel/sentinel/CPU_2",
"name": "CPU 2 freq",
"unit": "kHz",
"differential": 0},
{"path": "/sys/kernel/sentinel/CPU_3",
"name": "CPU 3 freq",
"unit": "kHz",
"differential": 0},
{"path": "/sys/kernel/sentinel/free_ram",
"name": "Free RAM",
"unit": "kB",
"differential": 0},
{"path": "/sys/kernel/sentinel/used_ram",
"name": "Used RAM",
"unit": "kB",
"differential": 0},
{"path": "/sys/kernel/sentinel/total_ram",
"name": "Total RAM",
"unit": "kB",
"differential": 0},
{"path": "/sys/kernel/sentinel/free_swap",
"name": "Free Swap",
"unit": "kB",
"differential": 0},
{"path": "/sys/kernel/sentinel/used_swap",
"name": "Used Swap",
"unit": "kB",
"differential": 0},
{"path": "/sys/kernel/sentinel/total_swap",
"name": "Total Swap",
"unit": "kB",
"differential": 0},
{"path": "/sys/kernel/sentinel/load_1m",
"name": "CPU load (1m)",
"unit": "%",
"differential": 0},
{"path": "/sys/kernel/sentinel/load_5m",
"name": "CPU load (5m)",
"unit": "%",
"differential": 0},
{"path": "/sys/kernel/sentinel/load_15m",
"name": "CPU load (15m)",
"unit": "%",
"differential": 0},
{"path": "/sys/kernel/sentinel/nb_processes",
"name": "Number of processes",
"unit": "N/A",
"differential": 0},
{"path": "/sys/class/net/ens33/statistics/rx_bytes",
"name": "Number of bytes received",
"unit": "bytes",
"differential": 1},
{"path": "/sys/class/net/ens33/statistics/tx_bytes",
"name": "Number of bytes sent",
"unit": "bytes",
"differential": 1},
{"path": "/sys/class/net/ens33/statistics/rx_packets",
"name": "Number of packets received",
"unit": "N/A",
"differential": 1},
{"path": "/sys/class/net/ens33/statistics/tx_packets",
"name": "Number of packets sent",
"unit": "N/A",
"differential": 1},
]