pm2-prtg

1.1.7 • Public • Published

pm2-prtg

The package expects 2 parameters:

  1. id or name of pm2 process (will be evalueated on type of argument (number - id, string - name))
  2. Optional configuration object. It can be provided with:
    • counters (array of {name: string, group: string, unit: string})
    • fields (array of {name: string, value: any, group: string, unit: string})
    • histogrms (array of {name: string, group: string, unit: string})

returns promise

Availible methods

  • startTimer - starts timer for provided name (string)
  • getTimerValue - returns timer falue for provided name (string)
  • addHistogram - adds new histogram. params: name (string) group (string - optional) and unit (string - optional)
  • getHistogram - returns histogram value by provided name (string)
  • updateHistogram - updates histogram for provided name (string) with provided value (number)
  • setField - sets new filed or updates existing one - proved name (string) val (any) group (string) and unit (string)
  • getField - get field by provided name (string) group (string - optional)
  • incrementCounter - increment existing counder by name (string)
  • getCounterValue - get counder value by name (string)
  • addCounter - add new counter with provided name (string) and group (string - optional)
  • listAllCounters - list all counters with their values | group - optional filter (string)
  • listAllFields - list all fields with their values | group - optional filter (string)
  • listAllHistograms - list all histograms with their values | group - optional filter (string)
  • getSanitizedData
  • update - updates current pm2 data with relevant and newes data. Is asynchronous
  • getPrtgObject - returns data prepared for ptrg | group - optional filter (string)

Defaults

The package has 2 default counters: successCounter and errorCounter

Other

When you import package you have access to jsdoc types like PM2_PRTG_HANDLER and Config
You can also import them separately by require('pm2-prtg/types')

Readme

Keywords

none

Package Sidebar

Install

npm i pm2-prtg

Weekly Downloads

14

Version

1.1.7

License

ISC

Unpacked Size

10.8 kB

Total Files

7

Last publish

Collaborators

  • shlomi.gutman