https://github.com/mrmarble/pvpc-telegraf-plugin
Telegraf input plugin to fetch PVPC prices
https://github.com/mrmarble/pvpc-telegraf-plugin
electricity influxdb pvpc spain telegraf telegraf-plugin
Last synced: about 6 hours ago
JSON representation
Telegraf input plugin to fetch PVPC prices
- Host: GitHub
- URL: https://github.com/mrmarble/pvpc-telegraf-plugin
- Owner: MrMarble
- License: mit
- Created: 2021-12-26T00:28:39.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2023-03-07T03:12:28.000Z (over 2 years ago)
- Last Synced: 2025-03-11T03:44:53.105Z (7 months ago)
- Topics: electricity, influxdb, pvpc, spain, telegraf, telegraf-plugin
- Language: Go
- Homepage:
- Size: 7.84 MB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PVPC Telegraf Plugin
[](https://github.com/MrMarble/pvpc-telegraf-plugin/actions/workflows/lint.yml)
Gather Spanish electricity hourly prices from https://www.ree.es/es/apidatos.
## Build and Run
To build this plugin, just run (go environment needed, at least 1.17):
```
make
```Which will build the binary ./bin/pvpc
You can run it with `./bin/pvpc --config plugin.conf`
## Configuration
```toml
[[inputs.Pvpc]]
## Defines the time aggregation of the requested data.
time_trunc = "hour"## Time range.
## If omitted, today's price is obtained.
## Defines the starting date in ISO 8601 format.
#start_date="2021-12-26T00:00:00Z"
## Defines the ending date in ISO 8601 format.
#end_date="2021-12-26T23:59:00Z"## Id of the autonomous community/electrical system. Optional
geo_id = 8741
## Http request timeout.
http_timeout="10s"```
Once compiled and configured, you could add the plugin to Telegraf adding this configuration:
```toml
[[inputs.execd]]
## One program to run as daemon.
## NOTE: process and each argument should each be their own string
command = ["/path/to/pvpc", "--config", "/path/to/plugin.conf"]## Define how the process is signaled on each collection interval.
## Valid values are:
## "none" : Do not signal anything. (Recommended for service inputs)
## The process must output metrics by itself.
## "STDIN" : Send a newline on STDIN. (Recommended for gather inputs)
## "SIGHUP" : Send a HUP signal. Not available on Windows. (not recommended)
## "SIGUSR1" : Send a USR1 signal. Not available on Windows.
## "SIGUSR2" : Send a USR2 signal. Not available on Windows.
signal = "none"## Delay before the process is restarted after an unexpected termination
restart_delay = "10s"## Data format to consume.
## Each data format has its own unique set of configuration options, read
## more about them here:
## https://github.com/influxdata/telegraf/blob/master/docs/DATA_FORMATS_INPUT.md
data_format = "influx"
# Set interval to 24h
interval = "24h"
```## Metrics
- pvpc
- tags:
- geo_id (uin32)
- fields:
- value (float64)## Example Output
```
pvpc,geo_id=8741 value=291.07 1575008500000000000
pvpc,geo_id=8741 value=196.58 1575008500000000000
```