npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

node-prtg

v0.4.1

Published

A Node.js module for interacting with the PRTG API.

Downloads

9

Readme

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)

| 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 | | ?? |