Monitoring my DNS323 with Home Assistant

388 views
Skip to first unread message

Scott O'Brien

unread,
Sep 19, 2020, 9:40:52 PM9/19/20
to Alt-F
Just for the record, here is what I have managed in getting Home Assistant (www.home-assistant.io) to monitor the state of my DNS-323 that is running Alt-F:

Untitled.png

1. The Connected icon is shown as an entity card. It is activated with this in my config yaml file:

binary_sensor:
#dns-323
  - platform: ping
    host: 192.168.1.99
    count: 2

2. The disk temperature is shown also using an entity card, activated with this:

sensor:
  - platform: hddtemp
    host: 192.168.1.99
    disks:
      - /dev/sda
      - /dev/sdb

To get this working I first installed the hddtemp package in Alt-F usig the Packages page on the web UI.
Next, I had to modify the ./etc/init.d/S20hddtemp file. I logged in via SSH to do that (I use putty on Windows and a previously installed nano editor) . The modification I made, based on a previous post, was to change this line from localhost to this:

HDDTEMP_LISTEN=0.0.0.0

As I understand it, this allows the hddtemp server now running on Alt-F to listen for requests for information from all network addresses, not just itself.

Perhaps Joao could make this the default, or at least configurable via the UI?

3. My next step is to configure Home Assistant for alerts and notifications if the DNS-323 goes offline, or the temps get too high.

