GradientOne supports rich interactions between instruments and cloud databases. These include industry standard protocols such as SCPI, VISA, and VXI11. Data derived from the frequency of instrument's interaction with the database as well as information in the embedded operating system support a range of utilization estimates. This utilization data is presented to the user with automated reporting using bar graphs, pie charts, and other trend data. For the cases where customers have custom applications they need to use in conjunction with utilization data, GradientOne provides users with an API or downloadable CSVs to get access to data in its more raw form. This blog post will walk you through how to use the API to run custom queries for utilization data and generate CSV and JSON files containing the data. Step 1: Download Configuration File First, download your configuration file. The configuration file manages the authentication and access details to perform queries. The name of the file must be: "GradientOneConfig.txt" The file includes the following:
Example GradientOneAuthConfig.txt
Step 2: Download the sample API script The GradientOne API offers a wide range of capabilities for uploading and downloading instrument usage data. We've generated an example program written in Python you can execute. Step 3: Run the API query For this example, I will run a query against https://examples.gradientone.com to obtain a days worth of utilization data for an oscilloscope in the GradientOne lab. Its asset_id is GradientOne_Keysight_600MHZ. The time arguments are in UTC. You will need to adjust accordingly for your time zone. I am running this program from the Pacific time zone, so a full day would be from 07:00 to 07:00. The query requires these arguments: asset_id -- the unique identifier string of the asset of interest (GradientOne_Keysight_600MHZ) start_date -- start date of the query (2019-07-17) start_time -- start time of the query (07:00) end_date -- end date of the query (2019-07-18) end_time -- end time of the query (07:00) mode -- query GradientOne API for minute or hourly summaries (hours or minutes) > python utilizationInfo.py GradientOne_Keysight_600MHZ 2019-07-17 07:00 2019-07-18 07:00 hours <Response [200]> The Response [200] means that the query was completed successfully. The data are available in the JSON and CSV files: GradientOne_Keysight_600MHZ_avg_CPU.json GradientOne_Keysight_600MHZ_avg_CPU.csv This returns 24 hours worth of data. Below is an example hour, which would be available in the .json file. Interesting takeaways are:
Example hour:
This script also generates a CSV file. This shows the average CPU for a given hour and how many minutes the instrument was online during that hour. It contains the below information: Example CSV file
Example Python Script
If you'd like to see how this works in your environment, start your free trial today by clicking on the below link.
0 Comments
Leave a Reply. |