blob: bd41472f2c88ed82efffab89488466511844a7a1 (
plain)
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
|
---
title: 'CatBus: logging'
subtitle: easy low-configuration logging
date: 2020-02-20
---
{% extends 'templates/base.html' %}
{% block body %}
<nav>
<a href='/catbus'>> catbus home</a>
</nav>
<header>
<h1>{{ title }}</h1>
<p>{{ subtitle }}</p>
</header>
<article>
{% markdown %}
Using the MQTT bus as a unified system with a unified semantic naming scheme means that I can also implement logging without the need for much configuration.
Following the above scheme, we can automatically scrape all devices named `*-sensor` into Prometheus metrics:
```
$control{zone=$zone,device=$device} = $value
```
For example,
```
temperature_celsius{zone=bedroom,device=window-sensor} = 17
```
Likewise, we can export enums as:
```
home/zone/device/control_enum:
foo
home/zone/device/control_enum/values:
bar
foo
control{zone=,device=,value=bar} = 0
control{zone=,device=,value=foo} = 1
```
{% endmarkdown %}
</article>
{% endblock %}
|