https://github.com/derniercri/warpex
Warp10 client for Elixir
https://github.com/derniercri/warpex
elixir iot timeseries warp10
Last synced: about 1 year ago
JSON representation
Warp10 client for Elixir
- Host: GitHub
- URL: https://github.com/derniercri/warpex
- Owner: derniercri
- Created: 2018-03-25T01:23:36.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2020-09-14T14:43:42.000Z (almost 6 years ago)
- Last Synced: 2025-03-24T14:13:31.798Z (about 1 year ago)
- Topics: elixir, iot, timeseries, warp10
- Language: Elixir
- Homepage:
- Size: 27.3 KB
- Stars: 9
- Watchers: 5
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# Warpex
[](https://travis-ci.org/derniercri/warpex)
Warpex is a Warp10 client for Elixir.
## Usage
Add it to your applications and dependencies in `mix.exs`:
```elixir
def application do
[applications: [:warpex]]
end
def deps do
[{:warpex, "~> 1.2"}]
end
```
Configure it in `config.exs`:
```elixir
config :warpex,
address: "http://localhost", # defaults to System.get_env("WARP10_ADDRESS"),
read_key: "xxxxx", # defaults to System.get_env("WARP10_READ_KEY")
write_key: "xxxxx", # defaults to System.get_env("WARP10_WRITE_KEY")
httpoison_opts: [timeout: 5000] # defaults to []
```
And then call functions like:
```elixir
{status, response} = Warpex.update(
[%{
"labels" => "label1=anything,label2=anotherthing",
"latlon" => "50.683299992233515:2.8832999244332314",
"elev" => "214748",
"name" => "metric.1.memory_available",
"val" => 12,
"ts" => 1521969018754000
}])
```
```elixir
"'#{Warpex.get_token(:read)}' // Put your token on the stack
'token' STORE // Store it in a variable
[ $token '~sensor.#{sensor.id}.*' { } #{start} #{delta} ] FETCH
[ SWAP bucketizer.mean 0 0 1 ] BUCKETIZE"
|> Warpex.exec_warpscript()
```
```elixir
{status, response} = Warpex.fetch("~metric.1.*{}", start, stop)
```
`status` is either `:ok` or `:error`.
`response` is the raw response from Warp10 as text