You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/[Daemon]-DNS-server.md
+97-3
Original file line number
Diff line number
Diff line change
@@ -5,6 +5,7 @@ The DNS server daemon simultaneously serves as:
5
5
- An authoritative DNS server for configured domain names (`MyDomainNames`),
6
6
responding to SOA, NS, MX, and address queries. MX and address responses point
7
7
to the server's own public IP.
8
+
- An authoritative DNS server for predefined custom records on any domain name.
8
9
- A stub resolver that blocks advertising and malicious domains for home
9
10
networks (`AllowQueryFromCidrs`).
10
11
- Handle TXT queries as the [carrier of app command invocation](<https://github.com/HouzuoGuo/laitos/wiki/%5BDaemon%5D-DNS-server-(invoke-app-commands)>).
@@ -42,9 +43,9 @@ JSON config file:
42
43
<td>MyDomainNames</td>
43
44
<td>array of strings</td>
44
45
<td>
45
-
The laitos DNS server's own domain names.
46
+
Define the DNS server's own domain names.
46
47
<br />
47
-
The DNS server gives authoritative responses to SOA, NS, MX, A queries of these domain names.
48
+
The DNS server will automatically respond to SOA, NS, MX, and address queries for these domains with its own server IP.
48
49
<br />
49
50
This is also used by <a href="https://github.com/HouzuoGuo/laitos/wiki/%5BDaemon%5D-DNS-server-(invoke-app-commands)">DNS server (invoke app commands)</a>
50
51
and <a href="https://github.com/HouzuoGuo/laitos/wiki/%5BDaemon%5D-DNS-server-(TCP-over-DNS)">DNS server (TCP over DNS)</a>
@@ -122,13 +123,106 @@ Here is a minimal JSON config file example:
122
123
}
123
124
</pre>
124
125
126
+
### Define custom DNS records
127
+
128
+
In addition to blocking ads, the DNS server also responds to predefined custom
129
+
records, which is useful for hosting a personal website.
130
+
131
+
The custom records may be defined on any domain name regardless of the `MyDomainNames` value.
132
+
133
+
Under `DNSDaemon`, add a new JSON object `CustomRecords`. Populate the keys with
134
+
record names (FQDN e.g. `myhost.example.com`), and define the records for each key:
135
+
136
+
<table>
137
+
<tr>
138
+
<th>Property</th>
139
+
<th>Type</th>
140
+
<th>Meaning</th>
141
+
<th>Default value</th>
142
+
</tr>
143
+
<tr>
144
+
<td>A</td>
145
+
<td>JSON object {"Addresses": ["1.1.1.1", "2.2.2.2", ...]} or {"CanonicalName": "foo.example.com"}</td>
146
+
<td>Respond to the query with the IPv4 addresses or the canonical name.</td>
147
+
<td>Empty</td>
148
+
</tr>
149
+
<tr>
150
+
<td>AAAA</td>
151
+
<td>JSON object {"Addresses": ["1.1.1.1", "2.2.2.2", ...]} or {"CanonicalName": "foo.example.com"}</td>
152
+
<td>Respond to the query with the IPv6 addresses or the canonical name.</td>
Copy file name to clipboardExpand all lines: doc/[Daemon]-system-maintenance.md
+51
Original file line number
Diff line number
Diff line change
@@ -23,6 +23,7 @@ System maintenance tasks comprise:
23
23
journal.
24
24
- Synchronise system clock.
25
25
- On Windows, verify and maintain system files integrity with `DISM` and `SFC`.
26
+
- Discard older systemd journal content to conserve disk space.
26
27
- Set Linux system time zone (additional configuration required).
27
28
28
29
(Miscellaneous)
@@ -158,7 +159,57 @@ laitos works with the following system package managers for installing and updat
158
159
<td>(Not used)</td>
159
160
<td>Universal</td>
160
161
</tr>
162
+
<tr>
163
+
<td>RegisterPrometheusMetrics</td>
164
+
<td>true/false</td>
165
+
<td>
166
+
Record the process statistics (e.g. CPU time & context switches) in promehteus metrics.
167
+
<br />
168
+
The metrics are served by <a href="https://github.com/HouzuoGuo/laitos/wiki/%5BWeb-service%5D-prometheus-metrics-exporter">prometheus metrics exporter web handler</a>.
169
+
</td>
170
+
<td>(Not enabled)</td>
171
+
<td>Linux</td>
172
+
</tr>
173
+
<tr>
174
+
<td>RegsiterProcessActivityMetrics</td>
175
+
<td>true/false</td>
176
+
<td>
177
+
Record the laitos process file and network activities in prometheus metrics.
178
+
This requires "bpftrace" and requires an additional 100 MB of system memory.
179
+
<br />
180
+
The metrics are served by <a href="https://github.com/HouzuoGuo/laitos/wiki/%5BWeb-service%5D-prometheus-metrics-exporter">prometheus metrics exporter web handler</a>.
181
+
</td>
182
+
<td>(Not enabled)</td>
183
+
<td>Linux</td>
184
+
</tr>
185
+
<tr>
186
+
<td>RegsiterSystemActivityMetrics</td>
187
+
<td>true/false</td>
188
+
<td>
189
+
Record the system-wide file and network activities in prometheus metrics.
190
+
This requires "bpftrace" and requires an additional 500 - 1000 MB of system memory.
191
+
<br />
192
+
The metrics are served by <a href="https://github.com/HouzuoGuo/laitos/wiki/%5BWeb-service%5D-prometheus-metrics-exporter">prometheus metrics exporter web handler</a>.
193
+
</td>
194
+
<td>(Not enabled)</td>
195
+
<td>Linux</td>
196
+
</tr>
197
+
<tr>
198
+
<td>PrometheusScrapeIntervalSec</td>
199
+
<td>integer</td>
200
+
<td>The scrape interval expected from prometheus, measured in seconds. This is used to determine the sampling period of certain gauges.</td>
201
+
<td>60 (seconds)</td>
202
+
<td>Universal</td>
203
+
</tr>
204
+
<tr>
205
+
<td>ShrinkSystemdJournalSizeMB</td>
206
+
<td>integer</td>
207
+
<td>Retain this much system journal (measured in MB) and discard the older content to conserve disk space.</td>
208
+
<td>(Not enabled)</td>
209
+
<td>Linux</td>
210
+
</tr>
161
211
</table>
212
+
162
213
2. Follow [outgoing mail configuration](https://github.com/HouzuoGuo/laitos/wiki/Outgoing-mail-configuration).
163
214
164
215
Here is an example configuration that keeps system up-to-date, while also checking whether mail(25), DNS(53), and HTTP(80, 443) daemons are online:
Copy file name to clipboardExpand all lines: doc/[Web-service]-prometheus-metrics-exporter.md
+25-8
Original file line number
Diff line number
Diff line change
@@ -7,18 +7,30 @@ information collected from the following sources in the prometheus-exporter form
7
7
- All web proxy requests: time to first byte, connection duration, size of response.
8
8
9
9
## Configuration
10
+
10
11
Under the JSON key `HTTPHandlers`, add a string property called `PrometheusMetricsEndpoint`, value being the URL location of the service.
12
+
Keep the location a secret to yourself and make it difficult to guess.
13
+
14
+
Check out the additional process and system activity metrics available from the [system maintenance](https://github.com/HouzuoGuo/laitos/wiki/%5BDaemon%5D-system-maintenance) daemon,
15
+
enable them as you wish.
11
16
12
-
Keep the location a secret to yourself and make it difficult to guess. Here is an example:
@@ -36,13 +48,18 @@ The exporter is hosted by web server, therefore remember to [run web server](htt
36
48
37
49
## Usage
38
50
39
-
There are three categories of performance metrics exported by this web service:
51
+
The prometheus web handler serves all of these metrics:
52
+
40
53
-[Web server (httpd and insecurehttpd)](https://github.com/HouzuoGuo/laitos/wiki/%5BDaemon%5D-web-server) statistics are always included, such as
41
54
individual handler's processing duration, response size, time-to-first-byte, etc.
42
-
-When you enable the [web proxy daemon](https://github.com/HouzuoGuo/laitos/wiki/%5BDaemon%5D-web-proxy), the exporter will automatically include
55
+
-If [web proxy daemon](https://github.com/HouzuoGuo/laitos/wiki/%5BDaemon%5D-web-proxy) is enabled, the exporter will automatically include
43
56
statistics such as data transfer per proxy destination, number of connections, connection duration, etc.
44
-
- When you enable the [maintenance daemon](https://github.com/HouzuoGuo/laitos/wiki/%5BDaemon%5D-system-maintenance), the exporter will automatically
45
-
include laitos program's process statistics such as CPU usage and scheduler performance. These stats rely on Linux (`procfs`).
57
+
- If [maintenance daemon](https://github.com/HouzuoGuo/laitos/wiki/%5BDaemon%5D-system-maintenance)`RegisterPrometheusMetrics` is enabled,
58
+
the exporter will automatically include laitos program's process statistics such as CPU usage and scheduler performance. This relies on Linux (`procfs`).
59
+
- If [maintenance daemon](https://github.com/HouzuoGuo/laitos/wiki/%5BDaemon%5D-system-maintenance)`RegsiterProcessActivityMetrics` is enabled,
60
+
the exporter will automatically include the file and network activities of the laitos process. This relies on `bpftrace` tool.
61
+
- If [maintenance daemon](https://github.com/HouzuoGuo/laitos/wiki/%5BDaemon%5D-system-maintenance)`RegsiterSystemActivityMetrics` is enabled,
62
+
the exporter will automatically include the system-wide file and network activities. This relies on `bpftrace` tool.
46
63
47
64
Next, follow the installation instructions of [prometheus](https://prometheus.io/docs/prometheus/latest/installation/) to install and start the
48
65
prometheus daemon. Feel free to run the daemon on a home desktop, a dedicated server, or on the same computer that runs laitos.
@@ -54,7 +71,7 @@ the web service's endpoint:
54
71
...
55
72
scrape_configs:
56
73
- job_name: 'laitos'
57
-
scrape_interval: 20s
74
+
scrape_interval: 60s # set to the same value as the system maintenance daemon's PrometheusScrapeIntervalSec
0 commit comments