[Plug-In] SNMP


Recommended Posts

On 8/18/2022 at 9:01 PM, cjhammel said:

It looks like the install script only checks with public as the rocommunity string.  I found that if public is not the rocommunity string snmpwalk fails and the plugin fails the check.  After 2 reboots the SNMP plugin uninstalls.  If you have the rocommunity string as public then it will survive the reboot. 

 

I'm looking to get this running for communicating Unraid status via SNMP with CheckMK (as the agent seems to not run well on Unraid and the plugin for it has been abandoned). From reading the previous posts, it seems there is an issue with this plugin persisting.

If I proceed with setting this up, what do I need to do to make sure the rocommunity string remains public? (am very new to SNMP so excuse me if its a silly question).

Link to comment
7 minutes ago, paulmorabi said:

 

I'm looking to get this running for communicating Unraid status via SNMP with CheckMK (as the agent seems to not run well on Unraid and the plugin for it has been abandoned). From reading the previous posts, it seems there is an issue with this plugin persisting.

If I proceed with setting this up, what do I need to do to make sure the rocommunity string remains public? (am very new to SNMP so excuse me if its a silly question).

If you use SNMP without adjusting any of the default settings, it should work without a hitch. Those that have had issues still have not been able to tell me as the maintainer what exactly to do to reproduce their issues, so as far as I know there shouldn't be any problems with running this plugin. 

 

At the end of the day, this plugin is just a wrapper script to install the SNMP Slackware package, so in the worst case you could just default to installing SNMP manually. 

  • Like 1
Link to comment
11 minutes ago, kubed_zero said:

If you use SNMP without adjusting any of the default settings, it should work without a hitch. Those that have had issues still have not been able to tell me as the maintainer what exactly to do to reproduce their issues, so as far as I know there shouldn't be any problems with running this plugin. 

 

At the end of the day, this plugin is just a wrapper script to install the SNMP Slackware package, so in the worst case you could just default to installing SNMP manually. 

 

Thanks . I just installed and didn't change any settings. It's working fine. I don't often reboot but will definitely let you know if something goes awry. Thanks for putting together the plugin :)

  • Upvote 1
Link to comment
  • 4 weeks later...

In the settings for SNMP you have the snmpd.conf file editor.    The line

rocommunity public

 is the default but the community string can be changed to what ever you want. (this causes the plugin to uninstall on the next boot.)  

 

Security best practices are to change the read only community string to something else like changing a default password.  

The snmp.plg is doing the following to verify if the plugin was installed.  

 

results=$(snmpwalk -v 2c localhost -c public hrFSMountPoint 2>&1) || printf "snmpwalk failure"  

 

snmpwalk is connecting to the snmpd service and using public and the connection string.

If you change the rocommunity string  snmpwalk command fails to connect and uninstalls the plugin on the next boot.

 

I would guess that to fix the issue with changing the rocommunity string the plugin should read /etc/snmp/snmpd.conf and get the string for the rocommuntiy line as a variable then use that in place of public for the script.

 

Edited by cjhammel
added a little clarification
Link to comment
  • 1 month later...

Hi guys, 

 

I'm running version 6.11.2 and the installation is stuck, below the outputs:

 

plugin: installing: snmp.plg

Executing hook script: pre_plugin_checks

plugin: downloading: snmp.plg ... 100%

plugin: downloading: snmp.plg ... done

Executing hook script: pre_plugin_checks +============================================================================== | Skipping package perl-5.32.0-x86_64-1 (newer vesion already installed) +============================================================================== +============================================================================== | Skipping package libnl-1.1.4-x86_64-3 (already installed) +============================================================================== +============================================================================== | Skipping package net-snmp-5.9-x86_64-1 (already installed) +============================================================================== +============================================================================== | Skipping package unraid-snmp-2021.05.21-x86_64-1 (already installed) +============================================================================== +============================================================================== | Testing SNMP by listing mounts, /boot should be present +==============================================================================

snmpwalk -v 2c localhost -c public hrFSMountPoint

snmpwalk failureCouldn't find /boot mount point. SNMP output:

Timeout: No Response from localhost

plugin: run failed: /bin/bash

Executing hook script: post_plugin_checks

 

Link to comment

So, I got this fixed on my install. I had to; 'rm -fR /boot/config/plugins/snmp' and reboot. After that, I was able to install the plugin with no issues. I think my problem was that I had it installed before and customized the snmpd.conf file. I don't believe that the plugin likes it when you do that. Hope this helps.

Link to comment
9 hours ago, irishjd said:

So, I got this fixed on my install. I had to; 'rm -fR /boot/config/plugins/snmp' and reboot. After that, I was able to install the plugin with no issues. I think my problem was that I had it installed before and customized the snmpd.conf file. I don't believe that the plugin likes it when you do that. Hope this helps.

Right on. The install script does a sanity check to ensure it's working correctly, and fiddling with the snmpd.conf file can absolutely get it in a state where the install script no longer works. I can't think of a good way of validating the install was successful while also allowing for custom snmpd.conf files. 

For those adventurous enough to modify the config, I'm hoping they're also confident in editing the PLG to disable the sanity test and allow installs to proceed.

And also as you noted, if one gets into a bad state, deleting the SNMP files from /boot and rebooting would be a surefire way of  starting from scratch. The logs posted by @dgaglioni showing "unraid-snmp-2021.05.21-x86_64-1 (already installed)" indicates that this was not a fresh install. 

Link to comment
  • 3 months later...

This now refuses to upgrade or even install if removed on my 6.11.5 box with the following error:

 

snmpwalk -v 2c localhost -c public

hrFSMountPoint snmpwalk failure

Couldn't find /boot mount point.

SNMP output: Timeout: No Response from localhost plugin: run failed: /bin/bash

Executing hook script: post_plugin_checks

 

The /boot mount is there as is the /boot/config/plugins/snmp/ directory.

 

UPDATE:  uninstalling, deleting the directory and trying again still fails with the same error.

Deleting the directory and installing via the HTTPS link doesn't even install but it does create the snmp directory and downloads the packages for install it just never installs them.

 

UPDATE2:  OK, after running 'removepkg net-snmp unraid-snmp' after uninstalling it and deleting the directory I was finally able to install the updated version again from apps.  Thanks to kubed for the assist!

Edited by iball
  • Thanks 1
Link to comment

@iballHave you tried unistalling the plugin and then going to /boot/config/plugins on you unraid system and deleting everything that starts with "snmp"? I am showing a snmp.plg and a snmp directory. Unraid will use this info when reinstalling the plugin and it has caused me issues. After deleting that, try reinstalling agin, it worked for me.

 

@kubed_zeroare there any plans to allow the snmp community to be changed from "public"? I would really like to see SNMPv3 support as well. Lastly, I hop[e this plugin is "read-only"?

Link to comment
2 minutes ago, irishjd said:

Have you tried unistalling the plugin

I added this info to the Recommended post for this topic, but a good debugging step is to do a sanity check that SNMP is fully removed from the OS (not from the boot drive) by running `removepkg net-snmp unraid-snmp`.  @iball used this to get back to a good state, without the need for a reboot! 

 

3 minutes ago, irishjd said:

are there any plans to allow the snmp community to be changed from "public"?

I have no plans to change the default at the moment. You can also use the Settings->SNMP page to modify the SNMP configuration. One of the lines by default is `rocommunity public` which I assume is the change you're looking for. 

 

Be warned that the plugin install script (the PLG file at /boot/config/plugins/snmp.plg) expects certain config values such as the "public" community, and may require modification. You're also welcome to make a PR that automatically picks up the community name from the SNMP config, that functionality is not yet built in. 

Link to comment

Hello, great that the SNMP is still Updated!

I have an question about the CPU Speeds.

On my Unraid i have an AMD Ryzen 7 3700X 8-Core installed.

When i run the Query for the CPUMHZ I get the follwoing result:

root@Tower:~# snmpwalk -On -v 2c localhost -c public 'NET-SNMP-EXTEND-MIB::nsExtendOutLine."cpumhz"'
.1.3.6.1.4.1.8072.1.3.2.4.1.2.6.99.112.117.109.104.122.1 = STRING: 

Should there not all Core Speeds come as an Result?

 

Link to comment
4 hours ago, MVLP said:

Hello, great that the SNMP is still Updated!

I have an question about the CPU Speeds.

On my Unraid i have an AMD Ryzen 7 3700X 8-Core installed.

When i run the Query for the CPUMHZ I get the follwoing result:

root@Tower:~# snmpwalk -On -v 2c localhost -c public 'NET-SNMP-EXTEND-MIB::nsExtendOutLine."cpumhz"'
.1.3.6.1.4.1.8072.1.3.2.4.1.2.6.99.112.117.109.104.122.1 = STRING: 

Should there not all Core Speeds come as an Result?

 


CPU speed is manually fetched with a shell script that calls `lscpu` and then parses the results.

https://github.com/kubedzero/unraid-snmp/blob/main/source/usr/local/emhttp/plugins/snmp/cpu_mhz.sh#L11

Can you run `lscpu` and share the results with me, either here or by PM?  I should be able to modify the script to parse other lines if your system (and others' too I imagine) uses a different way to post CPU speed. 

Link to comment

NP

 

root@Unraid-1:~# lscpu
Architecture:            x86_64
  CPU op-mode(s):        32-bit, 64-bit
  Address sizes:         46 bits physical, 48 bits virtual
  Byte Order:            Little Endian
CPU(s):                  64
  On-line CPU(s) list:   0-63
Vendor ID:               GenuineIntel
  BIOS Vendor ID:        Intel
  Model name:            Intel(R) Xeon(R) CPU E5-4650 0 @ 2.70GHz
    BIOS Model name:            Intel(R) Xeon(R) CPU E5-4650 0 @ 2.70GHz  CPU @ 2.7GHz
    BIOS CPU family:     179
    CPU family:          6
    Model:               45
    Thread(s) per core:  2
    Core(s) per socket:  8
    Socket(s):           4
    Stepping:            7
    CPU(s) scaling MHz:  36%
    CPU max MHz:         3300.0000
    CPU min MHz:         1200.0000
    BogoMIPS:            5399.67
    Flags:               fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx
                          fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts
                         rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx
                          smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer ae
                         s xsave avx lahf_lm pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid xsaveopt
                         dtherm ida arat pln pts md_clear flush_l1d
Virtualization features:
  Virtualization:        VT-x
Caches (sum of all):     
  L1d:                   1 MiB (32 instances)
  L1i:                   1 MiB (32 instances)
  L2:                    8 MiB (32 instances)
  L3:                    80 MiB (4 instances)
NUMA:                    
  NUMA node(s):          4
  NUMA node0 CPU(s):     0,4,8,12,16,20,24,28,32,36,40,44,48,52,56,60
  NUMA node1 CPU(s):     1,5,9,13,17,21,25,29,33,37,41,45,49,53,57,61
  NUMA node2 CPU(s):     2,6,10,14,18,22,26,30,34,38,42,46,50,54,58,62
  NUMA node3 CPU(s):     3,7,11,15,19,23,27,31,35,39,43,47,51,55,59,63
Vulnerabilities:         
  Itlb multihit:         KVM: Mitigation: Split huge pages
  L1tf:                  Mitigation; PTE Inversion; VMX conditional cache flushes, SMT vulnerable
  Mds:                   Mitigation; Clear CPU buffers; SMT vulnerable
  Meltdown:              Mitigation; PTI
  Mmio stale data:       Unknown: No mitigations
  Retbleed:              Not affected
  Spec store bypass:     Mitigation; Speculative Store Bypass disabled via prctl
  Spectre v1:            Mitigation; usercopy/swapgs barriers and __user pointer sanitization
  Spectre v2:            Mitigation; Retpolines, IBPB conditional, IBRS_FW, STIBP conditional, RSB filling, PBRSB-eIB
                         RS Not affected
  Srbds:                 Not affected
  Tsx async abort:       Not affected

  • Thanks 1
Link to comment
46 minutes ago, irishjd said:

    CPU max MHz:         3300.0000
    CPU min MHz:         1200.0000
 

Thanks for sharing, what a beast of a CPU! I'll be interested in seeing what @MVLP posts as well. If it's the same, I might have to modify the script to attempt to grab "CPU max MHz" if "CPU MHz" doesn't output anything. 

 

Link to comment

hi @kubed_zero and @irishjd this is the Result:
As Mainboard i use an MSI X470 GAMING PRO MAX (MS-7B79) , Version 4.0 with the latest BIOS

 

I have the same Result, that it's CPU min/max MHz

Is it also maybe some how possible to get the currenct CPU Clock like on the Unraid Dashboard?

 

Architecture:            x86_64
  CPU op-mode(s):        32-bit, 64-bit
  Address sizes:         43 bits physical, 48 bits virtual
  Byte Order:            Little Endian
CPU(s):                  16
  On-line CPU(s) list:   0-15
Vendor ID:               AuthenticAMD
  BIOS Vendor ID:        Advanced Micro Devices, Inc.
  Model name:            AMD Ryzen 7 3700X 8-Core Processor
    BIOS Model name:     AMD Ryzen 7 3700X 8-Core Processor              Unknown CPU @ 3.6GHz
    BIOS CPU family:     107
    CPU family:          23
    Model:               113
    Thread(s) per core:  2
    Core(s) per socket:  8
    Socket(s):           1
    Stepping:            0
    Frequency boost:     enabled
    CPU(s) scaling MHz:  52%
    CPU max MHz:         4426.1709
    CPU min MHz:         2200.0000
    BogoMIPS:            7200.67
    Flags:               fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fx
                         sr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf rapl pni pclmulqdq monitor s
                         sse3 fma cx16 sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm s
                         se4a misalignsse 3dnowprefetch osvw ibs skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb cat_l
                         3 cdp_l3 hw_pstate ssbd mba ibpb stibp vmmcall fsgsbase bmi1 avx2 smep bmi2 cqm rdt_a rdseed adx smap clflushopt clwb sha
                         _ni xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local clzero irperf xsaveerptr rdpru wbnoi
                         nvd arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave
                         _vmload vgif v_spec_ctrl umip rdpid overflow_recov succor smca sev sev_es
Virtualization features: 
  Virtualization:        AMD-V
Caches (sum of all):     
  L1d:                   256 KiB (8 instances)
  L1i:                   256 KiB (8 instances)
  L2:                    4 MiB (8 instances)
  L3:                    32 MiB (2 instances)
NUMA:                    
  NUMA node(s):          1
  NUMA node0 CPU(s):     0-15
Vulnerabilities:         
  Itlb multihit:         Not affected
  L1tf:                  Not affected
  Mds:                   Not affected
  Meltdown:              Not affected
  Mmio stale data:       Not affected
  Retbleed:              Mitigation; untrained return thunk; SMT enabled with STIBP protection
  Spec store bypass:     Mitigation; Speculative Store Bypass disabled via prctl
  Spectre v1:            Mitigation; usercopy/swapgs barriers and __user pointer sanitization
  Spectre v2:            Mitigation; Retpolines, IBPB conditional, STIBP always-on, RSB filling, PBRSB-eIBRS Not affected
  Srbds:                 Not affected
  Tsx async abort:       Not affected

 

Edited by MVLP
Link to comment

And just for reference a 3rd datapoint:

 

Architecture:            x86_64
  CPU op-mode(s):        32-bit, 64-bit
  Address sizes:         39 bits physical, 48 bits virtual
  Byte Order:            Little Endian
CPU(s):                  4
  On-line CPU(s) list:   0-3
Vendor ID:               GenuineIntel
  BIOS Vendor ID:        Intel
  Model name:            Intel(R) Core(TM) i5-4590T CPU @ 2.00GHz
    BIOS Model name:     Intel(R) Core(TM) i5-4590T CPU @ 2.00GHz Fill By OEM CPU @ 2.0GHz
    BIOS CPU family:     205
    CPU family:          6
    Model:               60
    Thread(s) per core:  1
    Core(s) per socket:  4
    Socket(s):           1
    Stepping:            3
    CPU(s) scaling MHz:  93%
    CPU max MHz:         3000.0000
    CPU min MHz:         800.0000
    BogoMIPS:            3999.91
    Flags:               fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc ar
                         ch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4
                         _1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm cpuid_fault invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexprior
                         ity ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid xsaveopt dtherm ida arat pln pts md_clear flush_l1d
Virtualization features: 
  Virtualization:        VT-x
Caches (sum of all):     
  L1d:                   128 KiB (4 instances)
  L1i:                   128 KiB (4 instances)
  L2:                    1 MiB (4 instances)
  L3:                    6 MiB (1 instance)
NUMA:                    
  NUMA node(s):          1
  NUMA node0 CPU(s):     0-3
Vulnerabilities:         
  Itlb multihit:         KVM: Mitigation: Split huge pages
  L1tf:                  Mitigation; PTE Inversion; VMX conditional cache flushes, SMT disabled
  Mds:                   Mitigation; Clear CPU buffers; SMT disabled
  Meltdown:              Mitigation; PTI
  Mmio stale data:       Unknown: No mitigations
  Retbleed:              Not affected
  Spec store bypass:     Mitigation; Speculative Store Bypass disabled via prctl
  Spectre v1:            Mitigation; usercopy/swapgs barriers and __user pointer sanitization
  Spectre v2:            Mitigation; Retpolines, IBPB conditional, IBRS_FW, STIBP disabled, RSB filling, PBRSB-eIBRS Not affected
  Srbds:                 Mitigation; Microcode
  Tsx async abort:       Not affected

 

Link to comment

Thanks all for the info. I just released an update 2023.02.18 that should fix this, now reading from /proc/cpuinfo instead of lscpu. I found during testing Unraid 6.12 that my VMs with an updated version of lscpu (2.38 vs 2.36) were no longer outputting CPU MHz at all, much less min and max.

Granted, my implementation only reads the speed of CPU core 0, but I figure that's better than nothing. Technically someone could submit a PR that grabs the CPU MHz from all the different cores and averages them out, or gets the max (or min) from all of them.


Let me know how install/update and testing goes @mattie112@MVLP @irishjd

  • Like 1
Link to comment

Update was smooth ;) 

I have tested shortly on the Terminal fro the first view Outputs it works great. But after i have run the command several times i get an Error back even when I wait for a view seconds / minutes:

 

root@Tower:~# snmpwalk -v 2c localhost -c public 'NET-SNMP-EXTEND-MIB::nsExtendOutLine."cpumhz"'
NET-SNMP-EXTEND-MIB::nsExtendOutLine."cpumhz".1 = STRING: 2151.045 MHz
root@Tower:~# snmpwalk -v 2c localhost -c public 'NET-SNMP-EXTEND-MIB::nsExtendOutLine."cpumhz"'
NET-SNMP-EXTEND-MIB::nsExtendOutLine."cpumhz".1 = STRING: 2151.045 MHz
root@Tower:~# snmpwalk -v 2c localhost -c public 'NET-SNMP-EXTEND-MIB::nsExtendOutLine."cpumhz"'
NET-SNMP-EXTEND-MIB::nsExtendOutLine."cpumhz".1 = STRING: 2151.045 MHz
root@Tower:~# snmpwalk -v 2c localhost -c public 'NET-SNMP-EXTEND-MIB::nsExtendOutLine."cpumhz"'
NET-SNMP-EXTEND-MIB::nsExtendOutLine."cpumhz".1 = STRING: 2151.045 MHz
root@Tower:~# snmpwalk -v 2c localhost -c public 'NET-SNMP-EXTEND-MIB::nsExtendOutLine."cpumhz"'
NET-SNMP-EXTEND-MIB::nsExtendOutLine."cpumhz".1 = STRING: cat: write error: Broken pipe
root@Tower:~# snmpwalk -v 2c localhost -c public 'NET-SNMP-EXTEND-MIB::nsExtendOutLine."cpumhz"'
NET-SNMP-EXTEND-MIB::nsExtendOutLine."cpumhz".1 = STRING: cat: write error: Broken pipe
root@Tower:~# snmpwalk -v 2c localhost -c public 'NET-SNMP-EXTEND-MIB::nsExtendOutLine."cpumhz"'
NET-SNMP-EXTEND-MIB::nsExtendOutLine."cpumhz".1 = STRING: cat: write error: Broken pipe
root@Tower:~# snmpwalk -v 2c localhost -c public 'NET-SNMP-EXTEND-MIB::nsExtendOutLine."cpumhz"'
NET-SNMP-EXTEND-MIB::nsExtendOutLine."cpumhz".1 = STRING: cat: write error: Broken pipe
root@Tower:~# 

 

Link to comment

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.