
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
This is a node.js implementation of an apcupsd nis client. The module comes with a command line interface and a library you can use in your projects.
An APC UPS Daemon has to run on a local or remote machine and has to be configured as network information server (NIS). For more information visit the apcupsd website.
These instructions will help you to install and use the command line interface on your local machine.
Simply install the package globally over npm. This will create a symlink in your bin folder and installs all the required dependencies.
npm install -g apcaccess
Usage:
apcaccessjs [OPTIONS] <command> [ARGS]
Options:
-H, --host [STRING] Hostname or ip address of the apcupsd nis (Default is localhost)
-p, --port [NUMBER] Port of the apcupsd nis (Default is 3551)
-h, --help Display help and usage details
Commands:
events, status, statusJson
A short introduction and example how to use the apcaccess library. The library uses Promises.
var ApcAccess = require('apcaccess');
var client = new ApcAccess();
client.connect('localhost', 3551)
.then(function() {
console.log('Connected');
})
.catch(function(err) {
console.log(err);
})
var ApcAccess = require('apcaccess');
var client = new ApcAccess();
client.connect('localhost', 3551)
.then(function() {
return client.status();
})
.then(function(result) {
console.log(result)
return client.disconnect();
})
.then(function() {
console.log('Disconnected');
})
.catch(function(err) {
console.log(err);
})
Output:
APC : 001,034,0839
DATE : 2017-04-30 13:41:04 +0200
HOSTNAME : alarmpi
VERSION : 3.14.14 (31 May 2016) unknown
UPSNAME : alarmpi
CABLE : USB Cable
DRIVER : USB UPS Driver
UPSMODE : Stand Alone
STARTTIME: 2017-04-28 12:04:47 +0200
MODEL : Back-UPS ES 700G
STATUS : ONLINE
LINEV : 232.0 Volts
LOADPCT : 5.0 Percent
BCHARGE : 100.0 Percent
TIMELEFT : 36.4 Minutes
MBATTCHG : 5 Percent
MINTIMEL : 3 Minutes
MAXTIME : 0 Seconds
SENSE : Medium
LOTRANS : 180.0 Volts
HITRANS : 266.0 Volts
ALARMDEL : 30 Seconds
BATTV : 13.5 Volts
LASTXFER : Unacceptable line voltage changes
NUMXFERS : 0
TONBATT : 0 Seconds
CUMONBATT: 0 Seconds
XOFFBATT : N/A
STATFLAG : 0x05000008
SERIALNO : 5B1325T16968
BATTDATE : 2013-06-23
NOMINV : 230 Volts
NOMBATTV : 12.0 Volts
FIRMWARE : 871.O2 .I USB FW:O2
END APC : 2017-04-30 13:41:26 +0200
var ApcAccess = require('apcaccess');
var client = new ApcAccess();
client.connect('localhost', 3551)
.then(function() {
return client.events();
})
.then(function(result) {
console.log(result)
return client.disconnect();
})
.then(function() {
console.log('Disconnected');
})
.catch(function(err) {
console.log(err);
})
Output:
2017-04-28 12:01:15 +0200 Cannot create /run/apcupsd/LCK.. serial port lock file: ERR=No such file or directory
2017-04-28 12:01:15 +0200 apcupsd FATAL ERROR in apcupsd.c at line 221
Unable to create UPS lock file.
If apcupsd or apctest is already running,
please stop it and run this program again.
2017-04-28 12:01:15 +0200 apcupsd error shutdown completed
2017-04-28 12:01:35 +0200 Cannot create /run/apcupsd/LCK.. serial port lock file: ERR=No such file or directory
2017-04-28 12:01:35 +0200 apcupsd FATAL ERROR in apcupsd.c at line 221
Unable to create UPS lock file.
If apcupsd or apctest is already running,
please stop it and run this program again.
2017-04-28 12:01:35 +0200 apcupsd error shutdown completed
2017-04-28 12:04:47 +0200 apcupsd 3.14.14 (31 May 2016) unknown startup succeeded
var ApcAccess = require('apcaccess');
var client = new ApcAccess();
client.connect('localhost', 3551)
.then(function() {
return client.statusJson();
})
.then(function(result) {
console.log(result)
return client.disconnect();
})
.then(function() {
console.log('Disconnected');
})
.catch(function(err) {
console.log(err);
})
Output:
{ APC: '001,034,0839',
DATE: '2017-04-30 13:47:07 +0200 ',
HOSTNAME: 'alarmpi',
VERSION: '3.14.14 (31 May 2016) unknown',
UPSNAME: 'alarmpi',
CABLE: 'USB Cable',
DRIVER: 'USB UPS Driver',
UPSMODE: 'Stand Alone',
STARTTIME: '2017-04-28 12:04:47 +0200 ',
MODEL: 'Back-UPS ES 700G ',
STATUS: 'ONLINE ',
LINEV: '232.0 Volts',
LOADPCT: '5.0 Percent',
BCHARGE: '100.0 Percent',
TIMELEFT: '36.4 Minutes',
MBATTCHG: '5 Percent',
MINTIMEL: '3 Minutes',
MAXTIME: '0 Seconds',
SENSE: 'Medium',
LOTRANS: '180.0 Volts',
HITRANS: '266.0 Volts',
ALARMDEL: '30 Seconds',
BATTV: '13.5 Volts',
LASTXFER: 'Unacceptable line voltage changes',
NUMXFERS: '0',
TONBATT: '0 Seconds',
CUMONBATT: '0 Seconds',
XOFFBATT: 'N/A',
STATFLAG: '0x05000008',
SERIALNO: '5B1325T16968 ',
BATTDATE: '2013-06-23',
NOMINV: '230 Volts',
NOMBATTV: '12.0 Volts',
FIRMWARE: '871.O2 .I USB FW:O2',
'END APC': '2017-04-30 13:47:10 +0200 ' }
This project is licensed under the MIT License - see the LICENSE.md file for details
FAQs
apcaccess client library and cli written in node.js
The npm package apcaccess receives a total of 33 weekly downloads. As such, apcaccess popularity was classified as not popular.
We found that apcaccess demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.