Hello. Am I able to configure my TrueNAS Core (TrueNAS-13.0-U6.1) to emit a constant beep if there is an error with storage or something else that will cause further operation unhealthy to my data? My system consists of 2 pools, one has 2 drives of 8Tb each in a mirror and the other has 6 drives of 14Tb in RAID-Z2. Occasionally prior to me replacing the drive data cables I would get errors like this:
CRITICAL
Device: /dev/da1 [SAT], ATA error count increased from 321 to 433.
2023-06-01 02:43:52 PM (America/New_York)
I solved the problem by buying a new set of drive data cables for my HBA controller and the errors appeared to have stopped. My server is approaching the age of 6 years and the next failure could be the hard drives. I have one spare drive for the 6 drive pool but none for the mirror pool, so I would like to replace a drive as soon as it happens. The server is in the next room and if I could hear repeating beep from the onboard speaker that would help me with this. Also, server is not able to access the internet and only local machines can connect to it. Does anyone know of a way this can be implemented? I can follow directions and this is how I set up the server in the first place. I am a noob when it comes to making scripts and I would rather not upgrade to a newer TrueNAS as I am worried that something will happen with my data. The TruNAS version installed is the newest one I downloaded when first building this server. Thanks to anyone that can help me.
I have already looked there. There is no way to alert me on another computer if one drive has failed as I have redundancy in both pools and the server will still operate in unhealthy state. What I should have mentioned is that the server is not able to access the internet and only local machines can connect to it. I will put this in the original post. Thanks for the reply.
Here is a wild idea which probably is not possible. Does any other NAS software preferably from TrueNAS developers is compatible with both of my storage pools and can import a config file from my current TrueNAS Core (TrueNAS-13.0-U6.1) install and has a PC speaker beep or even a way to flash the power or drive leds as and option for error notifications? How about something connected to the USB port? I am willing to switch if it can be done without email and will not lose my data or config. I spent a lot of time setting this up and I absolutely cannot loose any data I have. I created this server to consolidate many loose harddrives that stored every video, picture and music I ever downloaded/created. I know I am not following the best backup practices, but that is what I have now. I created the 6 drive pool, so I have lower chance of data loss by giving it 2 extra drives for insurance if I have a failure and it generally not common for 2 drives to fail at the same time. I also got the Seasonic power supply as they are supposed to be bulletproof.
Considering that Is pretty cheap and easy to connect a Raspberry pi Pico to a TN server for display data on a LCD… Why not do the same, but using instead a speaker to play sounds?
I don’t know if using the internal speaker Is possibile, but this way you can do pretty everything you want spending at worst 3€.
A cronjob script launched periodically will retrieve using midclt call alerts.lists (or whatever) some alerts raised, and send ro the Raspberry that will be loaded just with a function to drive the right sound to play on the speaker.
You can make NAS able to access the internet, and still only local machines would be able to connect to NAS – TCP/IP connections are oriented.
Anyway, as @neofusion already mentioned, you can set up a local email server. Or you can set up an apprise server and then route all notifications to any major messenger/logger/etc.
I personally use this approach; the only issue is that truenas doesn’t support apprise per se. However, the slack option with https://{apprise-url}/notify/{apprise-config-id}?tag=truenas&title=Truenas%20alert&:text=body does the trick. Don’t remember where I found this solution (it can be this very forum), so my apologies to the author for not paying credit.
Thanks to all. I thought this would be something simple. I don’t feel comfortable messing around with the suggestions above, and I don’t want to lose my data or have the server not boot because of something I messed up. That is also why my version is 6 years old, and I don’t want to change it while I have no reason to. Something else I just thought of. Is there a way to send some kind of notifications to all clients on the local network? I don’t mind installing extra software on those. Pretty much all the machines I access TrueNAS from are Windows and use SAMBA shares. I have one Mac Mini M1, but honestly I don’t care if that gets the notifications as I rarely use the Mac. You guys mentioned Raspberry Pi. I have a Pi hole set up on the network. All I do on that is update the Pi hole part of it once in a while and that’s it. it’s a Pi 4 with 8 gigs ram.
i mentioned it because some time ago i soldered it to a display, connected to the truenas box via usb, and with a a simple micropython script i was able to display all relevant information retrieved via midclt. Also your use case will be much easier to achieve.
Having said that… I’m of the opinion that you should consider first other suggestion, and take this advice only if you really want achieve this “acoustically”
So, messing with an official and maintained by truenas team approach for notifications is uncomfortable. Yet, a self-written script for beeping is a way to go. Seems legit. Perhaps I’m just misunderstanding something…
Apprise, local mail server, SNMP. All these options are available as an alert’s target. Welp, I do believe that at least mail and SNMP are present in 13.0.
I ended doing this a few years back when I did not have an alerts/notification system and needed to monitor some Bitcoin machines.
Basically I had an Ubuntu VM, with xrdp+sound, so I could open the desktop from Windows and run a monitoring script.
In order to HEAR the sound you have 2 choices:
Make the BELL sound in a Terminal, (local console or remote), or
Use the beep command to produce sound in the speakers of the TN server.
Method 1: Using Standard Terminal Commands
The quickest way without installing new software is to send the ASCII BEL character (\a or \007) to your standard output. [1, 2]
Using echo:
bash
echo -e "\a"
Use code with caution.
Using printf:
bash
printf "\a"
Use code with caution.
Using tput:
bash
tput bel
Use code with caution.
Method 2: Using the Dedicated beep Utility
If you need precision control over the pitch and duration of the sound, install the beep package via your package manager (e.g., sudo apt install beep or sudo dnf install beep). [1, 2]
Standard beep:
bash
beep
Use code with caution.
Custom pitch and length: Play a tone at 440Hz for 500 milliseconds:
bash
beep -f 440 -l 500
Use code with caution.
Repeating tones: Play a sound 3 times with a 100 millisecond delay in between:
That’s great but I think he wants to have the Truenas Server send an alert message? or somehow make the bell sound on a client machine if there is an alert or warning on the Truenas server.
You can do this with pyhon in a docker container running independently of the Truenas app system (create a docker_apps dataset on your data pool, and a alert-dispatcher dataset within it to hold the necessary docker files and the .py scipt). but you also need a specific python script on each client to listen for the server to send the message, receive the message then have the client script perform what you wish it to do.
I have a setup that does send the alert and I get it as a notice on my linux laptop in this fashion. I run it as a post_init so it starts whenever the system starts or is rebooted.
I think the obversion is mainly due to inexperience using something not prebuilt. I do think TrueNAS should have a bell type function but it does not.
@Sonicmixmaster if you stick to what is being suggested, your data would never be at risk. You would really need to do something seriously wrong to delete your data.
Maybe you should first do what @truenas-fan has suggested first. See if you can manually make the the beep. If that works, then sweat talk @PhilD13 (sorry buddy) and he might provide you the docker data needed to make it work. It is a learning adventure.
But, if you are unwilling to do this kind of stuff due to fear of data deletion, that is fine.
Remember one thing you will see here over and over again, a NAS is not a backup.