Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Required Parameters

Parameter
     
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
  parametersdata_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

...

 

Request  Example

requestData = JSON( { "model_view": "graph", "dataset": { "data_source": "local_nmis",
Code Block
Code Block
"requestData": {
  "parameters": {
    "time_period": "time_difference",
    "end_date": "23-May-2014 11:54:20",
    "start_date": "16-May-2014 11:54:20"
  },
  "options": {},
  "dataset": {
    "parameters": {
      "typenode" : "nmis_rrdasgard",
      "resource_index"type": "2nmis_rrd",
      "graph_type": "interfacenodehealth",
      "lineTyperesource_index": "line",
      "index_graph_type": "ifInOctets",
      "axisfield": "0avgBusy1",
      "nodeaxis": "thor0",
    },
    "translationname": "auto_generated",
 
    "fieldtype": "nmis_rrd"
    },
    "optionsmodel_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
{
  "datasetTitlerequestData": ""{
    }... <snip, same as above >...
  },
  "parametersreplyData": {
    "time_periodoptions": "specific_time",{
      "start_datesubtitleText": "23-May-2014 00:14:40",null,
      "end_datetitleText": "23-May-2014 08:14:40"null,
    },   "optionsyAxis1TitleText": null,
{      "titleTextplotBands": "Interface[],
Average Bits"
  } }

Successful Response

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

Code Block
themeConfluence
{   "requestDatayAxis0TitleText": {null
  	...   },
    "replyDatamin": {null,
    "optionsstacking": {
null,
     "subtitleTextmax": "thor"null,
      "titleTextmeta_data": "Interface eth0 Bits/Second Utilisation",{
      "yAxis1TitleTexttime_start": null1400206204,
      "plotBandsstart_date_input": [],
"2014-05-16 12:10:04",
      "yAxis0TitleTextend_date_input": "Avg bps2014-05-23 12:10:04"
    },
    "mindata": null, [
      {
  "stacking": null,     "maxyAxis": null0,
        "meta_datacolor": {null,
        "time_startstack": 1400768080null,
      "start_date_input  "name": "2014-05-23 00:14:40avgBusy1",
        "end_date_inputtype": "2014-05-23 08:14:40"
 null,
   },     "data": [
      {    [
     "yAxis": 0,      1400206500000,
  "color": "#00FF00",         "stack": null,
        "name": " Out"],
        "type": "line", [
       "data": [    1400206800000,
      [      null
      1400768080000,    ],
        7206.53803798496  [
        ],    1400571000000,
            6
          ],
          [
            14007681520001400571300000,
            72066.5380379849699308580333333
          ],
          [
            14007682240001400571600000,
            72069.5380379849698057514
          ],
          [
   ]       }  1400571900000,
  ]   }
}       8.00908836666667
          ],
          [
            1400572200000,
            6.01230244666667
          ],
          [
            1400572500000,
            3.02188843
          ],
          [
            1400572800000,
            2.00550849666667
          ],
        ]
      }
    ]
  }
}

For nmis_rrd, the important data is held in replyData->data->[0]->data, this is an array holding [ time, value ].  Time is in Javascript time format (and not unix epoch, to get this simply divide by 1000 ).

For nmis_graph, the data is almost the same but there may be more than 1 entry in replyData->data.  There will be one per dataset that is on the graph, for example avgbusy1, avgbusy5.  

If there is no data for that time in NMIS null will be returned.