Everything posted by kubed_zero
-
[Plug-In] SNMP
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.
-
[Plug-In] SNMP
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.
-
[Plug-In] SNMP
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! 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.
-
[Plug-In] SNMP
Simple Network Management Protocol (SNMP) is a widely used protocol for monitoring the health and welfare of electronics. This Unraid plugin installs and configures SNMP for basic use with tools such as Observium and Grafana. This Unraid plugin assists with installing SNMP and its dependencies and then configuring them for Unraid. For example, it adds extensions into SNMP to output Unraid Share and disk size, disk temperature, memory usage, and CPU speed. Install Link (6.11 and newer): https://raw.githubusercontent.com/kubedzero/unraid-snmp/main/snmp.plg Install Link (6.7 thru 6.10.3): https://raw.githubusercontent.com/kubedzero/unraid-snmp/14cf6e875860526a25148bd86c2f812bbfddb590/snmp.plg Unraid 6.10.3 and older use older versions of libc/glibc (2.33 in 6.10.3, 2.30 in 6.9.2), and the latest versions of net-snmp and perl require libc-2.34 and newer. GitHub: https://github.com/kubedzero/unraid-snmp Other notes: Instructions for building and/or contributing features can be found in the GitHub repo's README There is a Settings page for users to tweak the SNMP configuration to their liking. Be warned that the plugin install script expects certain config values, and may also require modification depending on the changes to the SNMP config (such as the Community, permissions, etc.) Good to know debugging: If you don't want to reboot and are experiencing install issues, perhaps it's because Unraid thinks the package is already installed. Run `removepkg net-snmp unraid-snmp` to uninstall them if they're installed (it will do nothing otherwise). You can also run `rm -rf /boot/config/plugins/snmp/` to remove the plugin install directory from the USB drive, wiping out any customizations. Both of these steps are performed when uninstalling the plugin through Unraid's UI.
-
[Plug-In] SNMP
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.
-
[Plug-In] SNMP
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.
-
[Plug-In] SNMP
My guess, in conjunction with your Docker logs, is that somehow the localhost address isn't configured/accessible. There's some discussion earlier on in the thread, though I don't think we ever collectively got reproduction steps to isolate whether or not this was the case. The thinking with this SNMP install script is that localhost should be available since Unraid would just be pinging itself, and then that /boot exists on all Unraid installations and should be good to baseline. If either one of those fails to be true, then the installation script fails. That said, SNMP might have actually been installed, and perhaps these tests aren't passing for some reason. I suspect that Docker networking might be fiddling with localhost, but don't use Docker myself so I've been unable to reproduce. I'd say you have two options here: - Try to figure out if localhost is working, or if SNMP is working at all. Mess with Docker networking, install SNMP manually, and just generally deep-dive on your system - Remove the validation lines from your local copy of the PLG file, which on next install would just skip over the validation and treat it as a successful install. You could strip it all out, or just remove the "exit 1" line https://github.com/kubedzero/unraid-snmp/blob/main/snmp.plg#L195
-
[Plug-In] SNMP
Yes! I think this is all you need.
-
[Plug-In] SNMP
@Dro I've been unable to reproduce the issue. I suspect it has something to do with your network configuration messing up the self-test at plugin install time, but I'm not positive. Perhaps it would be helpful to fully delete the files associated with SNMP on the boot drive? - the /boot/config/plugins/snmp folder, which contains an snmp.conf if defined, as well as the .txz files - the /boot/config/plugins/snmp.plg file
-
[Plug-In] SNMP
All right folks, I just updated to 6.10 on my existing install (no Docker or any fancy stuff) and SNMP installed after reboot without any issue. I'll have to give a vanilla install + reboot a shot on a spare flash drive, but I suspect that will yield the same no-issue result. I'll report back if I see anything otherwise. In the meantime, please let me know if reproduction steps are available on a fresh install for this SNMP not installing after reboot issue. Thanks!
-
[Plug-In] SNMP
Right, that's why the dependencies are cached to USB on first install, so the SNMP plugin still installs even if the network isn't up on future boots (for example if someone runs pfSense as a VM on their Unraid box). I was under the assumption that localhost/127.0.0.1 would be guaranteed to exist by the point in the boot process that Unraid does plugin initialization, and that regardless of network hardware, localhost would always exist (since I'd expect the WebGUI to also depend on it). Is there documentation that could confirm or deny this? I'm also open to suggestions for how to do a validation that SNMP is functioning correctly without relying on the network, but I don't have any ideas at the moment.
-
[Plug-In] SNMP
If anyone's able to provide reproduction steps from a clean install of the latest 6.10 RC, let me know and I will investigate. Otherwise, it has been very difficult to evaluate what's going on. I had no issues on a clean install and wasn't able to reproduce, and SimonF also mentioned not being able to reproduce as of 6.10-RC3.
-
[Plug-In] SNMP
Thanks for reporting back! I gave it a shot in my test UnRAID virtual machine on the latest RC, which as of writing is 6.10.0-rc2. I did not experience any issues, SNMP installed on boot as expected. Here's what I did: - Prereq: NerdPack already installed, and I don't have any disks or a license so this is is without the array starting. - Install SNMP 2021.05.21 and copy the logs of the popup window - Shut down Unraid - Boot up Unraid (again, the array doesn't start, but that doesn't matter anyway since plugins install before mounting the array I think) - Go to the Plugins tab and see SNMP among the Installed Plugins - Go to the Tools > System Logs page and copy out relevant information, such as the NerdPack install and the SNMP install logs. Here are those logs: https://pastebin.com/r6mKqEYT Can you do the same for your installation? I wonder if there's something going on with NerdPack or your prerequisite packages that is preventing install on boot.
-
[Plug-In] SNMP
Thanks for chiming in, I'm in the same boat. Haven't tried the 6.10 releases yet so yeah, maybe something with that. I also remember the plugin being in a certain state during development where it would fail to install if the dependency packages weren't cached on the boot drive AND the network wasn't yet available at boot time, though that issue was fixed. The plugin also checks to make sure it's working and fails the install otherwise (the PLG file defines this behavior) so maybe there's something with 6.10 or with @BigJuanKer 's system that is preventing SNMP from working correctly at boot. I guess we'll see soon!
-
[Plug-In] SNMP
Does the plugin show up in the "Plugin Install Error" or whatever the tab is named, next to "Installed Plugins" and "Install Plugins?" If a plugin fails to install at boot up, that's where it ends up. I wonder if there's a race condition occurring at boot time that prevents the plugin from installing.
-
[Plug-In] SNMP
My suggestions would be checking the logs (of course), also trying rebooting, or removing any SNMP-related files from your boot USB. You can also see if the SNMP service is still running when it "stops responding" and one other suggestion might be to call SNMP from Unraid itself (the install script does this so you can reference it for syntax) One final suggestion is to remove the custom script extensions from the SNMP config so it's not checking disk temps and just reporting basic Linux stuff. Maybe something there is causing an issue, not sure.
-
[Plug-In] SNMP
1 seems a bit complicated for what is essentially a sanity test during installation. Honestly I'd rather remove the sanity test than have 1 in the installer script 2 seems fine, though I'd hope that if someone is messing with the SNMP config enough to bork the installation, they'd be able to just remove the sanity check from the PLG and call it a day. 3 would be hard to differentiate between a custom config and the default I think, or similar to 1 would be extra complication to the install logic. Out of these, 2 vibes the most with me!
-
[Plug-In] SNMP
NET-SNMP-EXTEND-MIB::nsExtendOutLine."disktemp".2 = STRING: WDC_WD100EMAZ-00WJTA0_JEGKPT5N: 30 Here's an example of how it will look. Here's one way of calling SNMP to get just the custom stuff: snmpwalk -v 2c -c public localhost nsExtendOutLine You can also uninstall and reinstall the plugin and the installation logs will give you an example of how to call SNMP, along with what your system's output currently is.
-
[Plug-In] SNMP
Huh, I didn't edit anything related to this bit. Specifically, what it's failing on is that it's trying to call snmpwalk after SNMP is started, and it's getting back "No Response from localhost" instead of a valid SNMP response. That sounds to me though as if SNMP failed to start up. - If you reboot and try to update again, does it work? - An alternative would be to uninstall SNMP, reboot, and then reinstall with the newest version. I'm not sure what version of SNMP/Unraid you're currently on, but there have been some adjustments in more recent versions to make updating safer.
-
[Plug-In] SNMP
Sorry it took so long! Thanks to @mattie112 I've just released update 2021.05.21 to main. If there are any bugs, it's probably due to my fiddling with the PR's code 😜 In essence, this update modifies the SNMP installer script to look on the /boot drive for an SNMP config file to use, preferring that over the bundled config if it exists. This means that even without using the UI, you can get a custom SNMP file to load up without any adjustments to the go file or anything else. The other, much more headache-causing section of the update is a new part of the SNMP settings page to customize the SNMP config, save it to the /boot drive AND overwrite the actively-used config, and then restart SNMP to apply the changes. A Default button is also provided to restore the SNMP config to the default file that ships with this plugin. Oh, I also tweaked the uninstall code to better clean up after itself. It seemed that the `rm` commands weren't working as expected with an asterisk, so I've updated it to properly clear everything out. As always, please enjoy and let me know if any issues arise. And again, thanks to @mattie112 for suggesting, implementing, and providing debugging help for this much-desired feature.
-
[Plug-In] SNMP
I'm looking at it now. Just merged it to the test branch and am testing a couple things out. Also going through your notes, they are super helpful! Glad to hear you're using the UI customization of snmpd.conf (and thank you again for contributing!), I'm sure others will have similar findings! Yes, this is by design! I am a big proponent of uninstallers removing all traces, rather than leaving the user to find what was left behind and what wasn't. Some other plugins do this as well: https://github.com/jbrodriguez/unbalance/blob/master/plugin/template.plg#L88 and https://github.com/dlandon/open.files/blob/master/open.files.plg#L163 for example. Meanwhile, and as you've noted, others remove only some of the files under the boot directory https://github.com/dmacias72/unRAID-NerdPack/blob/master/plugin/NerdPack.plg#L292 and https://github.com/StevenDTX/unRAID-open-vm-tools/blob/master/openVMTools_compiled.plg#L275 I'll keep it as-is for now but will definitely think more on it. Thanks for the call-out!
-
[Plug-In] SNMP
Looks great, thanks a ton! From an initial look through, I have a couple minor comments that I need to post (consolidate PHP into the .page file, lower/camel case variable naming) but the comment lines and general look and feel are fantastic. I realize there's no documented testing procedure, so I also want to give it a thorough run of different scenarios myself in terms of testing. Maybe I can even make a doc based on it 🤩 Fresh install, uninstall and reinstall, reboot, upgrade, *removal* of the custom config (does the default come back?), pre-population of the default config, a couple other things along those lines that will hopefully ensure it's resilient. I'm in the middle of another project so I hope to look at this within the next 3-4 days.
-
[Plug-In] SNMP
/boot/config/plugins/snmp/snmp.cfg is read from and written to by the SNMP settings page https://github.com/kubedzero/unraid-snmp/blob/main/source/usr/local/emhttp/plugins/snmp/snmp.page#L18 It then gets read any time the disk_temps.sh script gets run https://github.com/kubedzero/unraid-snmp/blob/main/source/usr/local/emhttp/plugins/snmp/disk_temps.sh#L72. /boot/config/plugins/snmp/snmp.cfg is not guaranteed to exist, so the disk_temps.sh script has to handle if the file is missing. ___ As for /usr/local/emhttp/plugins/snmp/snmpd.conf, it gets extracted to here from the .txz during Unraid SNMP package installation. Then during package installation, it copies over / overwrites /etc/snmp/snmpd.conf https://github.com/kubedzero/unraid-snmp/blob/main/source/install/doinst.sh#L38. This is done because it's easier to follow than doing hacky text replacement in /etc/rc.d/rc.snmpd to point at /usr/local/emhttp/plugins/snmp/snmpd.conf instead of /etc/snmp/snmpd.conf (the default). I also wanted to keep changes to /etc/rc.d/rc.snmpd to a minimum, since it's installed by the untouched Slackware snmp .txz and not *our* wrapper unraid-snmp > I see a form submit to '/update.php'. Is this an unraid file/feature Yes, I figured out its use by looking at other plugins with settings pages. Unfortunately there isn't much documentation for plugin creators. > Is there any way to quickly test things? Theoretically, if you wanted to make the SNMP config file configurable, you'd add a text field in the Settings page. Then from there you have a variety of choices, but no matter what you'd have to stop SNMP and then start it again with the correct parameters. I imagine that would be done by either triggering a shell script from the Settings page, or trying to do it all within the Settings page. You'd also have to do error handling for when the file being pointed to isn't present. You'd also have to handle boot scenarios since the unraid-snmp package reinstalls at boot time, meaning it would have to read the /boot/config/plugins/snmp/snmp.cfg if it exists, try to get the alternate location for etc/snmp/snmpd.conf, make the appropriate modifications, and then continue installation/starting of SNMP
-
[Plug-In] SNMP
That is the current version. Also, what version of Unraid are you running? The next thing I'd try is a reboot of Unraid to see if that helps. I have a suspicion that if you ran "head -15 /etc/rc.d/rc.snmpd" (which prints out the first 15 lines of the file, which is the part we care about) you might see a different start command than what it should be. Again, the old version of the plugin would modify this to point at the /usr/local/emhttp/plugins/snmp/snmpd.conf file by doing an in-place string replacement, but the new version does not. A reboot would fix this as the file is recreated at boot, which would be another reason for trying to fix this by rebooting start() { if [ -x /usr/sbin/snmpd -a -f /etc/snmp/snmpd.conf ]; then echo -n "Starting snmpd: " /usr/sbin/snmpd $OPTIONS -c /etc/snmp/snmpd.conf echo " /usr/sbin/snmpd $OPTIONS -c /etc/snmp/snmpd.conf" fi }
-
[Plug-In] SNMP
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!