0.4.1 • Published 5 years ago
node-prtg v0.4.1
node-prtg
A Node.js module for interacting with the PRTG API.
Requirements
- PRTG 14.x+, earlier versions may work but have not been tested.
- Node.js v6+
Usage
const PRTG = require('node-prtg');
const api = new PRTG({
url: 'http://your.prtg.install.com',
username: 'username',
passhash: '123456789'
});
api.getSensor(1234)
.then(sensor => { /*do something with result*/ }).catch(error => { /* handle errors */ });
Classes
Typedefs
PRTG
Kind: global class
- PRTG
- new PRTG(options)
- .getDefaults() ⇒ Object | *
- .getStatus(str) ⇒ string | number
- .api(path, query, [resultPath], [parse], [enableSanitize]) ⇒ Promise | object
- .getSensor(objid) ⇒ Promise.<Sensor>
- .getDeviceSensors(objid, [columns]) ⇒ Promise.<Array.<Sensor>>
- .getObjectProperty(objid, property) ⇒ Promise.<Object>
- .getSensorStatusId(objid) ⇒ Promise.<String>
- .getDeviceStatusId(objid) ⇒ Promise.<String>
- .getSensors([columns], [filter], [objid]) ⇒ Promise.<Array.<Sensor>>
- .getDownOrAckSensors() ⇒ Promise.<Array.<Sensor>>
- .getSensorTree() ⇒ Promise.<Object>
- .pauseSensor(objectId, message) ⇒ Promise | Object
- .resumeSensor(objectId) ⇒ Promise | Object
- .pauseSensorDuration(objectId, message, minutes) ⇒ Promise | Object
- .acknowledgeSensor(objectId, message) ⇒ Promise | Object
- .acknowledgeSensorDuration(objectId, message, minutes) ⇒ Promise | Object
new PRTG(options)
Param | Description |
---|---|
options | |
options.username | |
options.passhash | |
options.url | Base URL of your PRTG installation, e.g. the API is accessible at /API/ |
prtG.getDefaults() ⇒ Object | *
Kind: instance method of PRTG
prtG.getStatus(str) ⇒ string | number
Return opposite mapping for status to status id
Kind: instance method of PRTG
Param |
---|
str |
prtG.api(path, query, resultPath, parse, enableSanitize) ⇒ Promise | object
Kind: instance method of PRTG
Param | Type | Description |
---|---|---|
path | string | |
query | object | |
resultPath | string | Array.<string> | See https://lodash.com/docs#get |
parse | function | parse function that uses signature of fn(string, callback) with callback of fn(err, result) |
enableSanitize | boolean | enable regex to replace invalid characters |
prtG.getSensor(objid) ⇒ Promise.<Sensor>
Kind: instance method of PRTG
Param | Description |
---|---|
objid | sensor's ID |
prtG.getDeviceSensors(objid, columns) ⇒ Promise.<Array.<Sensor>>
Kind: instance method of PRTG
Param | Type | Description |
---|---|---|
objid | ||
columns | string | Array.<string> | Defaults to 'objid,probe,group,device,sensor,lastvalue,type,name,tags,active,status,grpdev,message' |
prtG.getObjectProperty(objid, property) ⇒ Promise.<Object>
Kind: instance method of PRTG
Param |
---|
objid |
property |
prtG.getSensorStatusId(objid) ⇒ Promise.<String>
Kind: instance method of PRTG
Param |
---|
objid |
prtG.getDeviceStatusId(objid) ⇒ Promise.<String>
Kind: instance method of PRTG
Param |
---|
objid |
prtG.getSensors(columns, filter, objid) ⇒ Promise.<Array.<Sensor>>
Kind: instance method of PRTG
Param | Type | Description |
---|---|---|
columns | ||
filter | PRTGFilter | |
objid | string | number | filter set to this object (device/group/probe) |
prtG.getDownOrAckSensors() ⇒ Promise.<Array.<Sensor>>
Kind: instance method of PRTG
prtG.getSensorTree() ⇒ Promise.<Object>
Kind: instance method of PRTG
prtG.pauseSensor(objectId, message) ⇒ Promise | Object
Kind: instance method of PRTG
Param |
---|
objectId |
message |
prtG.resumeSensor(objectId) ⇒ Promise | Object
Kind: instance method of PRTG
Param |
---|
objectId |
prtG.pauseSensorDuration(objectId, message, minutes) ⇒ Promise | Object
Kind: instance method of PRTG
Param |
---|
objectId |
message |
minutes |
prtG.acknowledgeSensor(objectId, message) ⇒ Promise | Object
Kind: instance method of PRTG
Param |
---|
objectId |
message |
prtG.acknowledgeSensorDuration(objectId, message, minutes) ⇒ Promise | Object
Kind: instance method of PRTG
Param |
---|
objectId |
message |
minutes |
PRTGFilter : object
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
filter_drel | string | Only include records younger than this setting (for content='messages' and content='tickets' only). Possible values: today, yesterday, 7days, 30days, 12months, forever |
filter_status | Array.<string> | string | Only include sensors with a specific status (for content='sensors' only). Using multiple filter_status fields performs a logical OR. See types PRTG.DEFAULTS.status. |
filter_tags | Array.<string> | string | Only include sensors with a specific tag (for content="sensors" only). Using multiple filter_tag fields performs a logical OR. Possible values: @tag(tagname) |
filter_xyz | string | Array.<string> | filter_xyz where xyz is any column name used in the columns parameter; Substrings: use filter_xyz=@sub(substring1,substring2); Values not equal/above/below: use filter_xyz=@neq(value), filter_xyz=@above(value), filter_xyz=@below(value) |
sortby | string | Sorts the data. If this parameter is omitted, the table will be sorted based on the first column. Add a leading '-' to reverse. Possible values: any column name used in the columns parameter. (sortby=name, sortby=lastvalue, sortby=-lastvalue) |
Sensor : object
Kind: global typedef
Properties
Name | Type |
---|---|
name | string |
sensortype | string |
interval | string |
probename | string |
probegroupname | string |
parentdevicename | string |
parentdeviceid | string |
lastvalue | string |
lastmessage | string |
favorite | string |
statustext | string |
statusid | string |
lastup | string |
lastdown | string |
lastcheck | string |
uptime | string |
uptimetime | string |
downtime | string |
downtimetime | string |
updowntotal | string |
updownsince | string |
SensorColumns : object
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
objid | number | |
type | string | |
name | string | |
tags | ||
active | ||
downtime | ||
downtimetime | ||
downtimesince | ||
uptime | ||
uptimetime | ||
uptimesince | ||
knowntime | ||
cumsince | ||
sensor | ||
interval | ||
lastcheck | ||
lastup | ||
lastdown | ||
device | ||
group | ||
probe | ||
grpdev | ||
notifiesx | ||
intervalx | ||
access | ||
dependency | ||
probegroupdevice | ||
status | ||
message | ||
priority | ||
lastvalue | ||
upsens | ||
downsens | ||
partialdownsens | ||
warnsens | ||
pausedsens | ||
unusualsens | ||
undefinedsens | ||
totalsens | ||
favorite | ||
minigraph | ||
comments | ||
basetype | ?? | |
baselink | ?? | |
parentid | ?? |