Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Add new parameters for requestData

...

 The request structure is not simple. The required inputs are resource, dataset, possibly index.  

Required Parameters

Parameters  
{  
 requestData (struct)
modelstring"nmis_rrd" or "nmis_graph". nmis_rrd will provide data directly as it is in the RRD files. nmis_graph will provide data after running it through the manipulations done by the NMIS graph
model_viewstring"graph", no other options supported at this time
data_sourcestring"local_nmis", no other options supported at this time
optionsstruct* can be empty for now, so just {}
parametersstruct
start_date_rawnumberunix time for data to start
end_date_rawnumberunix time for data to end
nodestringnode name, found using GET node
graph_typestring

If using nmis_rrd: maps to a resource found using Get Node Resources (value attribute, which is the ID).

If using nmis_graph: maps to the name of the graph if not indexed, maps to the same as nmis_rrd if indexed

fieldstringOnly used for nmis_rrd: maps to the dataset required found using GET node resource datasets (value attribute of desired dataset)
resource_indexstring/numberIf the resource is indexed, the index of the resource required, found using GET node resource indexes
index_graph_typestring

Only used if the resource is indexed:

 nmis_rrd: same as graph_type

nmis_graph: the name of the graph

axisnumber0 or 1, the axis the dataset will group itself into, usually 0
}  
     
requestData{   
 model_view  "graph", no other options supported at this time
 parameters{ #holds general parameters that might be used to gather several datasets for the same graph
  time_period "specific_time" or "time_difference. When specific_time is specified the times are used as-is. When time_difference is specified, the times given are subtracted, that period is then applied to the current time being the stop_date and start_date = current_time - period
  start_date Any parse-able date, eg "16-May-2014 09:24:56", usage specified by time_period
  end_date Any parse-able date, eg "23-May-2014 09:24:56", usage specified by time_period
  }  
 options{}  
 dataset{  
  name can be anything, unused but will be returned back in the response
  type "nmis_rrd" or "nmis_graph". nmis_rrd will provide data directly as it is in the RRD files. nmis_graph will provide data after running it through the manipulations done by the NMIS graph
  data_source Normally "local_nmis". Can also be other MySQL datasource if configured, then the name property of the data_source that is required.
  parameters{ 
   nodemaps to a node found using GET node
   graph_type

nmis_rrd: maps to a resource found using Get Node Resources (value attribute, which is the ID)

nmis_graph: maps to the name of the graph if not indexed, maps to the same as nmis_rrd if indexed

   resource_indexIf the resource is indexed, the index of the resource required
   index_graph_type

Only used if the resource is indexed:

 nmis_rrd:

nmis_graph: the name of the graph

   fieldOnly used for nmis_rrd: maps to the dataset required found using GET node resource datasets (value attribute of desired dataset)
   axis0 or 1, the axis the dataset will group itself into, usually 0
   } 
  options{ 
   datasetTitleThe title the dataset will return with itself
   } 
  }  
 }   

Request  Example

Code Block
"requestData": {
  "parametersrequestData": {
    "time_periodmodel": "timenmis_differencerrd",
    "endmodel_dateview": "23-May-2014 11:54:20graph",
    "start_date": "16-May-2014 11:54:20"
  },
  "options": {},
  "dataset": {
data_source": "local_nmis",
    "parameters": {      
      "start_date_raw": 1401346748,
      "parametersend_date_raw": {1401951548,
      "node": "asgard",
      "graph_type": "nmis_rrdnodehealth",
      "graph_typefield": "nodehealthavgBusy5",
      "resource_index": "",      
      "index_graph_type": "",
      "fieldaxis": "avgBusy10",
      "axis": "0"
    },
    "nameoptions": "auto_generated",
{     "type": "nmis_rrd"
    },   
  "model_view": "graph"}
}

Successful Response

A successful response will be a hash with 2 objects.  The requestObject that was submitted along with a responseObject : 

Code Block
{
  "requestData": {
    ... <snip, same as above >...
  },
  "replyData": {
    "options": {
      "subtitleText": null,
      "titleText": null,
      "yAxis1TitleText": null,
      "plotBands": [],
      "yAxis0TitleText": null
    },
    "min": null,
    "stacking": null,
    "max": null,
    "meta_data": {
      "time_start": 1400206204,
      "start_date_input": "2014-05-16 12:10:04",
      "end_date_input": "2014-05-23 12:10:04"
    },
    "data": [
      {
        "yAxis": 0,
        "color": null,
        "stack": null,
        "name": "avgBusy1avgBusy5",
        "type": null,
        "data": [
          [
            1400206500000,
            null
          ],
          [
            1400206800000,
            null
          ],
          [
            1400571000000,
            6
          ],
          [
            1400571300000,
            6.99308580333333
          ],
          [
            1400571600000,
            9.98057514
          ],
          [
            1400571900000,
            8.00908836666667
          ],
          [
            1400572200000,
            6.01230244666667
          ],
          [
            1400572500000,
            3.02188843
          ],
          [
            1400572800000,
            2.00550849666667
          ],
        ]
      }
    ]
  }
}

...