Compare commits
16 Commits
Author | SHA1 | Date |
---|---|---|
David | c913570e7e | |
renovate | fc57199ba8 | |
David | 1cdc2dbcab | |
renovate | 66e4d870dd | |
David | 3a4888b81d | |
renovate | 0f860c3a38 | |
David | 736fff77f5 | |
renovate | e0bf76f78d | |
David | b77101bfd3 | |
renovate | 8443da2d88 | |
David | bd7e8d007c | |
renovate | 57398b7dcf | |
David | d4cecb1352 | |
renovate | 360360f3ea | |
renovate | 65eed04b5e | |
David | 4d7e15d719 |
|
@ -0,0 +1,21 @@
|
|||
# Prusa Connect Prometheus Exporter
|
||||
|
||||
Version v0.1.0 of this exporter supports the pre-4.4.0 changes to the Prusa Connect API (non-API-key version).
|
||||
|
||||
Current master branch supports the new, 4.4.0-beta2 release of Prusa Connect as well as the older API.
|
||||
|
||||
## Usage
|
||||
|
||||
`./prusa-connect-exporter -h`
|
||||
|
||||
* `apikey`
|
||||
Prusa Connect API key (see Main Menu -> Settings -> Network on the printer).
|
||||
If no key is provided, exporter assumes the older API layout when querying the printer.
|
||||
* `hostname`
|
||||
Hostname the Prusa Connect API is available at (assumes http) (default "localhost")
|
||||
* `interval`
|
||||
How often, in seconds, to query the API (default 2)
|
||||
* `path`
|
||||
Local path to export metrics on (default "metrics")
|
||||
* `port`
|
||||
Local port to export metrics on (default "2112")
|
19
go.mod
19
go.mod
|
@ -2,16 +2,17 @@ module git.yetaga.in/alazyreader/prusa-connect-exporter
|
|||
|
||||
go 1.17
|
||||
|
||||
require github.com/prometheus/client_golang v1.12.1
|
||||
require github.com/prometheus/client_golang v1.19.0
|
||||
|
||||
require (
|
||||
github.com/beorn7/perks v1.0.1 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.1.2 // indirect
|
||||
github.com/golang/protobuf v1.5.2 // indirect
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
|
||||
github.com/prometheus/client_model v0.2.0 // indirect
|
||||
github.com/prometheus/common v0.32.1 // indirect
|
||||
github.com/prometheus/procfs v0.7.3 // indirect
|
||||
golang.org/x/sys v0.0.0-20220114195835-da31bd327af9 // indirect
|
||||
google.golang.org/protobuf v1.26.0 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.2.0 // indirect
|
||||
github.com/golang/protobuf v1.5.3 // indirect
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
|
||||
github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect
|
||||
github.com/prometheus/client_model v0.5.0 // indirect
|
||||
github.com/prometheus/common v0.48.0 // indirect
|
||||
github.com/prometheus/procfs v0.12.0 // indirect
|
||||
golang.org/x/sys v0.16.0 // indirect
|
||||
google.golang.org/protobuf v1.32.0 // indirect
|
||||
)
|
||||
|
|
77
go.sum
77
go.sum
|
@ -46,6 +46,8 @@ github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA
|
|||
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||
github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE=
|
||||
github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||
github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44=
|
||||
github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
|
||||
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
|
||||
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
|
||||
|
@ -63,9 +65,11 @@ github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2
|
|||
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
||||
github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
||||
github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY=
|
||||
github.com/go-kit/log v0.2.0/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0=
|
||||
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
|
||||
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
|
||||
github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A=
|
||||
github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs=
|
||||
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
|
||||
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
|
||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
||||
|
@ -96,6 +100,8 @@ github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw
|
|||
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
|
||||
github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw=
|
||||
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
|
||||
github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg=
|
||||
github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
|
||||
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
|
||||
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
|
||||
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
|
||||
|
@ -142,6 +148,10 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
|||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU=
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo=
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4=
|
||||
github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 h1:jWpvCLoY8Z/e3VKvlsiIGKtc+UG6U5vzxaoagmhXfyg=
|
||||
github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0/go.mod h1:QUyp042oQthUoa9bqDv0ER0wrtXnBruoNd7aNjkbP+k=
|
||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
||||
|
@ -159,22 +169,62 @@ github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP
|
|||
github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0=
|
||||
github.com/prometheus/client_golang v1.12.1 h1:ZiaPsmm9uiBeaSMRznKsCDNtPCS0T3JVDGF+06gjBzk=
|
||||
github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY=
|
||||
github.com/prometheus/client_golang v1.14.0 h1:nJdhIvne2eSX/XRAFV9PcvFFRbrjbcTUj0VP62TMhnw=
|
||||
github.com/prometheus/client_golang v1.14.0/go.mod h1:8vpkKitgIVNcqrRBWh1C4TIUQgYNtG/XQE4E/Zae36Y=
|
||||
github.com/prometheus/client_golang v1.15.0 h1:5fCgGYogn0hFdhyhLbw7hEsWxufKtY9klyvdNfFlFhM=
|
||||
github.com/prometheus/client_golang v1.15.0/go.mod h1:e9yaBhRPU2pPNsZwE+JdQl0KEt1N9XgF6zxWmaC0xOk=
|
||||
github.com/prometheus/client_golang v1.15.1 h1:8tXpTmJbyH5lydzFPoxSIJ0J46jdh3tylbvM1xCv0LI=
|
||||
github.com/prometheus/client_golang v1.15.1/go.mod h1:e9yaBhRPU2pPNsZwE+JdQl0KEt1N9XgF6zxWmaC0xOk=
|
||||
github.com/prometheus/client_golang v1.16.0 h1:yk/hx9hDbrGHovbci4BY+pRMfSuuat626eFsHb7tmT8=
|
||||
github.com/prometheus/client_golang v1.16.0/go.mod h1:Zsulrv/L9oM40tJ7T815tM89lFEugiJ9HzIqaAx4LKc=
|
||||
github.com/prometheus/client_golang v1.17.0 h1:rl2sfwZMtSthVU752MqfjQozy7blglC+1SOtjMAMh+Q=
|
||||
github.com/prometheus/client_golang v1.17.0/go.mod h1:VeL+gMmOAxkS2IqfCq0ZmHSL+LjWfWDUmp1mBz9JgUY=
|
||||
github.com/prometheus/client_golang v1.18.0 h1:HzFfmkOzH5Q8L8G+kSJKUx5dtG87sewO+FoDDqP5Tbk=
|
||||
github.com/prometheus/client_golang v1.18.0/go.mod h1:T+GXkCk5wSJyOqMIzVgvvjFDlkOQntgjkJWKrN5txjA=
|
||||
github.com/prometheus/client_golang v1.19.0 h1:ygXvpU1AoN1MhdzckN+PyD9QJOSD4x7kmXYlnfbA6JU=
|
||||
github.com/prometheus/client_golang v1.19.0/go.mod h1:ZRM9uEAypZakd+q/x7+gmsvXdURP+DABIEIjnmDdp+k=
|
||||
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
|
||||
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
||||
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
||||
github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M=
|
||||
github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
||||
github.com/prometheus/client_model v0.3.0 h1:UBgGFHqYdG/TPFD1B1ogZywDqEkwp3fBMvqdiQ7Xew4=
|
||||
github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w=
|
||||
github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16 h1:v7DLqVdK4VrYkVD5diGdl4sxJurKJEMnODWRJlxV9oM=
|
||||
github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16/go.mod h1:oMQmHW1/JoDwqLtg57MGgP/Fb1CJEYF2imWWhWtMkYU=
|
||||
github.com/prometheus/client_model v0.5.0 h1:VQw1hfvPvk3Uv6Qf29VrPF32JB6rtbgI6cYPYQjL0Qw=
|
||||
github.com/prometheus/client_model v0.5.0/go.mod h1:dTiFglRmd66nLR9Pv9f0mZi7B7fk5Pm3gvsjB5tr+kI=
|
||||
github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
|
||||
github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo=
|
||||
github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc=
|
||||
github.com/prometheus/common v0.32.1 h1:hWIdL3N2HoUx3B8j3YN9mWor0qhY/NlEKZEaXxuIRh4=
|
||||
github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls=
|
||||
github.com/prometheus/common v0.37.0 h1:ccBbHCgIiT9uSoFY0vX8H3zsNR5eLt17/RQLUvn8pXE=
|
||||
github.com/prometheus/common v0.37.0/go.mod h1:phzohg0JFMnBEFGxTDbfu3QyL5GI8gTQJFhYO5B3mfA=
|
||||
github.com/prometheus/common v0.42.0 h1:EKsfXEYo4JpWMHH5cg+KOUWeuJSov1Id8zGR8eeI1YM=
|
||||
github.com/prometheus/common v0.42.0/go.mod h1:xBwqVerjNdUDjgODMpudtOMwlOwf2SaTr1yjz4b7Zbc=
|
||||
github.com/prometheus/common v0.44.0 h1:+5BrQJwiBB9xsMygAB3TNvpQKOwlkc25LbISbrdOOfY=
|
||||
github.com/prometheus/common v0.44.0/go.mod h1:ofAIvZbQ1e/nugmZGz4/qCb9Ap1VoSTIO7x0VV9VvuY=
|
||||
github.com/prometheus/common v0.45.0 h1:2BGz0eBc2hdMDLnO/8n0jeB3oPrt2D08CekT0lneoxM=
|
||||
github.com/prometheus/common v0.45.0/go.mod h1:YJmSTw9BoKxJplESWWxlbyttQR4uaEcGyv9MZjVOJsY=
|
||||
github.com/prometheus/common v0.48.0 h1:QO8U2CdOzSn1BBsmXJXduaaW+dY/5QLjfB8svtSzKKE=
|
||||
github.com/prometheus/common v0.48.0/go.mod h1:0/KsvlIEfPQCQ5I2iNSAWKPZziNCvRs5EC6ILDTlAPc=
|
||||
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
|
||||
github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
|
||||
github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU=
|
||||
github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA=
|
||||
github.com/prometheus/procfs v0.7.3 h1:4jVXhlkAyzOScmCkXBTOLRLTz8EeU+eyjrwB/EPq0VU=
|
||||
github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA=
|
||||
github.com/prometheus/procfs v0.8.0 h1:ODq8ZFEaYeCaZOJlZZdJA2AbQR98dSHSM1KW/You5mo=
|
||||
github.com/prometheus/procfs v0.8.0/go.mod h1:z7EfXMXOkbkqb9IINtpCn86r/to3BnA0uaxHdg830/4=
|
||||
github.com/prometheus/procfs v0.9.0 h1:wzCHvIvM5SxWqYvwgVL7yJY8Lz3PKn49KQtpgMYJfhI=
|
||||
github.com/prometheus/procfs v0.9.0/go.mod h1:+pB4zwohETzFnmlpe6yd2lSc+0/46IYZRB/chUwxUZY=
|
||||
github.com/prometheus/procfs v0.10.1 h1:kYK1Va/YMlutzCGazswoHKo//tZVlFpKYh+PymziUAg=
|
||||
github.com/prometheus/procfs v0.10.1/go.mod h1:nwNm2aOCAYw8uTR/9bWRREkZFxAUcWzPHWJq+XBB/FM=
|
||||
github.com/prometheus/procfs v0.11.1 h1:xRC8Iq1yyca5ypa9n1EZnWZkt7dwcoRPQwX/5gwaUuI=
|
||||
github.com/prometheus/procfs v0.11.1/go.mod h1:eesXgaPo1q7lBpVMoMy0ZOFTth9hBn4W/y0/p/ScXhY=
|
||||
github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo=
|
||||
github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo=
|
||||
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
|
||||
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
|
||||
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
|
||||
|
@ -257,12 +307,15 @@ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81R
|
|||
golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
||||
golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
||||
golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
|
||||
golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
|
||||
golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc=
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
|
@ -307,15 +360,31 @@ golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7w
|
|||
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220114195835-da31bd327af9 h1:XfKQ4OlFl8okEOr5UvAqFRVj8pY/4yfcXrddB8qAbU0=
|
||||
golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a h1:dGzPydgVsqGcTRVwiLJ1jVbufYwmzD3LfVPLKsKg+0k=
|
||||
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ=
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU=
|
||||
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM=
|
||||
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc=
|
||||
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU=
|
||||
golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
|
@ -440,6 +509,14 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba
|
|||
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
||||
google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk=
|
||||
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
||||
google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w=
|
||||
google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
||||
google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng=
|
||||
google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
||||
google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8=
|
||||
google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
||||
google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I=
|
||||
google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
|
||||
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
|
|
321
main.go
321
main.go
|
@ -15,7 +15,8 @@ import (
|
|||
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||
)
|
||||
|
||||
type Metrics struct {
|
||||
// original /api/telemetry type struct
|
||||
type MetricsV1 struct {
|
||||
TempNozzle int `json:"temp_nozzle"`
|
||||
TempBed int `json:"temp_bed"`
|
||||
Material string `json:"material"`
|
||||
|
@ -29,68 +30,135 @@ type Metrics struct {
|
|||
ProjectName string `json:"project_name"`
|
||||
}
|
||||
|
||||
// new 4.4.0+ /api/printer struct
|
||||
type MetricsV2 struct {
|
||||
Telemetry Telemetry `json:"telemetry"`
|
||||
Temperature Temperature `json:"temperature"`
|
||||
State State `json:"state"`
|
||||
}
|
||||
|
||||
type Telemetry struct {
|
||||
TempBed float64 `json:"temp-bed"`
|
||||
TempNozzle float64 `json:"temp-nozzle"`
|
||||
PrintSpeed int `json:"print-speed"`
|
||||
ZHeight float64 `json:"z-height"`
|
||||
Material string `json:"material"`
|
||||
}
|
||||
|
||||
type Temperature struct {
|
||||
Tool0 Tempatures `json:"tool0"`
|
||||
Bed Tempatures `json:"bed"`
|
||||
}
|
||||
|
||||
type Tempatures struct {
|
||||
Actual float64 `json:"actual"`
|
||||
Target float64 `json:"target"`
|
||||
Display float64 `json:"display"`
|
||||
Offset float64 `json:"offset"`
|
||||
}
|
||||
|
||||
type State struct {
|
||||
Text string `json:"text"`
|
||||
Flags Flags `json:"flags"`
|
||||
}
|
||||
|
||||
type Flags struct {
|
||||
Operational bool `json:"operational"`
|
||||
Paused bool `json:"paused"`
|
||||
Printing bool `json:"printing"`
|
||||
Cancelling bool `json:"cancelling"`
|
||||
Pausing bool `json:"pausing"`
|
||||
SdReady bool `json:"sdReady"`
|
||||
Error bool `json:"error"`
|
||||
ClosedOnError bool `json:"closedOnError"`
|
||||
Ready bool `json:"ready"`
|
||||
Busy bool `json:"busy"`
|
||||
}
|
||||
|
||||
// /api/job struct
|
||||
type JobV2 struct {
|
||||
State string `json:"state"`
|
||||
Job Job `json:"job"`
|
||||
Progress Progress `json:"progress"`
|
||||
}
|
||||
|
||||
type File struct {
|
||||
Name string `json:"name"`
|
||||
Path string `json:"path"`
|
||||
Display string `json:"display"`
|
||||
}
|
||||
|
||||
type Job struct {
|
||||
EstimatedPrintTime int `json:"estimatedPrintTime"`
|
||||
File File `json:"file"`
|
||||
}
|
||||
|
||||
type Progress struct {
|
||||
Completion float64 `json:"completion"`
|
||||
PrintTime int `json:"printTime"`
|
||||
PrintTimeLeft int `json:"printTimeLeft"`
|
||||
}
|
||||
|
||||
type Config struct {
|
||||
QueryHostname string
|
||||
QueryInterval int
|
||||
Port string
|
||||
Path string
|
||||
APIKey string
|
||||
}
|
||||
|
||||
var (
|
||||
opsFlowFactor = prometheus.NewGauge(prometheus.GaugeOpts{
|
||||
Namespace: "prusa_connect",
|
||||
Name: "flow_factor",
|
||||
Help: "Current flow factor, as a unitless number",
|
||||
})
|
||||
opsPrintSpeed = prometheus.NewGauge(prometheus.GaugeOpts{
|
||||
Namespace: "prusa_connect",
|
||||
Name: "printing_speed",
|
||||
Help: "Current print speed, as a percentage",
|
||||
})
|
||||
opsZPosition = prometheus.NewGauge(prometheus.GaugeOpts{
|
||||
Namespace: "prusa_connect",
|
||||
Name: "z_position",
|
||||
Help: "Vertical depth, in mm, of the Z head",
|
||||
})
|
||||
opsBed = prometheus.NewGauge(prometheus.GaugeOpts{
|
||||
Namespace: "prusa_connect",
|
||||
Name: "temp_bed",
|
||||
Help: "Temperature, in celsius, of the print bed",
|
||||
})
|
||||
opsNozzle = prometheus.NewGauge(prometheus.GaugeOpts{
|
||||
Namespace: "prusa_connect",
|
||||
Name: "temp_nozzle",
|
||||
Help: "Temperature, in celsius, of the print nozzle",
|
||||
})
|
||||
opsProgress = prometheus.NewGauge(prometheus.GaugeOpts{
|
||||
Namespace: "prusa_connect",
|
||||
Name: "progress",
|
||||
Help: "Current print completeness, as a percentage",
|
||||
})
|
||||
opsDuration = prometheus.NewGauge(prometheus.GaugeOpts{
|
||||
Namespace: "prusa_connect",
|
||||
Name: "duration",
|
||||
Help: "Duration of current print job, as seconds since start",
|
||||
})
|
||||
opsRemaining = prometheus.NewGauge(prometheus.GaugeOpts{
|
||||
Namespace: "prusa_connect",
|
||||
Name: "remaining",
|
||||
Help: "Estimated remaining time of current print job, as seconds",
|
||||
})
|
||||
errCount = 0
|
||||
gauges = map[string]prometheus.Gauge{
|
||||
"flow_factor": prometheus.NewGauge(prometheus.GaugeOpts{
|
||||
Namespace: "prusa_connect",
|
||||
Name: "flow_factor",
|
||||
Help: "Current flow factor, as a unitless number",
|
||||
}),
|
||||
"printing_speed": prometheus.NewGauge(prometheus.GaugeOpts{
|
||||
Namespace: "prusa_connect",
|
||||
Name: "printing_speed",
|
||||
Help: "Current print speed, as a percentage",
|
||||
}),
|
||||
"z_position": prometheus.NewGauge(prometheus.GaugeOpts{
|
||||
Namespace: "prusa_connect",
|
||||
Name: "z_position",
|
||||
Help: "Vertical depth, in mm, of the Z head",
|
||||
}),
|
||||
"temp_bed": prometheus.NewGauge(prometheus.GaugeOpts{
|
||||
Namespace: "prusa_connect",
|
||||
Name: "temp_bed",
|
||||
Help: "Temperature, in celsius, of the print bed",
|
||||
}),
|
||||
"temp_nozzle": prometheus.NewGauge(prometheus.GaugeOpts{
|
||||
Namespace: "prusa_connect",
|
||||
Name: "temp_nozzle",
|
||||
Help: "Temperature, in celsius, of the print nozzle",
|
||||
}),
|
||||
"progress": prometheus.NewGauge(prometheus.GaugeOpts{
|
||||
Namespace: "prusa_connect",
|
||||
Name: "progress",
|
||||
Help: "Current print completeness, as a percentage",
|
||||
}),
|
||||
"duration": prometheus.NewGauge(prometheus.GaugeOpts{
|
||||
Namespace: "prusa_connect",
|
||||
Name: "duration",
|
||||
Help: "Duration of current print job, as seconds since start",
|
||||
}),
|
||||
"remaining": prometheus.NewGauge(prometheus.GaugeOpts{
|
||||
Namespace: "prusa_connect",
|
||||
Name: "remaining",
|
||||
Help: "Estimated remaining time of current print job, as seconds",
|
||||
}),
|
||||
}
|
||||
)
|
||||
|
||||
func errLog(err error) {
|
||||
errCount++
|
||||
// reset metrics
|
||||
opsFlowFactor.Set(0)
|
||||
opsPrintSpeed.Set(0)
|
||||
opsZPosition.Set(0)
|
||||
opsBed.Set(0)
|
||||
opsNozzle.Set(0)
|
||||
opsProgress.Set(0)
|
||||
opsDuration.Set(0)
|
||||
opsRemaining.Set(0)
|
||||
for _, g := range gauges {
|
||||
g.Set(0)
|
||||
}
|
||||
if errCount == 5 {
|
||||
log.Printf("suppressing further error logging")
|
||||
return
|
||||
|
@ -109,42 +177,124 @@ func recordMetrics(ctx context.Context, config Config) {
|
|||
return
|
||||
default:
|
||||
time.Sleep(time.Second * time.Duration(config.QueryInterval))
|
||||
res, err := http.Get(config.QueryHostname + "/api/telemetry")
|
||||
if err != nil {
|
||||
errLog(err)
|
||||
if config.APIKey == "" {
|
||||
parseMetricsV1(ctx, config)
|
||||
break
|
||||
}
|
||||
b, err := io.ReadAll(res.Body)
|
||||
if err != nil {
|
||||
errLog(err)
|
||||
break
|
||||
}
|
||||
t := &Metrics{}
|
||||
err = json.Unmarshal(b, t)
|
||||
if err != nil {
|
||||
errLog(err)
|
||||
break
|
||||
}
|
||||
if errCount != 0 {
|
||||
log.Printf("connection established")
|
||||
}
|
||||
errCount = 0
|
||||
opsFlowFactor.Set(float64(t.FlowFactor))
|
||||
opsPrintSpeed.Set(float64(t.PrintingSpeed))
|
||||
opsZPosition.Set(t.ZPosition)
|
||||
opsBed.Set(float64(t.TempBed))
|
||||
opsNozzle.Set(float64(t.TempNozzle))
|
||||
opsProgress.Set(float64(t.Progress))
|
||||
opsDuration.Set(float64(parseDuration(t.PrintDur) / time.Second))
|
||||
estimatedTimeRemaining, err := strconv.ParseFloat(t.TimeEst, 64)
|
||||
if err == nil {
|
||||
opsRemaining.Set(float64(estimatedTimeRemaining))
|
||||
}
|
||||
parseMetricsV2(ctx, config)
|
||||
}
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
func parseMetricsV1(ctx context.Context, config Config) {
|
||||
t, err := getTelemetry(config.QueryHostname)
|
||||
if err != nil {
|
||||
errLog(err)
|
||||
return
|
||||
}
|
||||
if errCount != 0 {
|
||||
errCount = 0
|
||||
log.Printf("connection established")
|
||||
}
|
||||
gauges["flow_factor"].Set(float64(t.FlowFactor))
|
||||
gauges["printing_speed"].Set(float64(t.PrintingSpeed))
|
||||
gauges["z_position"].Set(t.ZPosition)
|
||||
gauges["temp_bed"].Set(float64(t.TempBed))
|
||||
gauges["temp_nozzle"].Set(float64(t.TempNozzle))
|
||||
gauges["progress"].Set(float64(t.Progress))
|
||||
gauges["duration"].Set(float64(parseDuration(t.PrintDur) / time.Second))
|
||||
estimatedTimeRemaining, err := strconv.ParseFloat(t.TimeEst, 64)
|
||||
if err == nil {
|
||||
gauges["remaining"].Set(float64(estimatedTimeRemaining))
|
||||
}
|
||||
}
|
||||
|
||||
func parseMetricsV2(ctx context.Context, config Config) {
|
||||
t, err := getPrinter(config.Port, config.APIKey)
|
||||
if err != nil {
|
||||
errLog(err)
|
||||
return
|
||||
}
|
||||
j, err := getJob(config.Port, config.APIKey)
|
||||
if err != nil {
|
||||
errLog(err)
|
||||
return
|
||||
}
|
||||
if errCount != 0 {
|
||||
errCount = 0
|
||||
log.Printf("connection established")
|
||||
}
|
||||
gauges["printing_speed"].Set(float64(t.Telemetry.PrintSpeed))
|
||||
gauges["z_position"].Set(t.Telemetry.ZHeight)
|
||||
gauges["temp_bed"].Set(float64(t.Telemetry.TempBed))
|
||||
gauges["temp_nozzle"].Set(float64(t.Telemetry.TempNozzle))
|
||||
gauges["progress"].Set(float64(j.Progress.Completion) * 100)
|
||||
gauges["duration"].Set(float64(j.Progress.PrintTime))
|
||||
gauges["remaining"].Set(float64(j.Progress.PrintTimeLeft))
|
||||
}
|
||||
|
||||
func getJob(hostname, apiKey string) (*JobV2, error) {
|
||||
r, err := http.NewRequest(http.MethodGet, hostname+"/api/job", nil)
|
||||
if err != nil {
|
||||
return &JobV2{}, err
|
||||
}
|
||||
r.Header.Set("X-Api-Key", apiKey)
|
||||
res, err := http.DefaultClient.Do(r)
|
||||
if err != nil {
|
||||
return &JobV2{}, err
|
||||
}
|
||||
b, err := io.ReadAll(res.Body)
|
||||
if err != nil {
|
||||
return &JobV2{}, err
|
||||
}
|
||||
j := &JobV2{}
|
||||
err = json.Unmarshal(b, j)
|
||||
if err != nil {
|
||||
return &JobV2{}, err
|
||||
}
|
||||
return j, nil
|
||||
}
|
||||
|
||||
func getPrinter(hostname, apiKey string) (*MetricsV2, error) {
|
||||
r, err := http.NewRequest(http.MethodGet, hostname+"/api/printer", nil)
|
||||
if err != nil {
|
||||
return &MetricsV2{}, err
|
||||
}
|
||||
r.Header.Set("X-Api-Key", apiKey)
|
||||
res, err := http.DefaultClient.Do(r)
|
||||
if err != nil {
|
||||
return &MetricsV2{}, err
|
||||
}
|
||||
b, err := io.ReadAll(res.Body)
|
||||
if err != nil {
|
||||
return &MetricsV2{}, err
|
||||
}
|
||||
j := &MetricsV2{}
|
||||
err = json.Unmarshal(b, j)
|
||||
if err != nil {
|
||||
return &MetricsV2{}, err
|
||||
}
|
||||
return j, nil
|
||||
}
|
||||
|
||||
func getTelemetry(hostname string) (*MetricsV1, error) {
|
||||
res, err := http.Get(hostname + "/api/telemetry")
|
||||
if err != nil {
|
||||
return &MetricsV1{}, err
|
||||
}
|
||||
b, err := io.ReadAll(res.Body)
|
||||
if err != nil {
|
||||
return &MetricsV1{}, err
|
||||
}
|
||||
t := &MetricsV1{}
|
||||
err = json.Unmarshal(b, t)
|
||||
if err != nil {
|
||||
return &MetricsV1{}, err
|
||||
}
|
||||
return t, nil
|
||||
}
|
||||
|
||||
// taking a guess on proper parsing here...
|
||||
func parseDuration(d string) time.Duration {
|
||||
dur := 0
|
||||
|
@ -187,6 +337,8 @@ func main() {
|
|||
flag.StringVar(&port, "port", "2112", "Local port to export metrics on")
|
||||
var path string
|
||||
flag.StringVar(&path, "path", "metrics", "Local path to export metrics on")
|
||||
var apiKey string
|
||||
flag.StringVar(&apiKey, "apikey", "", "Prusa Connect API key (see Main Menu -> Settings -> Network on the printer)")
|
||||
flag.Parse()
|
||||
|
||||
if queryInterval < 1 {
|
||||
|
@ -198,18 +350,13 @@ func main() {
|
|||
QueryInterval: queryInterval,
|
||||
Port: port,
|
||||
Path: path,
|
||||
APIKey: apiKey,
|
||||
}
|
||||
|
||||
r := prometheus.NewRegistry()
|
||||
r.MustRegister(opsNozzle)
|
||||
r.MustRegister(opsBed)
|
||||
r.MustRegister(opsZPosition)
|
||||
r.MustRegister(opsPrintSpeed)
|
||||
r.MustRegister(opsFlowFactor)
|
||||
r.MustRegister(opsProgress)
|
||||
r.MustRegister(opsDuration)
|
||||
r.MustRegister(opsRemaining)
|
||||
|
||||
for _, g := range gauges {
|
||||
r.MustRegister(g)
|
||||
}
|
||||
recordMetrics(context.Background(), config)
|
||||
|
||||
log.Printf("starting exporter on :%v", config.Port)
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json"
|
||||
}
|
Loading…
Reference in New Issue