-
Notifications
You must be signed in to change notification settings - Fork 0
Common Usage
Lee Thompson edited this page Jun 23, 2015
·
1 revision
The following code will load the library, auto-discover (UPNP Multicast) any units on the network and then display summary information on the console.
require "readynas-multicast.pl"; # Use readynas-multicast UPNP library
`loadReadyNASData();`
`$units = getUnitAddresses();`
`$unitcount = getUnitCount();`
`$i=0;`
`for ( split /\|/, $units ) {`
`/\|/;`
`$i++;`
`$macindex = parseReadyNASData(getUnitData($_));`
`print "Unit #$i:\n";`
`print " Model: $unit{$macindex}{models}{0}\n";`
`print " OS: $unit{$macindex}{os}{0}\n";`
`print " Host: $unit{$macindex}{hostname}{0}\n";`
`print " IP: $unit{$macindex}{ipaddr}{0}\n";`
`print " MAC: $unit{$macindex}{mac}{0}\n";`
`print " Cooling: $unit{$macindex}{fan}{0}\n";`
`print "System Temp: $unit{$macindex}{tmps}{0}\n";`
`print " UPS: $unit{$macindex}{ups}{0}\n";`
`print " Volumes: $unit{$macindex}{volumes}{0}\n";`
`print " Disks: $unit{$macindex}{disks}{0}\n";`
`print " Uptime: $unit{$macindex}{system}{uptime}{0}\n";`
`print " Boot: $unit{$macindex}{boot}{0}\n";`
`print "------------\n";`
`}`
For more details and examples please take a look at "sample.pl" and "sample_webstats.pl".