× NETGEAR will be terminating ReadyCLOUD service by July 1st, 2023. For more details click here.
Orbi WiFi 7 RBE973
Reply

Re: PerlDar

Lee_Thompson
Tutor

Re: PerlDar

chirpa wrote:
So besides the Singlecast/Multicast packet difference, setDestinationAddress() and addUnit() do the same thing?


setDestinationAddress isn't used on the singlecast version; just addunit... . I should probably change setDestinationAddress to addUnit to avoid confusion.

I had originally just written this so I could easily monitor my 5 NV/NV+s and it seems to have grown lately 😛
Message 26 of 45
chirpa
Luminary

Re: PerlDar

Sounds good.

And you are doing a good job! :thumbsup:
Message 27 of 45
Lee_Thompson
Tutor

Re: PerlDar

Lee Thompson wrote:
chirpa wrote:
So besides the Singlecast/Multicast packet difference, setDestinationAddress() and addUnit() do the same thing?


setDestinationAddress isn't used on the singlecast version; just addunit... . I should probably change setDestinationAddress to addUnit to avoid confusion.

I had originally just written this so I could easily monitor my 5 NV/NV+s and it seems to have grown lately 😛


Updated the library, cleaned up code and made the interfaces more consistent. See the top of the thread for the updated link.
Message 28 of 45
chirpa
Luminary

Re: PerlDar

So this is probably more down to the weird ways of RAIDar... but see what you think of this...

One NAS, a ReadyNAS Pro, eth0: 192.168.2.5, eth1: 192.168.2.6. Using multicast or unicast, I get (3) found NASes (localhost, .5, .6).

pronto:~/PerlDar# perl sample.pl
addUnit::Adding 192.168.2.5 to Unit List
Netgear ReadyNAS Status
Using Library v200904291822