4. What I really want but have not been able to do is monitor the RAID Status. I thought I could scrape the data from the Status page using this (https://www.home-assistant.io/integrations/scrape/) but have not been successful. I have some alternative ideas (parsing the output from this command: mdadm -D /dev/md0), but any suggestions or solutions welcome.

Nicolas Desveaux

unread,
Sep 20, 2020, 11:05:50 AM9/20/20
to al...@googlegroups.com
Wow amazing. Thank you for sharing this. I am just getting started with Home assistant. That lovelace UI looks super cool as well! Kudos
Please keep updating this thread as you progress. Thanks!

--
You received this message because you are subscribed to the Google Groups "Alt-F" group.
To unsubscribe from this group and stop receiving emails from it, send an email to alt-f+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/alt-f/70c0cdbf-f017-439b-aeaf-71d24ca9496fn%40googlegroups.com.

ScDc

unread,
Sep 22, 2020, 2:16:52 AM9/22/20
to Alt-F
+1

Thanks!

idz...@gmail.com

unread,
Sep 22, 2020, 4:44:05 AM9/22/20
to Alt-F
I'm trying to achieve the same thing, but how did you get the card enable in UI, I try to add the same configuration but it saying the entities does not have ID so I can't add it to the UI

Scott O'Brien

unread,
Sep 22, 2020, 4:52:55 AM9/22/20
to Alt-F
Which card are you referring to? The one for the ping binary sensor or the hddtemp sensor?

Get the ping sensor working first. Use the Entities list in the Configuration screen to see the avalalble entities and their id's.

Nicolas Desveaux

unread,
Sep 22, 2020, 5:36:18 AM9/22/20
to al...@googlegroups.com
Have you thought about using SMTP at all? At least to retrieve data (maybe it contains raid info/health)

--
You received this message because you are subscribed to the Google Groups "Alt-F" group.
To unsubscribe from this group and stop receiving emails from it, send an email to alt-f+un...@googlegroups.com.

Nicolas Desveaux

unread,
Sep 22, 2020, 5:38:24 AM9/22/20
to al...@googlegroups.com
Sorry I meant SNMP :D

Scott O'Brien

unread,
Sep 22, 2020, 7:40:16 AM9/22/20
to Alt-F
Hi Nicolas,

I have never used SNMP before. Am looking at it now but it seems  .... complicated .....

I have found the .conf files in /Alt-F/etc/snmp/ and am now just working through them.

Thanks for the tip. I'll will post back if I get it to work.

idz...@gmail.com

unread,
Sep 22, 2020, 8:30:02 AM9/22/20
to Alt-F
I added the ping sensor in my configuration files but in the entities it showing this

binary_sensor:
#dns-323
  - platform: ping
    host: 172.16.1.7
    count: 2
    name: DNS-323


dns323.JPG

Scott O'Brien

unread,
Sep 22, 2020, 9:18:24 AM9/22/20
to Alt-F
That looks correct - it looks the same as mine - there are no settings you can modify via the UI as you have added the sensor via the YAML file (as I understand it).

Now just add an entity card in your lovelace panel and choose that entity.

Scott



Scott O'Brien

unread,
Sep 26, 2020, 7:06:04 AM9/26/20
to Alt-F
Using Nicolas's suggestion of using SNMP, I now have the RAID status monitoring in Home Assistant:


To do this I did the following:
1. Installed the netsnmp Alt-F package.
2. Set the snmpd daemon to run on startup using a user script in the Alt-F Services / User menu
3. Created a script file called cron_script.sh in my raid FS mountpoint (DNS323RAIDFS). This script scrapes the /proc/mdstat file for the (ideally) [UU] text and stores it into a file called raid_status:
awk '/blocks/ {print $NF}'  /proc/mdstat > /mnt/DNS323RAIDFS/raid_status
4. Set the cron_script.sh file to run every 10 minutes using the Cron configuration in the Services / System page.
5. Added this line to the snmpd.conf file in the /Alt-F/etc/snmp folder:
extend raid_status /bin/cat /mnt/DNS323RAIDFS/raid_status
6. Added this to my Home Assistant configuration.yaml file:
  - platform: snmp
    scan_interval: 120
    host: 192.168.1.99
    baseoid: .1.3.6.1.4.1.8072.1.3.2.3.1.1.11.114.97.105.100.95.115.116.97.116.117.115
    name: 'DNS323 RAID Status'
    value_template: >-
      {% if value == '[UU]' %}
      Good
      {% else %}
      Bad
      {% endif %}

Finding the correct OID was the tricky part. The extend command added to the snmpd.conf file created an MIB like this:
NET-SNMP-EXTEND-MIB::nsExtendOutput1Line."raid_status"

Using snmptranslate I got the OID:
snmptranslate .1.3.6.1.4.1.8072.1.3.2.3.1.1.11.114.97.105.100.95.115.116.97.116.117.115



Nicolas Desveaux

unread,
Sep 26, 2020, 2:28:55 PM9/26/20
to al...@googlegroups.com
Amazing @Scott
And thank you for providing detailed methods on how to achieve same result. Can you show us your lovelace UI now if that's ok? :)

--
You received this message because you are subscribed to the Google Groups "Alt-F" group.
To unsubscribe from this group and stop receiving emails from it, send an email to alt-f+un...@googlegroups.com.

Scott O'Brien

unread,
Sep 26, 2020, 10:05:35 PM9/26/20
to Alt-F
Hi Nicolas,

Sorry my previous message didn't include the screenshots for some reason, and I realise the explanation at the end was written incorrectly.

First, here is my UI:

When the DNS323 is offline the RAID status shows Unknown. It takes a few minutes for the status to update - its not instantaneous but that's fine for me.

Second, this is the cron config:


Third, to find the OID:

1. This command will list the extensions as MIB text:
  snmpwalk -v 2c -c public localhost NET-SNMP-EXTEND-MIB::nsExtendOutput1Line
It gives an output of this:
  NET-SNMP-EXTEND-MIB::nsExtendOutput1Line."raid_status" = STRING: [UU]
  NET-SNMP-EXTEND-MIB::nsExtendOutput1Line."system_fan_speed" = STRING: 2857
  NET-SNMP-EXTEND-MIB::nsExtendOutput1Line."system_temperature" = STRING: 42500


2. This command will show that the OID number I used converts to that extension entry:
  snmptranslate .1.3.6.1.4.1.8072.1.3.2.3.1.1.11.114.97.105.100.95.115.116.97.116.117.115
It gives an output of this:
  NET-SNMP-EXTEND-MIB::nsExtendOutput1Line."raid_status"
So how did I get the number in the first place? I remember doing this successfully , but it no longer works for some reason:
  snmptranslate -On NET-SNMP-EXTEND-MIB::nsExtendOutput1Line."raid_status"
Now I am getting this error message:
  Unknown Object Identifier (Index out of range: raid_status (nsExtendToken))
Sorry. Presumably my memory is faulty and I did something else.
But it should be possible to work out the correct numbers as the last 11 numbers match the ASCII codes for the 11 characters making up raid_status - lower case r is ASCII 114 etc.

Hope that helps clarify some things.

Scott O'Brien

unread,
Sep 26, 2020, 10:07:30 PM9/26/20
to Alt-F
Bah, cant get images to post using drag and drop. Wll try attaching:

Capture3.PNG

Capture2.PNG

Alex Garbino

unread,
Aug 28, 2024, 9:30:01 PM8/28/24
to Alt-F
Hello!

I'm trying to replicate this on a recent install of AltF (amazing tool, thanks for saving my hardware).

I'm trying to follow the above instructions, but ran into a couple of snags:

Ping:
- 'binary' sensor is not used anymore - just use the 'ping' add on, it works easily

Temp:
- got it to work; would add that the system needed to be rebooted and then run via Services -> system and add to boot up

Raid Status:
I do not know how to do this:
Set the snmpd daemon to run on startup using a user script in the Alt-F Services / User menu

Can someone clarify the above - or is there a better way to monitor the NAS from Home Assitant?
Thanks,
Alex
Reply all
Reply to author
Forward
Message has been deleted
0 new messages