Monitoring Syncthing with Prometheus and Grafana
Happy new year!
I just managed to implement syncthing monitoring for my prometheus and grafana instance, so I figured to write a short blog post about it.
Note: This post is written for prometheus-json-exporter pre-0.1.0 and the configuration file format changed since.
Now, as you've read in the note above, I managed to do this using the prometheus-json-exporter. Syncthing has a status page that can be accessed with
$ curl localhost:22070/status
if enabled. This can then be used to push to prometheus using the prometheus-json-exporter mentioned above using the following configuration for mapping the values from the JSON to prometheus:
- name: syncthing_buildDate
path: $.buildDate
help: Value of buildDate
- name: syncthing_buildHost
path: $.buildHost
help: Value of buildHost
- name: syncthing_buildUser
path: $.buildUser
help: Value of buildUser
- name: syncthing_bytesProxied
path: $.bytesProxied
help: Value of bytesProxied
- name: syncthing_goArch
path: $.goArch
help: Value of goArch
- name: syncthing_goMaxProcs
path: $.goMaxProcs
help: Value of goMaxProcs
- name: syncthing_goNumRoutine
path: $.goNumRoutine
help: Value of goNumRoutine
- name: syncthing_goOS
path: $.goOS
help: Value of goOS
- name: syncthing_goVersion
path: $.goVersion
help: Value of goVersion
- name: syncthing_kbps10s1m5m15m30m60m
path: $.kbps10s1m5m15m30m60m
help: Value of kbps10s1m5m15m30m60m
type: object
values:
time_10_sec: $[0]
time_1_min: $[1]
time_5_min: $[2]
time_15_min: $[3]
time_30_min: $[4]
time_60_min: $[5]
- name: syncthing_numActiveSessions
path: $.numActiveSessions
help: Value of numActiveSessions
- name: syncthing_numConnections
path: $.numConnections
help: Value of numConnections
- name: syncthing_numPendingSessionKeys
path: $.numPendingSessionKeys
help: Value of numPendingSessionKeys
- name: syncthing_numProxies
path: $.numProxies
help: Value of numProxies
- name: syncthing_globalrate
path: $.options.global-rate
help: Value of options.global-rate
- name: syncthing_messagetimeout
path: $.options.message-timeout
help: Value of options.message-timeout
- name: syncthing_networktimeout
path: $.options.network-timeout
help: Value of options.network-timeout
- name: syncthing_persessionrate
path: $.options.per-session-rate
help: Value of options.session-rate
- name: syncthing_pinginterval
path: $.options.ping-interval
help: Value of options.ping-interval
- name: syncthing_startTime
path: $.startTime
help: Value of startTime
- name: syncthing_uptimeSeconds
path: $.uptimeSeconds
help: Value of uptimeSeconds
- name: syncthing_version
path: $.version
help: Value of version
When configured properly, one is then able to draw graphs using the syncthing-exported data in grafana.
There's nothing more to it.
tags: #nixos #grafana #prometheus #syncthing