]> ## SNMP ### 2023.04.20 - Fixed a regression in unraid-snmp that prevented the `/etc/rc.d/rc.snmpd` file from being updated correctly. - This regression caused extra logs in `/var/log/snmpd.log` - This regression is caused by the update from `net-snmp-5.9` to `net-snmp-5.9.3` - NOTE: `ps -ef | grep snmp` can be used to confirm the flags were set correctly. They should be `/usr/sbin/snmpd -A -p /var/run/snmpd -LF 0-5 /var/log/snmpd.log -c /etc/snmp/snmpd.conf` - Thanks @irishjd and @Uncore for the help! ### 2023.02.19 - Adjusted CPU MHz script to more succinctly retrieve data - Adjusted plugin PLG install script to read the `rocommunity` string from the `/etc/snmp/snmpd.conf` SNMP daemon config file when testing install success/failure. Thanks @cjhammel for the suggestion! ### 2023.02.18 - Adjusted CPU MHz script to source from `/proc/cpuinfo` instead of `lscpu` to improve compatibility. Thanks @mattie112 @MVLP @irishjd for the help! ### 2023.02.12 - Adjusted README wording - Updated package versions - `libnl-1.1.4-3` to `libnl-1.1.4-5` - `net-snmp-5.9-1` to `net-snmp-5.9.3-1` - `perl-5.32.0-1` to `perl-5.36.0-3` - Updated minimum OS version from 6.7.0 to 6.11.0. Packages `net-snmp` and `perl` now require `libc-2.34` or newer, which is only satisfied starting with Unraid 6.11.0's use of `libc-2.36`. Unraid 6.10.3 uses `libc-2.33` which will yield errors such as `/lib64/libc.so.6: version 'GLIBC_2.34' not found (required by /usr/lib64/perl5/CORE/libperl.so)` ### 2021.05.21 - Added customizable snmpd.conf to the SNMP Settings page. Thanks @Mattie112 for the contribution! - Users can define a custom SNMP config at `/boot/config/plugins/snmp/snmpd.conf` that will automatically be picked up at boot/install time - Tweaked the install script to avoid an early exit if the bundled snmpd.conf was missing - Adjusted PLG uninstall process to properly remove `/etc/rc.d/rc.snmpd*` - SNMP HDD/CPU/RAM/etc scripts now use `/bin/bash` as `/usr/bin/bash` just symlinks to it anyway ### 2020.12.20 - Add Dirty Memory reporting. ### 2020.11.20 - Repository branch references changed from "master" to "main" - https://github.com/github/renaming - Code and functionally identical to version 2020.10.04 ### 2020.10.04 - Added `mem_info.sh` to print memory values in bytes - Exposed in SNMP as `meminfo` - Current memory values exported are MemTotal, MemFree, MemAvailable, Cached, Active, Inactive, Committed_AS - Added Settings page to disable `--no-check standby` when getting disk temps - Used in Unraid setups where disks are always reported to be in Standby - Used in Unraid setups where disks don't need spinning up to get temperature - State is stored between reboots in `/boot/config/plugins/snmp/snmp.cfg` - The script `/usr/local/emhttp/plugins/snmp/disk_temps.sh` reads this config to change behavior ### 2020.09.20 - Bugfix: SMB and NFS permission denied errors after plugin install - Unused scripts were present in `unraid-snmp-2020.09.19-x86_64-1.txz` and somehow interrupted server access - Resolved by rebuilding the `.txz` to contain only used files - Updated `slack-desc` formatting - PLG tweak: moved forward slash into XML variable for `usbcfgdir` ### 2020.09.19 - Migrate SNMP plugin to .txz style install - Optimized plugin removal for more complete cleanup - Updated net-snmp from 5.8-5 to 5.9 - Updated libnl from 1.1.4 to 1.1.4-3 - Perl 5.32.0 declared as dependency instead of separate install. - Plugin maintainer should keep the version in sync with Nerd Pack to avoid overwriting with an older version - Install logging more clearly states usage of single and double quotes in sample calls - Refactored `share_free_space.sh` for added clarity. - Preexisting behavior: Outputs in bytes - Refactored `drive_temps.sh` - Changed name to `disk_temps.sh` - Preexisting behavior: Five minute TTL cached results for rapid SNMP calls and large arrays - New behavior: Avoids disk spinup, preferring to report standby "temperature" of -2 - New behavior: If an error is encountered during parsing, report a "temperature" of -1 - New behavior: Script originally output nothing if no cached results present. Now it reports whatever results were collected in the first 1000ms - Added `disk_free_space.sh` to print free bytes in /boot, /mnt/disk*, /mnt/cache - Exposed in SNMP as `diskfree` - Added `cpu_mhz.sh` at request of forum user Max to output CPU speed in MHz - Exposed in SNMP as `cpumhz` - Tested with an Intel CPU virtualized under ESXi ### 2020.04.01 - Cache downloaded files on USB to support offline installation - Add /mnt/disk up to 28 from 20 to provide 30 drive support - Add MD5 for shell scripts - Format plugin name in README to be in line with other plugins - More consistent variable use and naming in .plg file - Clearer install and uninstall logging ### 2019.05.28c - Fix icon file ### 2019.05.28b - Customized for the kubedzero repository ### 2019.05.28 - Updated plugin to work with 6.7.0, enforce minimum version ### 2018.07.22 - Fix bug with grep and "mostfree" allocator. https://github.com/coppit/unraid-snmp/pull/1 ### 2017.02.07 - Drop all pretense of trying to keep up with nerd tools. Just require perl, and suggest that the user install nerd tools. ### 2016.02.28 - Bump the version of perl to match nerd tools. ### 2015.10.18 - Run temperature updates in the background ### 2015.09.06 - Move packages to github for better reliability ### 2015.09.05 - Add support for reporting share free space ### 2015.08.25 - Download and install the drive temp script (duh) ### 2015.08.24 - Added hard drive temperature capture ### 2015.08.23 - Reduced logging to "warning" level ### 2015.06.24 - Initial unRAID V6 release. &pkgurl;/&perlpkg; &perlpkgmd5; &pkgurl;/&libnlpkg; &libnlpkgmd5; &pkgurl;/&snmppkg; &snmppkgmd5; &pkgurl;/&pluginpkg; &pluginpkgmd5; # NOTE: Modified bash for embedding in XML with ampersand-semicolon placeholders # https://vaneyckt.io/posts/safer_bash_scripts_with_set_euxo_pipefail/ # Exit script early if an error is encountered set -e echo "" echo "+==============================================================================" echo "| Testing SNMP by listing mounts, /boot should be present" echo "+==============================================================================" echo "" # Get the Read-Only Community string from the config file community=$(grep "rocommunity" --max-count 1 "/etc/snmp/snmpd.conf" | awk '{print $2}') # Clean newlines, carriage returns, spaces, and tabs # https://stackoverflow.com/questions/19345872/how-to-remove-a-newline-from-a-string-in-bash community=${community//[$'\t\r\n ']} # If the Community cannot be read, default to "public" if [[ -z "$community" ]] then echo "Read-Only Community String not found in /etc/snmp/snmpd.conf. Defaulting to test with public." community="public" fi # Print out the command used to test SNMP functionality, and then run/evaluate the command printf "snmpwalk -v 2c localhost -c $community hrFSMountPoint\n" results=$(snmpwalk -v 2c localhost -c $community hrFSMountPoint 2>&1) || printf "snmpwalk failure" if [[ "$results" =~ "/boot" ]] then echo "SNMP appears to be working. Output:" echo "$results" else echo "Couldn't find /boot mount point. SNMP output:" echo "$results" exit 1 fi echo "" echo "+==============================================================================" echo "| Other SNMP Examples" echo "+==============================================================================" echo "" printf "Here are how sharefree lines look:\n" printf "snmpwalk -v 2c -c $community localhost 'NET-SNMP-EXTEND-MIB::nsExtendOutLine.\"sharefree\"'\n" snmpwalk -v 2c -c $community localhost 'NET-SNMP-EXTEND-MIB::nsExtendOutLine."sharefree"' printf "\nHere are how all custom extensions look:\n" printf "snmpwalk -v 2c -c $community localhost nsExtendOutLine\n" snmpwalk -v 2c -c $community localhost nsExtendOutLine echo "" echo "+==============================================================================" echo "| &name; version &pluginver; has been installed." echo "+==============================================================================" echo "" exit 0 # NOTE: Modified bash for embedding in XML with ampersand-semicolon placeholders # https://vaneyckt.io/posts/safer_bash_scripts_with_set_euxo_pipefail/ # Exit script early if an error is encountered set -e echo "" echo "+==============================================================================" echo "| Uninstalling packages, removing directories and files" echo "+==============================================================================" echo "" # Shut down the SNMP daemon. It emits its own STDOUT lines when done /bin/bash /etc/rc.d/rc.snmpd stop # Define packages to remove in a multi-line string in inverse order of installation # NOTE: Skipping package removal of prereqs in Nerd Pack in case other plugins depend on them pkgs_to_remove=" &pluginpkg; &snmppkg; &libnlpkg; " # Define directories and files to remove in a multi-line string dirs_files_to_remove=" &usbcfgdir; /usr/local/emhttp/plugins/snmp/ /etc/rc.d/rc.snmpd* /etc/snmp/ /var/lib/net-snmp/ /var/log/snmpd.log /etc/default/snmpd " echo "Starting TXZ package removal" # Read through package removal lines, uninstalling each while IFS= read -r line do # If line is empty, skip to the next iteration [ -z "$line" ] && continue # Remove the directory path and extension, leaving just the package name pkg_name="$(basename $line .txz)" # Perform the package removal removepkg "$pkg_name" done < <(printf '%s\n' "$pkgs_to_remove") printf "\nTXZ package removal done. Starting directory and file removal\n" # Read through package removal lines, uninstalling each while IFS= read -r line do # If line is empty, skip to the next iteration [ -z "$line" ] && continue echo "Deleting $line" # rm -rf "/path/to/prefix*" * expansion fails due to quotes, wrap in bash exec bash -c "rm -rf $line" done < <(printf '%s\n' "$dirs_files_to_remove") printf "\nDirectory and file removal done" echo "" echo "+==============================================================================" echo "| &name; has been uninstalled." echo "+==============================================================================" echo "" exit 0