0.4.1 • Published 5 years ago

node-prtg v0.4.1

Weekly downloads
9
License
MIT
Repository
github
Last release
5 years ago

npm version npm downloads Build Status Coverage Status

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

new PRTG(options)

ParamDescription
options
options.username
options.passhash
options.urlBase 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

ParamTypeDescription
pathstring
queryobject
resultPathstring | Array.<string>See https://lodash.com/docs#get
parsefunctionparse function that uses signature of fn(string, callback) with callback of fn(err, result)
enableSanitizebooleanenable regex to replace invalid characters

prtG.getSensor(objid) ⇒ Promise.<Sensor>

Kind: instance method of PRTG

ParamDescription
objidsensor's ID

prtG.getDeviceSensors(objid, columns) ⇒ Promise.<Array.<Sensor>>

Kind: instance method of PRTG

ParamTypeDescription
objid
columnsstring | 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

ParamTypeDescription
columns
filterPRTGFilter
objidstring | numberfilter 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

NameTypeDescription
filter_drelstringOnly include records younger than this setting (for content='messages' and content='tickets' only). Possible values: today, yesterday, 7days, 30days, 12months, forever
filter_statusArray.<string> | stringOnly 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_tagsArray.<string> | stringOnly include sensors with a specific tag (for content="sensors" only). Using multiple filter_tag fields performs a logical OR. Possible values: @tag(tagname)
filter_xyzstring | 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)
sortbystringSorts 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

NameType
namestring
sensortypestring
intervalstring
probenamestring
probegroupnamestring
parentdevicenamestring
parentdeviceidstring
lastvaluestring
lastmessagestring
favoritestring
statustextstring
statusidstring
lastupstring
lastdownstring
lastcheckstring
uptimestring
uptimetimestring
downtimestring
downtimetimestring
updowntotalstring
updownsincestring

SensorColumns : object

Kind: global typedef
Properties

NameTypeDescription
objidnumber
typestring
namestring
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??
0.4.1

5 years ago

0.4.0

6 years ago

0.3.1

6 years ago

0.2.0

6 years ago

0.0.2

7 years ago