warpex v1.1.8 Warpex
Documentation for Warpex.
Usage
Add it to your applications and dependencies in mix.exs
:
def application do
[applications: [:warpex]]
end
def deps do
[{:warpex, "~> 1.1"}]
end
Configure it in config.exs
:
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 []
Link to this section Summary
Link to this section Functions
Link to this function
exec_warpscript(script)
Execute warpcript
Returns {:ok, result} or {:error, :result}.
Link to this function
fetch(selector, start, stop)
Fetch data
Returns {:ok, result} or {:error, :result}.
Examples
#iex> Warpex.fetch("~metric.1.*{}", Datetime.now, Datetime.now)
{:ok, []}
Link to this function
get_token(key_type)
Link to this function
parse_result(data)
Parse a Warp10 result
Returns {:ok, result} or {:error, :result}.
Examples
#iex> Warpex.parse_result("1521141618754000// metric.1.memory_available{host=1,.app=appName} 768209")
#[%{"ts"=> 1521141618754000, "latlon" => "", "elev" => "", "name" => "metric.1.memory_available", "labels" => %{"host" => "1", ".app" => "appName"}, "value" => "768209" }]
Link to this function
update(data)
Save a list of data
Returns {:ok, []} or {:error, :result}.
Examples
#iex> Warpex.update([%{"labels" => "label1=anything", "name" => "metric.1.memory_available", "val" => 12, "ts" => 1521969018754000}])
{:ok, []}