Issue with mdadm app script

So I’m currently expanding a mdadm RAID6 from 4 2TB disks to 5 2TB disks.

The mdadm script on the host with the array returns the following error:

/etc/snmp/mdadm: line 84: let: 5 (4): syntax error in expression (error token is “(4)”)
/etc/snmp/mdadm: line 85: [: -lt: unary operator expected
{“data”:[{“name”:“md3”,“level”:“raid6”,“size”:“4000525058048”,“disc_count”:“5 (4)”,“hotspare_count”:“”,“device_list”:[“sdm1”,“sdn1”,“sdo1”,“sdp1”,“sdq1”],“missing_device_list”:,“state”:“clean”,“action”:“reshape”,“degraded”:“0”,“sync_speed”:“32571392”,“sync_completed”:“2”}],“error”:“0”,“errorString”:“”,“version”:“1”}

The following error is given from the poller.php on librenms host:

Load poller module applications

mdadm:-3:Invalid JSON

With debug:

Load poller module applications ####

SQL[ SELECT * FROM applications WHERE device_id = ? [65] 0.6ms]

SNMP[‘/usr/bin/snmpget’ ‘-v2c’ ‘-c’ ‘COMMUNITY’ ‘-Oqv’ ‘-m’ ‘NET-SNMP-EXTEND-MIB’ ‘-M’ ‘/opt/librenms/mibs’ ‘udp:HOSTNAME:161’ ‘nsExtendOutputFull.5.109.100.97.100.109’]

/etc/snmp/mdadm: line 84: let: 5 (4): syntax error in expression (error token is "(4)")

/etc/snmp/mdadm: line 85: [: -lt: unary operator expected

{"data":[{"name":"md3","level":"raid6","size":"4000525058048","disc_count":"5 (4)","hotspare_count":"","device_list":["sdm1","sdn1","sdo1","sdp1","sdq1"],"missing_device_list":,"state":"clean","action":"reshape","degraded":"0","sync_speed":"33653760","sync_completed":"2"}],"error":"0","errorString":"","version":"1"}

mdadm:-3:Invalid JSON

No other errors are shown in the poller output.

So it doesn’t like the fact that the number of disks has changed.

seems like you catched a case which wasn’t recognized till now.
i assume you didn’t write a patch or had a dump of all varable contents of script?

No patch. I’m no good at scripting aside from basic bash backup scripts.

Let me know what type of dumps you need and I can post them here or if they’re long I’ll upload them to https://p.libren.ms/.

i’ll built up a testsystem and recheck your issue. If i approve it i’ll fix the problem.

FIx is out, thx for the hint

Perfect! That did the trick. Much appreciated.