forked from jasonacox/Powerwall-Dashboard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
telegraf.local.sample
50 lines (48 loc) · 1.78 KB
/
telegraf.local.sample
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
# Sample file for local telegraf configurations.
# Most users will not need to use this, but it can be used for development
# or monitoring non standard measurement data.
#
# The local configuration file should be named "telegraf.local".
# Upgrade.sh does not modify this file.
#
# The following sample adds some power and energy data from the solar meter
# as a measurement called "solarmeter" (used in a three phase monitoring example)
#[[inputs.http]]
# urls = [
# "http://pypowerwall:8675/api/meters/solar"
# ]
# name_override = "solarmeter"
# method = "GET"
# insecure_skip_verify = true
# timeout = "4s"
# data_format = "json"
# json_query = "0.Cached_readings"
# fieldpass = ["instant_power", "real_power_?", "energy_??ported"]
# Example starlark processor using to rewrite alert data to new_alert (1) and
# remember alerts even if they disappear (0) - see Issue #158
#
# [[processors.starlark]]
# source = '''
# state = {
# "last": {}
# }
# def dict_union(x, y):
# z = {}
# z.update(x)
# z.update(y)
# return z
# def apply(metric):
# url = metric.tags.get("url")
# last = state["last"]
# if url and url == "http://pypowerwall:8675/alerts/pw":
# base = {x: 0 for x in metric.fields.keys()} #For updating existing total key set
# current = {x: 1 for x in metric.fields.keys()} #Currently flagging keys
# result = dict_union(last,current)
# state["last"] = dict_union(last, base)
# new_metric = Metric("all_alerts")
# for k, v in result.items():
# new_metric.fields[str(k)] = v
# return new_metric
# else:
# return metric
# '''