-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodbus-exporter-example.yaml
92 lines (88 loc) · 2.34 KB
/
modbus-exporter-example.yaml
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
# example k8s deployment
apiVersion: apps/v1
kind: Deployment
metadata:
name: modbus-exporter
spec:
selector:
matchLabels:
app: modbus-exporter
replicas: 1
template:
metadata:
labels:
app: modbus-exporter
spec:
containers:
- name: modbus-exporter
image: ghcr.io/stephanme/modbus_exporter:latest
ports:
- containerPort: 9602
command:
- ./modbus_exporter
- --config.file
- /app/config/modbus.yml
volumeMounts:
- name: config
mountPath: /app/config
readOnly: true
volumes:
- name: config
configMap:
name: modbus-exporter-config
---
apiVersion: v1
kind: Service
metadata:
name: modbus-exporter
spec:
ports:
- port: 9602
targetPort: 9602
name: metrics
selector:
app: modbus-exporter
---
apiVersion: v1
kind: ConfigMap
metadata:
name: modbus-exporter-config
data:
modbus.yml: |-
modules:
# Module name, needs to be passed as parameter by Prometheus.
- name: "fake"
protocol: 'tcp/ip'
metrics:
# Name of the metric.
- name: "power_consumption_total"
# Help text of the metric.
help: "represents the overall power consumption by phase"
# Labels to be added to the time series.
labels:
phase: "1"
# Register address.
address: 300022
# Datatypes allowed: bool, int16, uint16, float16, float32
dataType: int16
# Endianness allowed: big, little, mixed, yolo
# Optional. If not defined: big.
endianness: big
# Prometheus metric type: https://prometheus.io/docs/concepts/metric_types/.
metricType: counter
# Factor can be specified to represent metric value.
# Examples: 1, 2, 1.543 etc
# Optional.
factor: 3.1415926535
- name: "some_gauge"
help: "some help for some gauge"
address: 300023
dataType: int16
metricType: gauge
factor: 2
- name: "coil"
help: "some help for some coil"
address: 100024
dataType: bool
bitOffset: 0
metricType: gauge