From fe830a1ad9b3808de0110c83e480d82b99a66a06 Mon Sep 17 00:00:00 2001 From: Charles N Wyble Date: Thu, 26 Jun 2025 12:48:06 -0500 Subject: [PATCH] end to end testing on all platfoirms, finding some issues. fixing. --- ConfigFiles/SNMP/snmpd-physicalhost.conf | 42 ++++++++++++++++++++++++ SetupNewSystem.sh | 18 +++++++--- 2 files changed, 55 insertions(+), 5 deletions(-) create mode 100644 ConfigFiles/SNMP/snmpd-physicalhost.conf diff --git a/ConfigFiles/SNMP/snmpd-physicalhost.conf b/ConfigFiles/SNMP/snmpd-physicalhost.conf new file mode 100644 index 0000000..bed372e --- /dev/null +++ b/ConfigFiles/SNMP/snmpd-physicalhost.conf @@ -0,0 +1,42 @@ +########################################################################## +# snmpd.conf +# Created by CNW on 11/3/2018 via snmpconf wizard and manual post tweaks +########################################################################### +# SECTION: Monitor Various Aspects of the Running Host +# + +# disk: Check for disk space usage of a partition. +# The agent can check the amount of available disk space, and make +# sure it is above a set limit. +# +load 3 3 3 +rocommunity kn3lmgmt +sysservices 76 + +#syslocation Rack, Room, Building, City, Country [Lat, Lon] +syslocation R4, Server Room, SITER, Pflugerville, United States +syscontact coo@turnsys.com + +#NTP +extend ntp-client /usr/local/librenms/ntp-client.sh + +#SMTP +extend mailq /usr/local/librenms/postfix-queues +extend postfixdetailed /usr/local/librenms/postfixdetailed + +#OS Distribution Detection +extend distro /usr/local/bin/distro +extend osupdate /usr/local/librenms/os-updates.sh + + +#Hardware Detection +extend manufacturer /usr/bin/sudo /usr/bin/cat /sys/devices/virtual/dmi/id/sys_vendor +extend hardware /usr/bin/sudo /usr/bin/cat /sys/devices/virtual/dmi/id/product_name +extend serial /usr/bin/sudo /usr/bin/cat /sys/devices/virtual/dmi/id/product_serial + +#SMART +extend smart /bin/cat /var/cache/smart + + +# Allow Systems Management Data Engine SNMP to connect to snmpd using SMUX +# smuxpeer .1.3.6.1.4.1.674.10892.1 diff --git a/SetupNewSystem.sh b/SetupNewSystem.sh index 7c6e395..12e5af9 100644 --- a/SetupNewSystem.sh +++ b/SetupNewSystem.sh @@ -122,7 +122,7 @@ chmod 400 /root/.ssh/authorized_keys chown root: /root/.ssh/authorized_keys -if [ "$LOCALUSER_CHECK" = 1 ]; then +if [ "$LOCALUSER_CHECK" -gt 0 ]; then if [ ! -d $LOCALUSER_SSH_DIR ]; then mkdir -p /home/localuser/.ssh/ fi @@ -253,6 +253,9 @@ fi export VIRT_TYPE VIRT_TYPE="$(virt-what)" +export IS_VIRT_GUEST +VIRT_GUEST="$(echo "$VIRT_TYPE"|egrep -c 'hyperv|kvm' ||true )" + export VIRT_GUEST VIRT_GUEST="$(echo "$VIRT_TYPE"|egrep 'hyperv|kvm' ||true )" @@ -270,6 +273,7 @@ if [[ $PHYSICAL_HOST -gt 0 ]]; then export DEBIAN_FRONTEND="noninteractive" && apt-get -qq --yes -o Dpkg::Options::="--force-confold" install \ i7z \ thermald \ + cpufrequtils \ linux-cpupower # power-profiles-daemon fi @@ -304,11 +308,11 @@ echo "hi from root to root" | mail -s "hi directly to root from $(hostname)" roo chsh -s $(which zsh) root -if [ "$LOCALUSER_CHECK" = 1 ]; then +if [ "$LOCALUSER_CHECK" -gt 0 ]; then chsh -s "$(which zsh)" localuser fi -if [ "$SUBODEV_CHECK" = 1 ]; then +if [ "$SUBODEV_CHECK" -gt 0 ]; then chsh -s "$(which zsh)" localuser fi @@ -323,11 +327,15 @@ sed -i "s|-Lsd|-LS6d|" /lib/systemd/system/snmpd.service pi-detect -if [ $IS_RASPI = 1 ] ; then +if [ $IS_RASPI -eq 1 ] ; then curl --silent ${DL_ROOT}/ConfigFiles/SNMP/snmpd-rpi.conf > /etc/snmp/snmpd.conf fi -if [ $IS_RASPI != 1 ] ; then +if [ $IS_PHYSICAL_HOST -eq 1 ] ; then +curl --silent ${DL_ROOT}/ConfigFiles/SNMP/snmpd-physicalhost.conf > /etc/snmp/snmpd.conf +fi + +if [ $IS_VIRT_GUEST -eq 1 ] ; then curl --silent ${DL_ROOT}/ConfigFiles/SNMP/snmpd.conf > /etc/snmp/snmpd.conf fi