There are many OpenSource data sources that emerge everyday. One such data source is InfluxDB Their tag line is “We build cool stuff for developers who build cool stuff”. I happen to think that JMP is “cool stuff” but the question remains, “How can you integrate JMP’s ‘cool stuff’ with InfluxDB’s ‘cool stuff’”.
Luckily, there are 2 specific cool stuffs that can make this happen. The first is that InfluxDB publishes a well-documented way to get started and most importantly, a REST interface. The second is that JMP has a JSL object known as HTTP Request.
Needless to say I’m more familiar with HTTP Request than InfluxDB’s FluxQL language so for the most part, I focused on the posted examples with sample data.
To begin, I installed InfluxDB using HomeBrew and then using InfluxDB’s DataExplorer, I created
I created a Bucket and uploaded data.
I then had to navigate to the API Tokens page in order to create an API Token I can use with the REST communication.
And navigate to the Organization page for the org_id
Finally, I was able to get JMP and InfluxDB chatting with JSL.
And this JSL snippet was really all it needed.
It is worth noting that line 24 is
Using Blob allows me to set the content type to
This is what the InfluxDB is looking for. Using Blob allows me to set a content type to pretty much anything, whereas using Text, JSON, or XML will set the appropriate content type or allow you to only set compatible content types.
In the complete script, there is a flux variable that points to the FluxQL that I want to send to the server. Beware not all scripts generated in InfluxDB’s DataExplorer web app will execute without some modifications. A quick trip to the internet with your favorite search engine will help remedy errors.
And finally, I tacked on a GraphBuilder script since in JMP, for every data table there is a graph.
Have fun.
Thanks!