Please Wait...
identifyProgram::UPNP-UNICAST NETGEAR ReadyNAS Perl Communications Library v200904291822
identifyProgram:: Verbose: 1
identifyProgram:: Debug Mode: 0
identifyProgram:: Output: console
identifyProgram::Socket Timeout: 7
identifyProgram:: Error Timeout: 2
loadReadyNASData::Querying 1 Unit(s)
loadReadyNASData::Address List: |192.168.2.5
loadReadyNASData::Processing Address: 192.168.2.5
loadReadyNASData::Building Packet
loadReadyNASData::Opening Socket
loadReadyNASData::Sending Packet
loadReadyNASData::Sent 28 bytes to 192.168.2.5:22081
loadReadyNASData::Receiving Packets
loadReadyNASData::0 units processed
loadReadyNASData::Read 8568 bytes
loadReadyNASData::Processing Data
processReadyNASData::Start
processReadyNASData::Processing Data Stream
processReadyNASData::0: Found Data Record
processReadyNASData::1: Adding Data Block to Array
processReadyNASData::1: Adding 192.168.2.5 to Unit List
processReadyNASData::1: Found Data Record
processReadyNASData::2: Adding Data Block to Array
processReadyNASData::2: Adding 192.168.2.6 to Unit List
processReadyNASData::2: Found Data Record
processReadyNASData::3: Adding Data Block to Array
processReadyNASData::3: Adding 127.0.0.1 to Unit List
processReadyNASData::0: Already Present
processReadyNASData::0: Already Present
processReadyNASData::0: Already Present
processReadyNASData::Counted 3 Units
processReadyNASData::Exit
loadReadyNASData::Returning 8558 bytes
loadReadyNASData::Exit(8558)
Received Data for 3 Unit(s)
getUnitData::Start
getUnitData::Last Octet is 1
getUnitData::Data Record of 1414
getUnitData::Exit(1414)
parseReadyNASData::Start
parseReadyNASData::Processing Outer Layer
parseReadyNASData::001F33EA0535: Adding MAC
parseReadyNASData::001F33EA0535: Adding HOST
parseReadyNASData::001F33EA0535: Adding IP Address
parseReadyNASData::001F33EA0535: Generating Summaries
parseReadyNASData::001F33EA0535: Building Disk List ( 6 Records )
parseReadyNASData::001F33EA0535: Processing System Status
parseReadyNASData::001F33EA0535: Generating System Summary
parseReadyNASData::Exit(0)
Unit #1:
Model: ReadyNAS Pro
OS: RAIDiator v4.2.5-T16 (Tue Apr 14 17:48:55 2009)
Host: pronto
IP: 192.168.2.5
MAC: 00:1F:33:00:00:00
Cooling: 1205RPM (OK)
System Temp: 60.0C/140.0F (OK)
UPS: Not present (NOT_PRESENT)
Volumes: Volume C: RAID Level X2, Redundant. 2221048 MB (78%) of 2774 GB used (OK)
Disks: 1: 43C/109F (OK); 2: 46C/114F (OK); 3: 44C/111F (OK); present: N/A (NOT_PRESENT); present: N/A (NOT_PRESENT); present: N/A (NOT_PRESENT)
Uptime: N/A
------------
getUnitData::Start
getUnitData::Last Octet is 5
getUnitData::Data Record of 1414
getUnitData::Exit(1414)
parseReadyNASData::Start
parseReadyNASData::Processing Outer Layer
parseReadyNASData::001F33EA0535: Adding MAC
parseReadyNASData::001F33EA0535: Adding HOST
parseReadyNASData::001F33EA0535: Adding IP Address
parseReadyNASData::001F33EA0535: Generating Summaries
parseReadyNASData::001F33EA0535: Building Disk List ( 6 Records )
parseReadyNASData::001F33EA0535: Processing System Status
parseReadyNASData::001F33EA0535: Generating System Summary
parseReadyNASData::Exit(0)
Unit #2:
Model: ReadyNAS Pro
OS: RAIDiator v4.2.5-T16 (Tue Apr 14 17:48:55 2009)
Host: pronto
IP: 192.168.2.5
MAC: 00:1F:33:00:00:00
Cooling: 1205RPM (OK)
System Temp: 60.0C/140.0F (OK)
UPS: Not present (NOT_PRESENT)
Volumes: Volume C: RAID Level X2, Redundant. 2221048 MB (78%) of 2774 GB used (OK)
Disks: 1: 43C/109F (OK); 2: 46C/114F (OK); 3: 44C/111F (OK); present: N/A (NOT_PRESENT); present: N/A (NOT_PRESENT); present: N/A (NOT_PRESENT)
Uptime: N/A
------------
getUnitData::Start
getUnitData::Last Octet is 6
getUnitData::Data Record of 1414
getUnitData::Exit(1414)
parseReadyNASData::Start
parseReadyNASData::Processing Outer Layer
parseReadyNASData::001F33EA0535: Adding MAC
parseReadyNASData::001F33EA0535: Adding HOST
parseReadyNASData::001F33EA0535: Adding IP Address
parseReadyNASData::001F33EA0535: Generating Summaries
parseReadyNASData::001F33EA0535: Building Disk List ( 6 Records )
parseReadyNASData::001F33EA0535: Processing System Status
parseReadyNASData::001F33EA0535: Generating System Summary
parseReadyNASData::Exit(0)
Unit #3:
Model: ReadyNAS Pro
OS: RAIDiator v4.2.5-T16 (Tue Apr 14 17:48:55 2009)
Host: pronto
IP: 192.168.2.5
MAC: 00:1F:33:00:00:00
Cooling: 1205RPM (OK)
System Temp: 60.0C/140.0F (OK)
UPS: Not present (NOT_PRESENT)
Volumes: Volume C: RAID Level X2, Redundant. 2221048 MB (78%) of 2774 GB used (OK)
Disks: 1: 43C/109F (OK); 2: 46C/114F (OK); 3: 44C/111F (OK); present: N/A (NOT_PRESENT); present: N/A (NOT_PRESENT); present: N/A (NOT_PRESENT)
Uptime: N/A
------------
Maybe a filter per MAC address to weed out duplicates?
Message 29 of 45
Lee_Thompson
Tutor

