]> ##&name; ###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. ###SNMP### Installs and configures SNMP, the Simple Network Management Protocol. SNMP can be used to expose server information to monitoring tools like Observium. perl_path=$(which perl 2>/dev/null) if [ ! -x "$perl_path" ] ; then echo "This plugin requires perl. The easiest way to get it is to install NerdPack:" echo "http://lime-technology.com/forum/index.php?topic=37541.0" echo "" echo "Exiting" echo "" echo "" exit 1 fi &pkghost;/&libnlpkg; &libnlpkgmd5; &pkghost;/&snmppkg; &snmppkgmd5; &gitURL;/&iconfile; &iconfilemd5; &gitURL;/drive_temps.sh &gitURL;/share_free_space.sh rocommunity &community; syslocation &location; syscontact &contact; 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/cache extend disktemp &plugdir;/drive_temps.sh extend sharefree &plugdir;/share_free_space.sh chmod o+rx &plugdir; echo "+==============================================================================" echo "| Updating /etc/rc.d/rc.snmpd to use our config file, and to reduce logging" echo "+==============================================================================" bash /etc/rc.d/rc.snmpd stop sed -i.old -e 's#/etc/snmp/snmpd.conf#&plugdir;/snmpd.conf#g' /etc/rc.d/rc.snmpd sed -i.old -e 's#OPTIONS="#OPTIONS="-LF w /var/log/snmpd.log #g' /etc/rc.d/rc.snmpd chmod a+x &plugdir;/drive_temps.sh chmod a+x &plugdir;/share_free_space.sh bash /etc/rc.d/rc.snmpd start echo "" echo "" echo "+==============================================================================" echo "| Testing SNMP by listing mounts" echo "+==============================================================================" RESULTS=$(snmpwalk -v 1 localhost -c public hrFSMountPoint 2>&1) if [[ "$RESULTS" =~ "/boot" ]] then echo "Looks like snmpd is working... Output:" echo "$RESULTS" else echo "Couldn't find /boot mount point in SNMP output. Output:" echo "$RESULTS" echo "" echo "" exit 1 fi echo "" echo "Here's what drive temperatures look like:" echo snmpwalk -v 2c localhost -c public 'NET-SNMP-EXTEND-MIB::nsExtendOutLine."disktemp"' snmpwalk -v 2c localhost -c public 'NET-SNMP-EXTEND-MIB::nsExtendOutLine."disktemp"' echo "" echo "Here's what share free space looks like:" echo snmpwalk -v 2c localhost -c public 'NET-SNMP-EXTEND-MIB::nsExtendOutLine."sharefree"' snmpwalk -v 2c localhost -c public 'NET-SNMP-EXTEND-MIB::nsExtendOutLine."sharefree"' echo "" echo "" exit 0 echo "" echo "-----------------------------------------------------------" echo " &name; has been installed." echo " Copyright 2015, David Coppit <david@coppit.org>" echo " Version: &version;" echo "-----------------------------------------------------------" echo "" echo "+==============================================================================" echo "| Uninstalling packages" echo "+==============================================================================" # Delete the package, and any old package files too rm -f $(ls &pkgdir;/&name;*.txz 2>/dev/null) # Uninstall the package removepkg $(basename &snmppkg; .txz) | grep -v -e ' --> Deleting' # Don't uninstall the prerequisites, in case some other plug is using them. On reboot, they'll get "removed" if no plugin # needs them, or will be re-downloaded and reinstalled by some plugin that does need them. #removepkg $(basename &libnlpkg; .txz) | grep -v -e ' --> Deleting' echo "" echo "" echo "+==============================================================================" echo "| Deleting &plugdir;" echo "+==============================================================================" # Remove plugin. rm -rf &plugdir; echo "" echo ""