raidar
is a simple to use NetGear RAIDar implementation for Node.js.
npm install --save raidar
yarn add raidar
// require lib
var raidar = require('raidar')
// request devices
raidar.request(function (err, devices) {
// handle error
if (err) console.error(err)
// do something useful
else console.log('ReadyNAS devices found:', devices.length)
})
// require lib
var raidar = require('raidar')
// listen for all devices
raidar.on('device', function (device) {
// do something cool
console.log('Reponse from', device.hostname())
})
// handle all errors
raidar.on('error', function (err) {
// log error
console.error(err)
})
// listen single device by IP
raidar.on('192.168.1.10', function (device) { ... })
// listen single device by hostname
raidar.on('nas-acme', function (device) { ... })
// listen single device by MAC address
raidar.on('aa:bb:cc:dd:ee:ff', function (device) { ... })
// perform request
raidar.request()
Representation of a ReadyNAS device.
Get device MAC address.
Get device hostname.
Get device IP.
Get device serial number.
Get loaded firmware version.
Get number of loaded disks.
Get info of a particular disk, index starts from 1.
Attribute | Return type | Description |
---|---|---|
status | {String} | 'ok', 'warn', 'dead' or ? |
channel | {Number} | HDD channel |
model | {String} | HDD model |
celsius | {Number} | temperature in celsius |
fahrenheit | {Number} | temperature in fahrenheit |
Get number of configured volumes.
Get info of a particular volume, index starts from 1.
Attribute | Return type | Description |
---|---|---|
status | {String} | 'ok', 'warn' or ? |
level | {String} | RAID level |
message | {String} | Status description |
size | {Number} | Volume size in bytes |
used | {Number} | Used space in bytes |
free | {Number} | Free space in bytes |
Get all device entities.
Get entity data.
Get single entity attribute.
Get {Object} representation of ReadyNAS device.
Handle network data collection.
Check if the UDP socket is open.
Open a new UPD socket, callback has no arguments.
Close the UDP socket, callback has no arguments.
Perform a new ReadyNAS request, if the socket is closed it will be opened.
callback is called as callback({Error} [err], {Array} devices)
.
Option | Type | Description |
---|---|---|
address | {String} | Do request to a specific IP/hostname |
timeout | {Number} | Idle timeout to stop request |
Triggered whenever a socket begins listening for datagram messages.
Triggered after a socket is closed with #close() API.
Triggered where an error occurs.
Triggered after a error on ReadyNAS instance.
Clean reponse from a ReadyNAS device.
Triggered when a ReadyNAS device is found, with a instance of ReadyNAS class.
Same as device event, but triggered when a specific device is found.
Same as device event, but triggered when a specific device is found.
Same as device event, but triggered when a specific device is found.
Usage: raidar [options]
Options:
-h, --help output usage information
-V, --version output the version number
-a, --address <address> perform a request to a particular hostname/IP
-t, --timeout <n> set a request idle timeout, default 3 seconds
-f, --fahrenheit display temperature in fahrenheit instead of celsius
-d, --dump [path] dump ReadyNAS messages
-j, --json print JSON format
-F, --fake <path> emulate a fake device from dump
ReadyNAS 104 - 0123456789ABC
mac aa:bb:cc:dd:ee:ff
ip 192.168.1.5
name acme-swhouse
fw 6.6.1
Disks
✓ WDC_WD40EFRX-68WT0N0 4TB - 55°C
✓ WDC_WD40EFRX-68WT0N0 4TB - 40°C
Volumes
✓ RAID lv.1 - 27% used
Redundant
PS: the output is colored ;)
- Have some problems ?
- Have over 9000 NetGear NASses ?
- Have some strange errors with some APIs ?
Dump all ReadyNAS messages and send it to me to help me to understand the ReadyNAS protocol.
npm run test
Copyright 2019 Giacomo Gregoletto
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.