mqtt2prometheus
mqtt2prometheus copied to clipboard
ghcr.io/hikhvar/mqtt2prometheus:v0.1.7-rc1 config file loading error
Looks like ghcr.io/hikhvar/mqtt2prometheus:v0.1.7-rc1 triggers the following error:
2022-08-24T12:06:46Z fatal cmd/mqtt2prometheus.go:80 Could not load config {"error": "open config.yaml: no such file or directory"}
main.main
/home/runner/work/mqtt2prometheus/mqtt2prometheus/cmd/mqtt2prometheus.go:80
runtime.main
/opt/hostedtoolcache/go/1.19.0/x64/src/runtime/proc.go:250
Moving from latest to v0.1.6 image tag solved the problem.
I can help with further debug but the config file should be there as the helm chart didn't change.
Thank you, Radu
Hey, thank you for this bug report. Since the 0.1.7-RC1 release is rather small, I think this problem is either caused by #88 or #84. Can you give me some more details how your deployment in the helm chart looks like?
# Source: mqtt2prom/templates/deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: release-name-mqtt2prom
labels:
helm.sh/chart: mqtt2prom-0.1.0
app.kubernetes.io/name: mqtt2prom
app.kubernetes.io/instance: release-name
app.kubernetes.io/version: "0.1.0"
app.kubernetes.io/managed-by: Helm
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: mqtt2prom
app.kubernetes.io/instance: release-name
template:
metadata:
labels:
app.kubernetes.io/name: mqtt2prom
app.kubernetes.io/instance: release-name
spec:
securityContext:
{}
containers:
- args:
- /mqtt2prometheus
- -config
- /data/config.yaml
- -log-level
- debug
name: mqtt2prom
image: "ghcr.io/hikhvar/mqtt2prometheus:v0.1.6"
imagePullPolicy: Always
ports:
- name: http
containerPort: 9641
protocol: TCP
# livenessProbe:
# httpGet:
# path:
# port: http
# initialDelaySeconds: 45
# periodSeconds: 30
# readinessProbe:
# httpGet:
# path:
# port: http
# initialDelaySeconds: 45
# periodSeconds: 10
resources:
limits:
cpu: 100m
memory: 128Mi
requests:
cpu: 100m
memory: 128Mi
volumeMounts:
- name: mqtt2prom-config-secret-volume
mountPath: /data/config.yaml
subPath: config.yaml
readOnly: true
volumes:
- name: mqtt2prom-config-secret-volume
secret:
secretName: mqtt2prom-config-secret
The config comes from a secret as the MQTT is password protected.
Thank you for the feedback. Will look into it. Can't give a time frame yet.
Ok, can reproduce your issue. I think this is relates to https://github.com/hikhvar/mqtt2prometheus/pull/84
% docker run -it -v /tmp/config.yaml:/data/config.yaml ghcr.io/hikhvar/mqtt2prometheus:v0.1.6 /mqtt2prometheus -config /data/config.yaml -log-level debug
2022-09-15T06:47:46Z warn cmd/mqtt2prometheus.go:134 could not connect to mqtt broker %s, sleep 10 second {"error": "network Error : dial tcp 127.0.0.1:1883: connect: connection refused"}
% docker run -it -v /tmp/config.yaml:/data/config.yaml ghcr.io/hikhvar/mqtt2prometheus:v0.1.7-RC1 /mqtt2prometheus -config /data/config.yaml -log-level debug
Unable to find image 'ghcr.io/hikhvar/mqtt2prometheus:v0.1.7-RC1' locally
v0.1.7-RC1: Pulling from hikhvar/mqtt2prometheus
Digest: sha256:935bf9211a329df80ed11e348409e9facd9390ddb3fd7afc7291816ff0e1856a
Status: Downloaded newer image for ghcr.io/hikhvar/mqtt2prometheus:v0.1.7-RC1
2022-09-15T07:06:49Z fatal cmd/mqtt2prometheus.go:80 Could not load config {"error": "open config.yaml: no such file or directory"}
main.main
/home/runner/work/mqtt2prometheus/mqtt2prometheus/cmd/mqtt2prometheus.go:80
runtime.main
/opt/hostedtoolcache/go/1.19.0/x64/src/runtime/proc.go:250
If the leading /mqtt2prometheus is ommited, it works again:
docker run -it -v /tmp/config.yaml:/data/config.yaml ghcr.io/hikhvar/mqtt2prometheus:v0.1.7-RC1 -config /data/config.yaml -log-level debug
2022-09-15T07:08:56Z warn cmd/mqtt2prometheus.go:134 could not connect to mqtt broker %s, sleep 10 second {"error": "network Error : dial tcp 127.0.0.1:1883: connect: connection refused"}
So I think, if you change your deployment to the following it should work again:
# Source: mqtt2prom/templates/deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: release-name-mqtt2prom
labels:
helm.sh/chart: mqtt2prom-0.1.0
app.kubernetes.io/name: mqtt2prom
app.kubernetes.io/instance: release-name
app.kubernetes.io/version: "0.1.0"
app.kubernetes.io/managed-by: Helm
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: mqtt2prom
app.kubernetes.io/instance: release-name
template:
metadata:
labels:
app.kubernetes.io/name: mqtt2prom
app.kubernetes.io/instance: release-name
spec:
securityContext:
{}
containers:
- args:
- -config
- /data/config.yaml
- -log-level
- debug
name: mqtt2prom
image: "ghcr.io/hikhvar/mqtt2prometheus:v0.1.7-RC1"
imagePullPolicy: Always
ports:
- name: http
containerPort: 9641
protocol: TCP
# livenessProbe:
# httpGet:
# path:
# port: http
# initialDelaySeconds: 45
# periodSeconds: 30
# readinessProbe:
# httpGet:
# path:
# port: http
# initialDelaySeconds: 45
# periodSeconds: 10
resources:
limits:
cpu: 100m
memory: 128Mi
requests:
cpu: 100m
memory: 128Mi
volumeMounts:
- name: mqtt2prom-config-secret-volume
mountPath: /data/config.yaml
subPath: config.yaml
readOnly: true
volumes:
- name: mqtt2prom-config-secret-volume
secret:
secretName: mqtt2prom-config-secret
No response, assume this is fixed.
No response, assume this is fixed.