Skip to content

Instantly share code, notes, and snippets.

@serpent213
Created March 20, 2021 11:29
Show Gist options
  • Save serpent213/cd556f9c0ed5894785e0f736408f845e to your computer and use it in GitHub Desktop.
Save serpent213/cd556f9c0ed5894785e0f736408f845e to your computer and use it in GitHub Desktop.
Chia farming rewards in Telegraf/InfluxDB/Chronograf
from(bucket: "SpaceBucket")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "chia_farmed_amount")
|> filter(fn: (r) => r["_field"] == "farmed_amount")
|> map(fn: (r) => ({
r with
_value: r._value / 1000000000000.0
})
)
|> aggregateWindow(every: v.windowPeriod, fn: last, createEmpty: false)
|> yield(name: "last")
[[inputs.http]]
name_override = "chia_farmed_amount"
## One or more URLs from which to read formatted metrics
urls = [
"https://localhost:9256/get_farmed_amount"
]
## HTTP method
method = "POST"
## Optional HTTP headers
headers = {"Content-Type" = "application/json"}
## HTTP entity-body to send with POST/PUT requests.
body = "{}"
## HTTP Proxy support
# http_proxy_url = ""
## Optional TLS Config
# tls_ca = "/etc/telegraf/ca.pem"
tls_cert = "/etc/telegraf/ssl/wallet/private_wallet.crt"
tls_key = "/etc/telegraf/ssl/wallet/private_wallet.key"
## Use TLS but skip chain & host verification
insecure_skip_verify = true
## Amount of time allowed to complete the HTTP request
# timeout = "5s"
## List of success status codes
# success_status_codes = [200]
## Data format to consume.
data_format = "json"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment