[Plug-In] SNMP


256 posts in this topic Last Reply

Recommended Posts

@Ak1rA 

This is the line that grabs the temperature in the current version: https://github.com/kubedzero/unraid-snmp/blob/347d46ed7f938b85a9f9e112df4e350bda348a4b/source/usr/local/emhttp/plugins/snmp/disk_temps.sh#L98

smartctl --nocheck standby -A /dev/sdc

What does that print out when you replace "sdc" with your various drives?

 

The old code uses the same command, without the standby check: https://github.com/kubedzero/unraid-snmp/blob/6d4d8a77e4c44e827b19f9814fab5b7debfa90b9/drive_temps.sh#L71

smartctl -A /dev/sdc

In comparison, what does that print out when you replace "sdc" with your various drives? 

 

The old code would spin the drive up to check the temperature, therefore changing the behavior of the drive simply by monitoring. The new code uses the standby check to avoid influencing the behavior and reporting -2 in that case. -1 would indicate there  was an error during parsing, which doesn't seem to be happening here. 


My guesses here are:

  • Your drives in the array are not spun up, and are therefore correctly reporting in standby mode (The "MAIN" page should also report * values for drive  temperature)
  • There is an issue parsing "standby" out of  your SmartCTL responses, which if you provide the output I can better debug
  • SmartCTL isn't correctly reporting your drive's standby state or temperature. This could be due to an HBA/RAID card or a number of other reasons 

 

If  you could provide the printouts of running those commands on your drives, that would be super helpful! I only have recent Western Digital drives directly attached to the motherboard, so your mix of Seagate, HGST, Hitachi, and WD might provide valuable insight. 

 

Thanks! 

Link to post
  • Replies 255
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

Created a pull request for the Coppit package on GitHub https://github.com/coppit/unraid-snmp/pull/6 but it doesn't seem like they've been active since August 2018 on here or on GitHub.   Wi

SNMP is a standard way to get raw data from devices, for monitoring purposes. With this package, you can hook your UNRAID server up to a monitor, and track things like network usage, cpu activity, eve

ok so I installed it, but important question: where can I set the SNMP community string?

Posted Images

@kubed_zero

this is my results
 

smartctl --nocheck standby -A /dev/sde
smartctl 7.1 2019-12-30 r5022 [x86_64-linux-4.19.107-Unraid] (local build)
Copyright (C) 2002-19, Bruce Allen, Christian Franke, www.smartmontools.org

Device is in STANDBY mode, exit(2)

and
 

smartctl -A /dev/sde
smartctl 7.1 2019-12-30 r5022 [x86_64-linux-4.19.107-Unraid] (local build)
Copyright (C) 2002-19, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF READ SMART DATA SECTION ===
SMART Attributes Data Structure revision number: 16
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
..cut..
194 Temperature_Celsius     0x0002   181   181   000    Old_age   Always       -       33 (Min/Max 22/61)
..cut..

and If I repeat the first command:

 

Quote

smartctl -A /dev/sde
smartctl 7.1 2019-12-30 r5022 [x86_64-linux-4.19.107-Unraid] (local build)
Copyright (C) 2002-19, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF READ SMART DATA SECTION ===
SMART Attributes Data Structure revision number: 16
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
..cut..
194 Temperature_Celsius     0x0002   181   181   000    Old_age   Always       -       33 (Min/Max 22/61)
..cut..

 

but the hdd is spin-down status

 

image.thumb.png.ce47d7334c20c3c7a568cb31bc067da3.png

Link to post

Since smartctl -A /dev/sde wakes up the drive to get the temperature and running smartctl --nocheck standby -A /dev/sde afterwards can then capitalize on the fact that the disk is already awake, I'd expect both to print temperatures only after the disk is woken up. 

 

My understanding is that the MAIN dashboard's disk state + temp can lag behind the actual temperature. The maintainer noted that this delay is managed by the Settings > Disk Settings > poll_attributes setting, where 1800 (30 minutes) is the default update rate. With that in mind, I'd imagine the MAIN dashboard would eventually show that your drive is spun up and has a temperature after 30 minutes (assuming the spin down time isn't less than that, or that you continuously call smartctl to keep the disk awake)

 

 

Could you experiment with this and let me know if this explains the issue you are facing? 

 

 

As another experiment, if you change your Settings > Disk Settings > spin down delay to  Never (and make sure each of your disks don't override this setting), do you then find that SNMP will always report disk temperatures? 

Link to post

I spoke offline with @Ak1rA and we confirmed that the plugin is working as expected. The issue was that HDDs don't report temperature while they are in standby. The older versions of the plugin would wake disks from standby so they could always fetch a temperature, and the new version does not do this. Instead of waking up the disk to fetch the temperature, it will recognize STANDBY mode and report a temperature of -2. We tested and confirmed that the temperatures report without issue once the disks are spun up. 

 

That said, I'm looking into adding a Settings page for SNMP that could toggle this behavior. If you always want drives to report temperatures at the expense of keeping them spun up, the setting should enable this "unsafe temperature checking" behavior. I use "unsafe" in the sense that the theoretically passive act of getting the temperature may change the behavior and standby/active status of the disk. 

 

Also in the next update should be a new category of measurements for a few different RAM/memory metrics. 

Link to post

I just released another update to the plugin, and the current version is now 2020.10.04. This update adds a Settings page where the SMART standby validation can be disabled. This is for people such as @Ak1rA who want the temperatures to always report, even if it means waking disks from standby. 

 

The update also adds a set of memory metric outputs to SNMP.

NET-SNMP-EXTEND-MIB::nsExtendOutLine."meminfo".1 = STRING: MemTotal: 25278668800
NET-SNMP-EXTEND-MIB::nsExtendOutLine."meminfo".2 = STRING: MemFree: 230752256
NET-SNMP-EXTEND-MIB::nsExtendOutLine."meminfo".3 = STRING: MemAvailable: 22541844480
NET-SNMP-EXTEND-MIB::nsExtendOutLine."meminfo".4 = STRING: Cached: 23716921344
NET-SNMP-EXTEND-MIB::nsExtendOutLine."meminfo".5 = STRING: Active: 1580380160
NET-SNMP-EXTEND-MIB::nsExtendOutLine."meminfo".6 = STRING: Inactive: 22691184640
NET-SNMP-EXTEND-MIB::nsExtendOutLine."meminfo".7 = STRING: Committed_AS: 1893945344

 

As a reminder, the PLG file is https://raw.githubusercontent.com/kubedzero/unraid-snmp/main/snmp.plg

 

Let me know if you run into installation or usage issues! 

Edited by kubed_zero
hyperlinked PLG
Link to post
  • 4 weeks later...

How to change:

                                                      
 

Quote

rocommunity
syslocation
syscontact

 

Quote

 

and add:

# This line allows Observium to detect the host OS if the distro script is installed
extend .1.3.6.1.4.1.2021.7890.1 distro /usr/bin/distro

 

I have created file /usr/bin/distro for check OS type.
 

Link to post

Edit the snmpd.conf file in /etc/snmp and restart with /etc/rc.d/rc.snmpd restart

 

root@Tower:/etc/snmp# ls -l
total 24
-rw-r--r-- 1 root root   851 Oct 23 19:14 snmpd.conf
-rw-r--r-- 1 root root 18579 Aug 15 19:39 snmpd.conf~
root@Tower:/etc/snmp# 

 

syslocation here
syscontact root@tower
disk /mnt/disk1
disk /mnt/disk2
disk /mnt/disk3
disk /mnt/disk4
disk /mnt/disk5
disk /mnt/disk6
disk /mnt/disk7
disk /mnt/disk8
disk /mnt/disk9
disk /mnt/disk10
disk /mnt/disk11
disk /mnt/disk12
disk /mnt/disk13
disk /mnt/disk14
disk /mnt/disk15
disk /mnt/disk16
disk /mnt/disk17
disk /mnt/disk18
disk /mnt/disk19
disk /mnt/disk20
disk /mnt/disk21
disk /mnt/disk22
disk /mnt/disk23
disk /mnt/disk24
disk /mnt/disk25
disk /mnt/disk26
disk /mnt/disk27
disk /mnt/disk28
disk /mnt/cache

extend cpumhz /usr/local/emhttp/plugins/snmp/cpu_mhz.sh
extend diskfree /usr/local/emhttp/plugins/snmp/disk_free_space.sh
extend disktemp /usr/local/emhttp/plugins/snmp/disk_temps.sh
extend meminfo /usr/local/emhttp/plugins/snmp/mem_info.sh
extend sharefree /usr/local/emhttp/plugins/snmp/share_free_space.sh
root@Tower:/etc/snmp# ls -l
total 24
-rw-r--r-- 1 root root   851 Oct 23 19:14 snmpd.conf
-rw-r--r-- 1 root root 18579 Aug 15 19:39 snmpd.conf~
root@Tower:/etc/snmp# 

 

You will need to make copy of the conf file on the boot drive and copy back via the go file if you change from the defaults.

Edited by SimonF
Link to post
  • 3 weeks later...

As a heads up to consumers of this plugin, I'm working on changing the branch name from "master" to "main" following Github's recent announcement. At this moment, I have the plugin's original "master" branch on the current version 2020.10.04 in addition to the new "main" branch with a bumped version 2020.11.20 containing the exact same data. 

I'm doing some investigation on whether I'll be able to seamlessly transition people using the existing version of SNMP over to this new branch. Of course, the other option is to just uninstall the existing installation of SNMP and reinstall using the new link: https://raw.githubusercontent.com/kubedzero/unraid-snmp/main/snmp.plg

I've also updated the Community Apps XML repo with the same branch change, and have modified the XML in both "master" and "main" to point at the "main" version of the SNMP plugin. I'm hoping this will get new adopters on the version I'll be supporting in the future. @Squid is there anything further I need to do to change CA from tracking https://raw.githubusercontent.com/kubedzero/unraid-community-apps-xml/master/snmp.xml to instead track https://raw.githubusercontent.com/kubedzero/unraid-community-apps-xml/main/snmp.xml ?

Finally, I'm going to be editing my posts in this forum topic to point at the new branch, to try and catch new folks. 

 

One more time, the new link to the plugin's PLG install file is https://raw.githubusercontent.com/kubedzero/unraid-snmp/main/snmp.plg

 

Link to post

The changes are fine.  Current users will need to uninstall / reinstall in order to get onto the correct version.

 

Other than that, there is no requirement that you have to switch the branch from master to main.  Only newly created repositories have the branch listed as main.  GitHub is not renaming any existing master branches.

Link to post
1 minute ago, Squid said:

GitHub is not renaming any existing master branches.

Understood, I'm proactively making these changes to my repositories

 

1 minute ago, Squid said:

Current users will need to uninstall / reinstall in order to get onto the correct version.

I have tested that if I push an update on the master branch pointing to the PLG+TXZ on the main branch, it effectively migrates users to the new branch. That, I think, is a second option for getting onto the correct version.

 

My question had actually been more about the CA XML update, as I wasn't sure if something on the CA side of things was tracking the XML on a specific branch. Sorry for the miscommunication!

Link to post
16 minutes ago, kubed_zero said:

My question had actually been more about the CA XML update, as I wasn't sure if something on the CA side of things was tracking the XML on a specific branch

The system will wind up blacklisting the app if the PluginURL on the xml and within the .plg don't match.  Security measure to prevent an author from having the user install one plugin and then the author decides to have them install another one without the user's permission.

Link to post
  • 3 weeks later...
1 minute ago, Mr_Jay84 said:

Can I use this to collect SNMP data from and APC AP9360 UPS card/QNAP NAS and send to telegraf?

It sounds to me as if you need an SNMP collector, and this plugin is just meant to add SNMP output to Unraid. Perhaps you could mod this plugin's snmpd.conf file and write a script to collect the APC and QNAP metrics, but you'd still need something outside this plugin to actually read the SNMP data and get it to Telegraf/InfluxDB. 

Link to post
  • 2 months later...
2 minutes ago, SimplifyAndAddCoffee said:

currently not showing as installable in CA with 6.9.0 RC2 and Nerd Tools 2021-01-08

 

Is this intended?

I can't comment on the functionality of CA, but there is nothing on my end that's keeping it from showing up in CA https://github.com/kubedzero/unraid-community-apps-xml/blob/main/snmp.xml

 

If CA becomes a problem, feel free to install it directly as I've tested it to be working on 6.9 https://raw.githubusercontent.com/kubedzero/unraid-snmp/main/snmp.plg

Link to post
1 hour ago, SimplifyAndAddCoffee said:

currently not showing as installable in CA with 6.9.0 RC2 and Nerd Tools 2021-01-08

 

Is this intended?

I just tested on RC2 and CA version 2021.02.19a and was able to search for and install SNMP without issue. 

Link to post
13 minutes ago, SimplifyAndAddCoffee said:

ok so I installed it, but important question: where can I set the SNMP community string?

https://github.com/kubedzero/unraid-snmp/blob/main/source/install/doinst.sh#L38

 

The configuration in which the community string is set is /etc/snmp/snmpd.conf. Note that this gets recreated at every boot (as with the rest of Unraid's OS) so you'll need a command in the /boot/config/go startup script to overwrite the default value or made modifications, along with a command to restart SNMP to take the new changes. 

 

Link to post
  • 1 month later...
On 2/19/2021 at 6:08 PM, SimplifyAndAddCoffee said:

ok so I installed it, but important question: where can I set the SNMP community string?

I wrote a User Script to do this at the start of my array. The sed command will replace "public" with whatever you put in the 2nd portion of the command and then overwrite the existing file. Then 2nd line restarts the service.

 

#!/bin/bash
sed -i 's/public/other-string/' /etc/snmp/snmpd.conf
bash /etc/rc.d/rc.snmpd restart

 

Link to post
  • 2 weeks later...

It seems that when I install this it uses a different config file:

 

root@Tower:~# ps auxf | grep snmpd
root     16826  0.0  0.0   3904  1916 pts/2    S+   20:16   0:00          \_ grep snmpd
root     16351  0.0  0.0  22996  8204 ?        S    20:16   0:00 /usr/sbin/snmpd -LF w /var/log/snmpd.log -A -p /var/run/snmpd -a -c /usr/local/emhttp/plugins/snmp/snmpd.conf

 

But in the link from @kubed_zero above it looks like what file should be copied to /etc/snmp/snmpd.conf? Am I doing something wrong? Simply installed this plugin and I did nothing else so?

 

So should I then edit that file? Or can we make a change to choose what file to use?

 

Might be a nice config option right? That you can provide the path to the config file? Then you can even save that file on flash if this process starts before the array.

Link to post
33 minutes ago, mattie112 said:

It seems that when I install this it uses a different config file:

 


root@Tower:~# ps auxf | grep snmpd
root     16826  0.0  0.0   3904  1916 pts/2    S+   20:16   0:00          \_ grep snmpd
root     16351  0.0  0.0  22996  8204 ?        S    20:16   0:00 /usr/sbin/snmpd -LF w /var/log/snmpd.log -A -p /var/run/snmpd -a -c /usr/local/emhttp/plugins/snmp/snmpd.conf

 

But in the link from @kubed_zero above it looks like what file should be copied to /etc/snmp/snmpd.conf? Am I doing something wrong? Simply installed this plugin and I did nothing else so?

 

So should I then edit that file? Or can we make a change to choose what file to use?

 

Might be a nice config option right? That you can provide the path to the config file? Then you can even save that file on flash if this process starts before the array.

https://github.com/coppit/unraid-snmp/blob/master/snmp.plg#L197 The old version of the plugin (still linked in the first post of this topic) read from /usr/local/emhttp/plugins/snmp/snmpd.conf which sounds to be the issue you're facing. Are you using my latest version of the plugin, 2020.11.20, installed from Community Applications or https://github.com/kubedzero/unraid-snmp? It will start SNMP with the config file at /etc/snmp/snmpd.conf. 

 

Configuring the SNMP configuration via a GUI setting could be nice, please submit a PR! 

Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.