A Node.js module for interacting with the PRTG API.
- PRTG 14.x+, earlier versions may work but have not been tested.
- Node.js v6+
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 */ });- PRTGFilter :
object - Sensor :
object - SensorColumns :
object
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
| Param | Description |
|---|---|
| options | |
| options.username | |
| options.passhash | |
| options.url | Base URL of your PRTG installation, e.g. the API is accessible at /API/ |
Kind: instance method of PRTG
Return opposite mapping for status to status id
Kind: instance method of PRTG
| Param |
|---|
| str |
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 |
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' |
Kind: instance method of PRTG
| Param |
|---|
| objid |
| property |
Kind: instance method of PRTG
| Param |
|---|
| objid |
Kind: instance method of PRTG
| Param |
|---|
| objid |
Kind: instance method of PRTG
| Param | Type | Description |
|---|---|---|
| [columns] | ||
| [filter] | PRTGFilter |
|
| [objid] | string | number |
filter set to this object (device/group/probe) |
Kind: instance method of PRTG
Kind: instance method of PRTG
Kind: instance method of PRTG
| Param |
|---|
| objectId |
| message |
Kind: instance method of PRTG
| Param |
|---|
| objectId |
Kind: instance method of PRTG
| Param |
|---|
| objectId |
| message |
| minutes |
Kind: instance method of PRTG
| Param |
|---|
| objectId |
| message |
Kind: instance method of PRTG
| Param |
|---|
| objectId |
| message |
| minutes |
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) |
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 |
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 | ?? |