Tricky situation here. Badblocks is a standard choice for testing hard drives under linux, but it’ll shred the data currently on the drive and probably remove your warranty in the process. It’ll kill the OS as well, as the OS running the NAS is unfortunately (mostly) on the hard drive. Nondestructive tests just aren’t as thorough
I’d suggest you contact WD support directly, and request either a rma or software that can demonstrate conclusively whether the drive is on the way out or not. Good luck