22
33This is a [ Grafana] ( https://grafana.com/grafana/ )  data source plugin that supports direct communication with a
44[ Project Haystack API Server] ( https://project-haystack.org/doc/docHaystack/HttpApi ) . It handles authentication
5- and supports standard Haystack API operations as well as custom Axon execution, which is supported by
6- [ SkySpark] ( https://skyfoundry.com/product )  and [ Haxall] ( https://haxall.io/ ) .
5+ and supports standard Haystack API operations as well as custom Axon execution.
6+ 
7+ Some popular servers with Haystack APIs are:
8+ 
9+ -  [ SkySpark] ( https://skyfoundry.com/product ) 
10+ -  [ Tridium Niagara] ( https://www.tridium.com/us/en/Products/niagara )  (via [ NHaystack] ( https://github.com/ci-richard-mcelhinney/nhaystack ) )
11+ -  [ Siemens Desigo Optic] ( https://www.siemens.com/us/en/products/buildingtechnologies/automation/desigo-optic.html ) 
12+ -  [ Fin Framework] ( https://www.j2inn.com/finframework ) 
13+ -  [ Haxall] ( https://haxall.io/ ) 
14+ -  [ WideSky Cloud] ( https://widesky.cloud/products/widesky-cloud/ ) 
715
816## Usage  
917
1018### Create a Data Source  
1119
12- To create a new data source, select ` Data Sources `  from the Configuration menu represented by the gear icon on the left
13- panel. Click ` Add Data Source ` , and then select ` Haystack `  from the list. Next, fill in the name of the data source,
14- the API URL, and the credentials to use to access the data. It is typically a good idea to create a dedicated user
15- to access the data. Once complete, select ` Save & Test ` . If you get a green check mark, the connection was successful!
20+ Follow the [ Grafana instructions] ( https://grafana.com/docs/grafana/latest/administration/data-source-management/#add-a-data-source ) 
21+ to create a new Haystack datasource. Next, fill in the required information:
22+ 
23+ -  The name of the data source.
24+ -  The root Haystack API URL. The URLs for some popular Haystack servers are listed below:
25+   -  SkySpark: ` http://<host>/api/<proj>/ ` 
26+   -  Haxall: ` http://<host>/api/ ` 
27+   -  NHaystack: ` http://<host>/ ` 
28+ -  The username and password. It is best practice to create a dedicated user for the Grafana integration.
29+ 
30+ Once complete, select ` Save & Test ` . If you get a green check mark, the connection was successful!
1631
1732### Query Data  
1833
19- To query data from the data source, create a new panel in a  dashboard. If you do not have any  dashboards yet,  create
20- one by selecting  ` + New Dashboard `  from the Dashboard menu in the left  panel.
34+ To query data from the data source, [ create a dashboard] ( https://grafana.com/docs/grafana/latest/ dashboards/build-dashboards/ create-dashboard/ ) 
35+ and add a new  panel.
2136
22- Once within the panel editor, select  your Haystack data source in the Data Sources menu. Next, select the type of
23- Haystack query that should be performed. The supported queries  are:
37+ Select  your Haystack data source in the Data Sources menu. Next, select the type of Haystack query that should be 
38+ performed (only queries supported by your data source  are shown) :
2439
2540-  Eval: Evaluate a free-form Axon expression. _ Note: Not all Haystack servers support this functionality_ 
2641-  HisRead: Display the history of a single point over the selected time range.
@@ -30,9 +45,11 @@ Haystack query that should be performed. The supported queries are:
3045
3146#### Variable Usage  
3247
33- Grafana template variables can be injected into queries using the ordinary syntax, e.g. ` $varName ` .
48+ [ Grafana variables] ( https://grafana.com/docs/grafana/latest/dashboards/variables/ )  can be injected into Haystack queries
49+ using the [ ordinary syntax] ( https://grafana.com/docs/grafana/latest/dashboards/variables/variable-syntax/ ) ,
50+ e.g. ` $varName ` .
3451
35- We also support injecting  a few special variables from the time-range selector into the Eval and Read requests :
52+ We also support a few special variables from the selected  time-range:
3653
3754-  ` $__timeRange_start ` : DateTime start of the selected Grafana time range
3855-  ` $__timeRange_end ` : DateTime end of the selected Grafana time range
@@ -43,13 +60,13 @@ We also support injecting a few special variables from the time-range selector i
4360To use them, simply enter the value in the input string. Below is an example of using the variables in an Eval query:
4461
4562``` 
46- > [{ts:  $__timeRange_start, v0: 0}, {ts:  $__timeRange_end, v0: 10}].toGrid  
63+ > read(temp).hisRead( $__timeRange_start.. $__timeRange_end).hisInterpolate()  
4764``` 
4865
4966### Query Variables  
5067
51- You can use the Haystack connector to source variables. Create a query and then enter the column that contains  the
52- variable values. If no column is specified, the first one is used.
68+ You can use the Haystack connector to source new  variables. Create a query and then enter the name of  the column that 
69+ contains the  variable values. If no column is specified, the first one is used.
5370
5471The value injected by the variable exactly matches the displayed value, with the exception of Ref types, where the
5572injected value is only the ID portion (i.e. the dis name is not included in the interpolation). Multiple-select values
0 commit comments