From 14cf6e875860526a25148bd86c2f812bbfddb590 Mon Sep 17 00:00:00 2001 From: KZ Date: Sat, 22 May 2021 11:40:19 -0700 Subject: [PATCH] Update plugin to 2021.05.21 to add UI-customizable SNMP config file --- .gitignore | 2 +- README.md | 5 ++ packages/unraid-snmp-2021.05.21-x86_64-1.txz | Bin 0 -> 12160 bytes snmp.plg | 13 +++- source/install/doinst.sh | 25 ++++++-- .../usr/local/emhttp/plugins/snmp/cpu_mhz.sh | 2 +- .../emhttp/plugins/snmp/disk_free_space.sh | 2 +- .../local/emhttp/plugins/snmp/disk_temps.sh | 2 +- .../usr/local/emhttp/plugins/snmp/mem_info.sh | 2 +- .../emhttp/plugins/snmp/run_before_save.php | 8 +++ .../emhttp/plugins/snmp/share_free_space.sh | 2 +- .../usr/local/emhttp/plugins/snmp/snmp.page | 57 +++++++++++++++--- 12 files changed, 96 insertions(+), 24 deletions(-) create mode 100644 packages/unraid-snmp-2021.05.21-x86_64-1.txz create mode 100644 source/usr/local/emhttp/plugins/snmp/run_before_save.php diff --git a/.gitignore b/.gitignore index 9bea433..4befed3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ - .DS_Store +.idea diff --git a/README.md b/README.md index a5642b1..2dda3ae 100644 --- a/README.md +++ b/README.md @@ -81,4 +81,9 @@ The key to creating these Slackware packages is to use `makepkg` which is provid * https://github.com/dmacias72/unRAID-NerdPack/blob/master/README.md * A modified version of `pkg_build.sh` https://github.com/dmacias72/unRAID-NerdPack/blob/master/source/mkpkg * Structuring of the source directories, specifically the install script, were found at https://slackwiki.com/Doinst.sh +* Other plugins' styles of uninstalling. The first two remove all traces of the plugin from the /boot persistent USB storage, while the latter two only remove some traces. This could allow configs to stay behind, so a reinstall of the plugin would reuse the leftover config from the previous install. I'm tending to stick with the former approach, as I worry leaving behind remnants could lead to unexpected behavior + * https://github.com/jbrodriguez/unbalance/blob/master/plugin/template.plg#L88 + * https://github.com/dlandon/open.files/blob/master/open.files.plg#L163 + * https://github.com/dmacias72/unRAID-NerdPack/blob/master/plugin/NerdPack.plg#L292 + - https://github.com/StevenDTX/unRAID-open-vm-tools/blob/master/openVMTools_compiled.plg#L275 diff --git a/packages/unraid-snmp-2021.05.21-x86_64-1.txz b/packages/unraid-snmp-2021.05.21-x86_64-1.txz new file mode 100644 index 0000000000000000000000000000000000000000..070d3517b2cd0437cfd9b39048fc1e62d0151c4a GIT binary patch literal 12160 zcmV-`FMrVeH+ooF000E$*0e?hz`kC9kOLtB8~^|S0001R3>^pH$Nw)jT>uvgyc~T2 zmB1ZJK6w?w%qF8@JjH^+_Yz^F9aSI2+>3x9YYEy{JM~P((3aQk%e(8K?6lxDU|sCt zRNfRDLHBS!m2IH85bicd)}05;$$PPb=!{zBk~rm)3JMVN$>ctNmSmg+YB(c15+d(1 z#c8ASU}PPpT|!6~S+ykH1-589;M#H*xZVRiS9-K(on2OZSa}}F0IlydiD{zS23YHy z-JK`9UJ6la-jfyN%I)|vymG%Z*51pwLMP6Qd}1KbwFzgR=Sn2Fyeyv0iN5%&^!s6B zk+|JpRnChFwlqC5OT#fN#j`xCc`CSc&lSs>ZpJkZLBpJyKY{~oO5SpP)s_F#&*D8bHo%6OU+YEXS5J93qN@uY@0!x1$-uRTSHO%kM5M$txt z$ael;syXJ?qv3BIqtx>(Qu&fkM+6DOtR-lpj*tjkJHkcr(e>``@k;96qKNu64ef$S zkW7ahVOm!U^iAveo2}BjJ|zq32NYeH?)~ZvSy+!8MZsZy$*7#xDCr$U-g?m{Nxn=B z&4p=oeMMXtyCIH&Kr--P;`L`Hfr?UUghUAv}#t1YdHV{>wuh zb5d{TF+1o#Y>YQK66D|i}B7H$^6Ww;S`(Wm{Yqs@|e!b=B z0%{r>^U8q!qCE;jPj?D1SOl?p63KqTv1>*Vkzj2dfynO{eLjJW!hFsNFRNE!z(^5% zAR`k!Fk_R}fJ>Ff9sDCp-D>)16_GGfgf&Aky5w`i(O6OZ0*&r+`{rpJ96fh*1Xeh* znPa+T`lF_(u56D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+Jh2uZbvYlv`j_ofxM5V72I&Kb3sJOpGZ}VGQDpxa?Olyd#li>X`4-xEU`WU%MHiEPw*r?~~T} ztrMW1ps+sE>{ua$NnWXsez>4LY-IRCc%1$s2UmTg;n;Y(5 z`cs-FDQn0^_Lk!hS3TqffKC%sC)w#ivW^Jep9T;cwixrrFp%6G6HOSc6izphw3xfw z$frPE&v4JOsz0?R2OtW@)emDA^J*diAe%?_W|K0Wh;s%?yjCLbk&g4_g=7iyWKc zd=+<|-|9+%hh4HdOKH476E#l)l|1jMC)4WVYWjZ12 z%Q+D|{E?j%!~xPM>LnP^FE$S_(4a?ws&cHtw*KY_%illPGrR(xo$2gAN!Dco8_CvvNGshexA8@muO@Cmh_TLx}fI86^2Aj6h={L7< z6>p)2KLY&*V0^_z5+6DiaH`>(D}J{na;}zr?b~$Qe538brwSO*kbZ6=quBcum#`;hXDw?J3uAbf} zLg=BRpNrc*0&{Zlp(0#ipEw!c*jaQQ!Q(Uu17GZPs!KIkgL93redK;Pbc4v?qcef^ ziS6qdg|z#6Co3>PnkZ0C - + @@ -26,7 +26,7 @@ - + ]> ## SNMP +### 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. @@ -273,7 +280,7 @@ do [ -z "$line" ] && continue echo "Deleting $line" - # rm -rf "/path/to/prefix*" will not work due to quotes, wrap in bash exec + # 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") diff --git a/source/install/doinst.sh b/source/install/doinst.sh index e8c0f5e..42d31bc 100755 --- a/source/install/doinst.sh +++ b/source/install/doinst.sh @@ -6,7 +6,7 @@ # https://vaneyckt.io/posts/safer_bash_scripts_with_set_euxo_pipefail/ set -euo pipefail -directory="/usr/local/emhttp/plugins/snmp/" +directory="/usr/local/emhttp/plugins/snmp" echo "Set permissions and move into dir $directory" chmod a+r "$directory" cd "$directory" @@ -32,10 +32,25 @@ if [[ -f /etc/rc.d/rc.snmpd ]]; then echo "Stop SNMP daemon if it is currently running" bash /etc/rc.d/rc.snmpd stop 2>&1 - echo "Replace default snmpd.conf with our own, backing up the original" - # NOTE: Use cp, not mv. Plugin 2020.04.01 and earlier use the .conf - # under /usr/local and updating will fail if SNMP can't start. - cp --backup /usr/local/emhttp/plugins/snmp/snmpd.conf /etc/snmp/snmpd.conf + + # Check if a UI/user-defined snmpd.conf exists on the USB disk, + # copying that over the default snmpd.conf. Otherwise use the + # bundled, Unraid-customized snmpd.conf unzipped as part of the .txz. + # NOTE: Plugin 2020.04.01 and earlier use the .conf under + # /usr/local/emhttp/plugins/, so leave it by using cp instead of mv. + custom_snmpd="/boot/config/plugins/snmp/snmpd.conf" + original_snmpd="/etc/snmp/snmpd.conf" + plugin_default_snmpd="$directory/snmpd.conf" + if [[ -f $custom_snmpd ]]; then + echo "Using the user-defined config $custom_snmpd, backing up the original" + cp --backup "$custom_snmpd" "$original_snmpd" + elif [[ -f $plugin_default_snmpd ]]; then + echo "Using the Unraid default config $plugin_default_snmpd, backing up the original" + cp --backup "$plugin_default_snmpd" "$original_snmpd" + else + echo "Could not find user-defined or Unraid-customized snmpd.conf! Using default $original_snmpd" + fi + # Define the additional flags we want to add into the SNMP daemon startup # Spaces at end of string to separate from other flags diff --git a/source/usr/local/emhttp/plugins/snmp/cpu_mhz.sh b/source/usr/local/emhttp/plugins/snmp/cpu_mhz.sh index e145877..d9c7f5f 100755 --- a/source/usr/local/emhttp/plugins/snmp/cpu_mhz.sh +++ b/source/usr/local/emhttp/plugins/snmp/cpu_mhz.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # This uses lscpu to find the speed of the processor in Megahertz diff --git a/source/usr/local/emhttp/plugins/snmp/disk_free_space.sh b/source/usr/local/emhttp/plugins/snmp/disk_free_space.sh index ab7fe25..ebc70fa 100755 --- a/source/usr/local/emhttp/plugins/snmp/disk_free_space.sh +++ b/source/usr/local/emhttp/plugins/snmp/disk_free_space.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # This uses df to find the free space of physical disks diff --git a/source/usr/local/emhttp/plugins/snmp/disk_temps.sh b/source/usr/local/emhttp/plugins/snmp/disk_temps.sh index a6db332..f74d537 100755 --- a/source/usr/local/emhttp/plugins/snmp/disk_temps.sh +++ b/source/usr/local/emhttp/plugins/snmp/disk_temps.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # Scan installed disks for their standby state and temperature # Use a 5 minute TTL cache file for increased performance when calling rapidly diff --git a/source/usr/local/emhttp/plugins/snmp/mem_info.sh b/source/usr/local/emhttp/plugins/snmp/mem_info.sh index 7da283d..7b6bad4 100755 --- a/source/usr/local/emhttp/plugins/snmp/mem_info.sh +++ b/source/usr/local/emhttp/plugins/snmp/mem_info.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # This uses /proc/meminfo to grab various memory values for SNMP diff --git a/source/usr/local/emhttp/plugins/snmp/run_before_save.php b/source/usr/local/emhttp/plugins/snmp/run_before_save.php new file mode 100644 index 0000000..df74d1e --- /dev/null +++ b/source/usr/local/emhttp/plugins/snmp/run_before_save.php @@ -0,0 +1,8 @@ + \ No newline at end of file diff --git a/source/usr/local/emhttp/plugins/snmp/share_free_space.sh b/source/usr/local/emhttp/plugins/snmp/share_free_space.sh index 3135383..c755712 100755 --- a/source/usr/local/emhttp/plugins/snmp/share_free_space.sh +++ b/source/usr/local/emhttp/plugins/snmp/share_free_space.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # This uses the Unraid-provided shares.ini to print out free KB per share diff --git a/source/usr/local/emhttp/plugins/snmp/snmp.page b/source/usr/local/emhttp/plugins/snmp/snmp.page index cf075b4..3b37bdb 100644 --- a/source/usr/local/emhttp/plugins/snmp/snmp.page +++ b/source/usr/local/emhttp/plugins/snmp/snmp.page @@ -4,33 +4,58 @@ Title="SNMP" Tag="cogs" --- - - - - - - + User Utilities + * "Tools" puts this page in the Tools menu + * Icon can be the png in the /usr/local/emhttp/plugins/snmp dir + * Title is the name showing up on the Settings page / in the header + * Tag can be any Font Awesome icon name https://fontawesome.com/icons + * + * Below: PHP and Javascript to customize the SNMP settings page in Unraid + */ +?> + +
+ + + + + + + + Enable Unsafe Temperature Checking: : @@ -38,6 +63,14 @@ Enable Unsafe Temperature Checking: > By default, this is disabled and SNMP only checks the disk temperature if the disk reports itself to be out of STANDBY mode. Some systems' disks always report STANDBY mode, preventing SNMP from ever fetching disk temperature. Enable this setting to use a less safe method of temperature fetching that may wake the disks from STANDBY in some systems. + + +Custom snmpd.conf contents: +: + + +> This text will be copied to /etc/snmp/snmpd.conf and also backed up to USB. SNMP will also be restarted after clicking Apply or Default + @@ -53,6 +86,10 @@ Enable Unsafe Temperature Checking: