APC UPS SNMP
Library for reading values of APC UPS battery via the network.
Installation
npm install apc-ups-snmp
Usage
var apcUps = ; var ups = host: '' // IP Address/Hostname;
A full range of examples can be found within the examples directory
Methods
Note that in the web GUI a number of values are reported with 1-2 decimal places. The SNMP implementation by APC does not support decimals.
getModel(callback)
Get the UPS Model number, eg 'Smart-UPS 2200 RM'
Arguments
callback(err, model)
- Callback function for error/response handling
Example
ups
getTemperature(callback)
Get the internal temperature of the UPS.
Arguments
callback(err, temperature)
- Callback function for error/response handling
Example
ups;
getInputVoltage(callback)
Get the input voltage.
Arguments
callback(err, voltage)
- Callback function for error/response handling
Example
ups;
getInputFrequency(callback)
Get the input frequency.
Arguments
callback(err, hz)
- Callback function for error/response handling
Example
ups;
getOutputVoltage(callback)
Get the output voltage.
Arguments
callback(err, voltage)
- Callback function for error/response handling
Example
ups;
getOutputFrequency(callback)
Get the output frequency.
Arguments
callback(err, hz)
- Callback function for error/response handling
Example
ups;
getOutputLoadPercentage(callback)
Get the output load percentage.
Arguments
callback(err, percentage)
- Callback function for error/response handling
Example
ups;
getOutputLoad(callback)
Get the output in amps.
Arguments
callback(err, amps)
- Callback function for error/response handling
Example
ups;
getBatteryCapacity(callback)
Get the battery capacity percentage.
Arguments
callback(err, percentage)
- Callback function for error/response handling
Example
ups;
getBatteryStatus(callback)
Get the battery status.
Arguments
callback(err, status)
- Callback function for error/response handling, see the table below for translated statuses.
Status | Translation |
---|---|
1 | unknown |
2 | batteryNormal |
3 | batteryLow |
4 | batteryInFaultCondition |
The translated key is available within the library using ups.batteryStatus[#]
, as shown in the example below.
Example
ups;
getBatteryRunTime(callback)
Get the battery runtime remaining in minutes.
Arguments
callback(err, percentage)
- Callback function for error/response handling
Example
ups;
getLastFailCause(callback)
Get the reason for last transfer to battery power.
Arguments
callback(err, failCause)
- Callback function for error/response handling, see the table below for translated causes.
Fail Cause | Translation |
---|---|
1 | noTransfer |
2 | highLineVoltage |
3 | brownout |
4 | blackout |
5 | smallMomentarySag |
6 | deepMomentarySag |
7 | smallMomentarySpike |
8 | largeMomentarySpike |
9 | selfTest |
10 | rateOfVoltageChange |
The translated key is available within the library using ups.failCause[#]
, as shown in the example below.
ups;
getBatteryReplaceIndicator(callback)
Get the battery replacement indicator.
Arguments
callback(err, failCause)
- Callback function for error/response handling, see the table below for translated indicators.
Indicator | Translation |
---|---|
1 | noBatteryNeedsReplacing |
2 | batteryNeedsReplacing |
The translated key is available within the library using ups.batteryIndicator[#]
, as shown in the example below.
ups;
getLastDiagnosticsTestDate(callback)
Get date self diagnostics was last run.
Note the date will be formatted as mm/dd/yy.
Arguments
callback(err, date)
- Callback function for error/response handling
Example
ups;
getLastDiagnosticsTestResult(callback)
Get the last self diagnostics result.
Arguments
callback(err, result)
- Callback function for error/response handling, see the table below for translated results.
Result | Translation |
---|---|
1 | ok |
2 | failed |
3 | invalidTest |
4 | testInProgress |
The translated key is available within the library using ups.testResult[#]
, as shown in the example below.
Example
ups;
Notes
Have only implemented a few basic values to begin with, have plans for a few more just need to find some time to add these in.
All the MIBs have been hard coded into this module, for more details see the PowerNet-MIB at ftp://ftp.apc.com/apc/public/software/pnetmib/mib/411/powernet411.mib