...
Required Parameters
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 | |||||
parameters | 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 | { | |||||
node | maps 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_index | If 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 | |||||
field | Only used for nmis_rrd: maps to the dataset required found using GET node resource datasets (value attribute of desired dataset) | |||||
axis | 0 or 1, the axis the dataset will group itself into, usually 0 | |||||
} | ||||||
options | { | |||||
datasetTitle | The title the dataset will return with itself | |||||
} | ||||||
} | ||||||
} | Parameter |
Request Example
...
Code Block |
---|
"requestData": {
"parameters": {
"time_period": "time_difference",
"end_date": "23-May-2014 11:54:20", |
Request Example
Code Block |
---|
requestData = JSON( { "model_view": "graph", "dataset": { "datastart_sourcedate": "local_nmis",16-May-2014 11:54:20" }, "parametersoptions": {}, "dataset": { "typeparameters" : "nmis_rrd",{ "resource_indexnode": "2asgard", "graph_type": "interfacenmis_rrd", "lineTypegraph_type": "linenodehealth", "resource_index_graph_type": "ifInOctets", "axisindex_graph_type": "0", "nodefield": "thoravgBusy1", "translationaxis": "0", }, "fieldname": "" }auto_generated", "optionstype": {"nmis_rrd" }, "datasetTitlemodel_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 |
---|
{ "parametersrequestData": { "time_period": "specific_time",... <snip, same as above >... }, "start_datereplyData": "23-May-2014 00:14:40",{ "end_dateoptions": { "23-May-2014 08:14:40" }, "options": { "subtitleText": null, "titleText": null, "yAxis1TitleText": null, "titleTextplotBands": "Interface Average Bits"[], "yAxis0TitleText": null } } |
Successful Response
A successful response will be a hash with 2 objects. The requestObject that was submitted along with a responseObject :
Code Block | ||
---|---|---|
| ||
{ , "requestDatamin": {null, ... } "stacking": null, "replyDatamax": {null, "optionsmeta_data": { "subtitleTexttime_start": "thor"1400206204, "titleTextstart_date_input": "Interface eth0 Bits/Second Utilisation2014-05-16 12:10:04", "yAxis1TitleTextend_date_input": null, "2014-05-23 12:10:04" }, "plotBandsdata": [], "yAxis0TitleText": "Avg bps"{ }, "minyAxis": null0, "stackingcolor": null, "maxstack": null, "meta_data": { "time_startname": 1400768080"avgBusy1", "start_date_input "type": "2014-05-23 00:14:40"null, "end_date_inputdata": "2014-05-23 08:14:40" [ }, "data": [ { 1400206500000, "yAxis": 0, "color": "#00FF00", null "stack": null ], "name": " Out",[ "type": "line" 1400206800000, "data": [ null ], [ 14007680800001400571000000, 7206.538037984966 ], [ 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.