Re: PerlDar

chirpa wrote:
So this is probably more down to the weird ways of RAIDar... but see what you think of this...

One NAS, a ReadyNAS Pro, eth0: 192.168.2.5, eth1: 192.168.2.6. Using multicast or unicast, I get (3) found NASes (localhost, .5, .6).------------[/code]


Hmm yeah, some kind of filtering is gonna be best to prevent that. raidard must respond once per interface for some reason.
Message 30 of 45
Lee_Thompson
Tutor

Re: PerlDar

Lee Thompson wrote:
chirpa wrote:
So this is probably more down to the weird ways of RAIDar... but see what you think of this...

One NAS, a ReadyNAS Pro, eth0: 192.168.2.5, eth1: 192.168.2.6. Using multicast or unicast, I get (3) found NASes (localhost, .5, .6).------------[/code]


Hmm yeah, some kind of filtering is gonna be best to prevent that. raidard must respond once per interface for some reason.


Done.
Message 31 of 45
chirpa
Luminary

Re: PerlDar

Okay, now it shows two, the localhost entry is gone (I'm running it directly on the NAS).

Each interface is giving back its own MAC address, so I'd say things are good now.

# perl sample.pl
addUnit::Adding 192.168.2.5 to Unit List
NETGEAR ReadyNAS Status
Using UPNP-UNICAST NETGEAR ReadyNAS Perl Communications Library v200904300056

Please Wait...
identifyProgram::UPNP-UNICAST NETGEAR ReadyNAS Perl Communications Library v200904300056
identifyProgram:: Verbose: 1
identifyProgram:: Debug Mode: 0
identifyProgram:: Output: console
identifyProgram::Socket Timeout: 10
identifyProgram:: Error Timeout: 2
loadReadyNASData::Querying 1 Unit(s)
loadReadyNASData::Address List: |192.168.2.5
loadReadyNASData::Processing Address: 192.168.2.5
loadReadyNASData::Building Packet
loadReadyNASData::Opening Socket
loadReadyNASData::Sending Packet
loadReadyNASData::Sent 28 bytes to 192.168.2.5:22081
loadReadyNASData::Receiving Packets
loadReadyNASData::0 units processed
loadReadyNASData::Read 8562 bytes
loadReadyNASData::Processing Data
processReadyNASData::Start
processReadyNASData::Processing Data Stream
processReadyNASData::0: Found Data Record
processReadyNASData::1: Adding Data Block to Array
processReadyNASData::1: Adding 192.168.2.5 to Unit List
processReadyNASData::0: MAC Already Present
processReadyNASData::0: MAC Already Present
processReadyNASData::0: IP Already Present
processReadyNASData::1: Found Data Record
processReadyNASData::2: Adding Data Block to Array
processReadyNASData::2: Adding 192.168.2.6 to Unit List
processReadyNASData::0: MAC Already Present
processReadyNASData::Counted 2 Units
processReadyNASData::Exit
loadReadyNASData::Returning 8552 bytes
loadReadyNASData::Exit(8552)
Received Data for 2 Unit(s)
getUnitData::Start
getUnitData::Last Octet is 5
getUnitData::Data Record of 1413
getUnitData::Exit(1413)
parseReadyNASData::Start
parseReadyNASData::Processing Outer Layer
parseReadyNASData::001F33EA0535: Adding MAC
parseReadyNASData::001F33EA0535: Adding HOST
parseReadyNASData::001F33EA0535: Adding IP Address
parseReadyNASData::001F33EA0535: Generating Summaries
parseReadyNASData::001F33EA0535: Building Disk List ( 6 Records )
parseReadyNASData::001F33EA0535: Processing System Status
parseReadyNASData::001F33EA0535: Generating System Summary
parseReadyNASData::Exit(0)
Unit #1:
Model: ReadyNAS Pro
OS: RAIDiator v4.2.5-T16 (Tue Apr 14 17:48:55 2009)
Host: pronto
IP: 192.168.2.5
MAC: 00:1F:33:EA:00:35
Cooling: 932RPM (OK)
System Temp: 60.0C/140.0F (OK)
UPS: Not present (NOT_PRESENT)
Volumes: Volume C: RAID Level X2, Redundant. 2224897 MB (78%) of 2774 GB used (OK)
Disks: 1: 43C/109F (OK); 2: 46C/114F (OK); 3: 44C/111F (OK); present: N/A (NOT_PRESENT); present: N/A (NOT_PRESENT); present: N/A (NOT_PRESENT)
Uptime: N/A
------------
getUnitData::Start
getUnitData::Last Octet is 6
getUnitData::Data Record of 1413
getUnitData::Exit(1413)
parseReadyNASData::Start
parseReadyNASData::Processing Outer Layer
parseReadyNASData::001F33EA0534: Adding MAC
parseReadyNASData::001F33EA0534: Adding HOST
parseReadyNASData::001F33EA0534: Adding IP Address
parseReadyNASData::001F33EA0534: Generating Summaries
parseReadyNASData::001F33EA0534: Building Disk List ( 6 Records )
parseReadyNASData::001F33EA0534: Processing System Status
parseReadyNASData::001F33EA0534: Generating System Summary
parseReadyNASData::Exit(0)
Unit #2:
Model: ReadyNAS Pro
OS: RAIDiator v4.2.5-T16 (Tue Apr 14 17:48:55 2009)
Host: pronto
IP: 192.168.2.6
MAC: 00:1F:33:EA:00:34
Cooling: 932RPM (OK)
System Temp: 60.0C/140.0F (OK)
UPS: Not present (NOT_PRESENT)
Volumes: Volume C: RAID Level X2, Redundant. 2224897 MB (78%) of 2774 GB used (OK)
Disks: 1: 43C/109F (OK); 2: 46C/114F (OK); 3: 44C/111F (OK); present: N/A (NOT_PRESENT); present: N/A (NOT_PRESENT); present: N/A (NOT_PRESENT)
Uptime: N/A
------------
Message 32 of 45
Lee_Thompson
Tutor

Re: PerlDar

chirpa wrote:
Okay, now it shows two, the localhost entry is gone (I'm running it directly on the NAS).

Each interface is giving back its own MAC address, so I'd say things are good now.


Could perhaps put an option in to filter out duplicate hostnames. I think I'll do that just so it's there.

I'd actually like to request some additional information be added to the RAIDar daemon, specifically system uptime. 🙂 ( Yeah I know the answer is probably no but I gotta try 😛 )
Message 33 of 45
Lee_Thompson
Tutor

Re: PerlDar

Lee Thompson wrote:
chirpa wrote:
Okay, now it shows two, the localhost entry is gone (I'm running it directly on the NAS).

Each interface is giving back its own MAC address, so I'd say things are good now.


Could perhaps put an option in to filter out duplicate hostnames. I think I'll do that just so it's there.

I'd actually like to request some additional information be added to the RAIDar daemon, specifically system uptime. 🙂 ( Yeah I know the answer is probably no but I gotta try 😛 )


Filter duplicate hostnames feature added, link updated.
Message 34 of 45
CharlesLaCour
Aspirant

Re: PerlDar

Thanks for the SNMP addition on this. It works great across network segments.

One comment on the note in sample.pl "SNMP (TCP)". SNMP by default uses UDP, as does the perl Net::SNMP module. here is an excerpt from the CPAN page on the SNMP module:

The Net::SNMP module uses UDP/IPv4 as the default Transport Domain to exchange SNMP messages between the local and remote devices. The module also supports UDP/IPv6, TCP/IPv4, and TCP/IPv6 as alternative Transport Domains. The -domain argument can be used to change the Transport Domain by setting the value to one of the following strings: 'udp6', 'udp/ipv6'; 'tcp', 'tcp4', 'tcp/ipv4'; 'tcp6', or 'tcp/ipv6'. The -domain argument also accepts the strings 'udp', 'udp4', or 'udp/ipv4' which correspond to the default Transport Domain of UDP/IPv4.
Message 35 of 45
Lee_Thompson
Tutor

Re: PerlDar

CharlesLaCour wrote:
Thanks for the SNMP addition on this. It works great across network segments.

One comment on the note in sample.pl "SNMP (TCP)". SNMP by default uses UDP, as does the perl Net::SNMP module. here is an excerpt from the CPAN page on the SNMP module:

The Net::SNMP module uses UDP/IPv4 as the default Transport Domain to exchange SNMP messages between the local and remote devices. The module also supports UDP/IPv6, TCP/IPv4, and TCP/IPv6 as alternative Transport Domains. The -domain argument can be used to change the Transport Domain by setting the value to one of the following strings: 'udp6', 'udp/ipv6'; 'tcp', 'tcp4', 'tcp/ipv4'; 'tcp6', or 'tcp/ipv6'. The -domain argument also accepts the strings 'udp', 'udp4', or 'udp/ipv4' which correspond to the default Transport Domain of UDP/IPv4.


Ah, whoops. I'll update the documentation.
Message 36 of 45
chirpa
Luminary

Re: PerlDar

On my LAN here, with 14 ReadyNAS's, the script takes forever it seems. Where RAIDar gets data and reports then all there within 10 seconds, your script takes 3m25.605s to do the same output.

It receives a packet from one system, then:
receiveUDPPackets::Waiting for Timeout or New Data (up to 5 second(s))
Few seconds later, another packet, and that timeout again...

Was going to PM you the output, but "Your message contains 221799 characters. The maximum number of allowed characters is 60000." heh. I'll send you a URL with the output instead.
Message 37 of 45
chirpa
Luminary

Re: PerlDar

Changing the timeouts as per your PM brought it down to: 0m41.178s
identifyProgram::Socket Timeout: 1
identifyProgram:: Error Timeout: 1
Message 38 of 45
chirpa
Luminary

Re: PerlDar

Setting
identifyProgram:: Error Timeout: 0
makes it respond in 0m1.789s 🙂 Still reports the 14 systems as I expected.
Message 39 of 45
chirpa
Luminary

Re: PerlDar

Webstats PL isn't filling in the HREF clickable admin links for me, using latest version from your webpage.

<a href=http:///admin>QA-NV</a>
Message 40 of 45
Lee_Thompson
Tutor

Re: PerlDar

chirpa wrote:
Webstats PL isn't filling in the HREF clickable admin links for me, using latest version from your webpage.

<a href=http:///admin>QA-NV</a>


Something on your network isn't providing reverse DNS lookups for your ReadyNAS unit(s). I'll look to see if there's another way to do it as a fallback.

This is the call I'm doing:


gethostbyaddr(inet_aton($unit{$macindex}{ipaddr}{0}),AF_INET)
Message 41 of 45
Lee_Thompson
Tutor

Re: PerlDar

chirpa wrote:
Webstats PL isn't filling in the HREF clickable admin links for me, using latest version from your webpage.

<a href=http:///admin>QA-NV</a>


Refreshed the distribution with a new sample-webstats.pl that tries harder to get a hostname and will now fall back to the IP address if it fails.
Message 42 of 45
chirpa
Luminary

Re: PerlDar

Looks good.
Message 43 of 45
Hustep
Aspirant

Re: PerlDar

chirpa wrote:
Setting
identifyProgram:: Error Timeout: 0
makes it respond in 0m1.789s 🙂 Still reports the 14 systems as I expected.

it seems your code does not work at all; even if rectified to work, it is not so efficient when regex engine is involved.
Message 44 of 45
chirpa
Luminary

Re: PerlDar

Lee, you still around? GPL package for 4.2.21,etc has raidard in it, which should help to decode the packets easier.
Message 45 of 45
Top Contributors
Discussion stats
  • 44 replies
  • 5583 views
  • 0 kudos
  • 5 in conversation
Announcements