ℹ️ Your data is safe here... unless you make the SNIP gods angry. And let's just say they have a really bad sense of humor.

From Luk3000, 2 Years ago, written in Plain Text.
Embed
  1. This is my snmpd.conf
  2.  
  3. cat /etc/snmp/snmpd.conf
  4.  
  5. # Change RANDOMSTRINGGOESHERE to your preferred SNMP community string
  6. com2sec readonly  default         RANDOMSTRINGGOESHERE
  7.  
  8. group MyROGroup v2c        readonly
  9. view all    included  .1                               80
  10. access MyROGroup ""      any       noauth    exact  all    none   none
  11.  
  12. syslocation Rack, Room, Building, City, Country [Lat, Lon]
  13. syscontact Your Name <your>
  14.  
  15. #OS Distribution Detection
  16. extend distro /usr/bin/distro
  17.  
  18. -----------------------------------------------------------------------------------------------------------------
  19. This /usr/bin/distro
  20.  
  21. #!/usr/bin/env sh
  22. # Detects which OS and if it is Linux then it will detect which Linux Distribution.
  23.  
  24. OS=$(uname -s)
  25. REV=$(uname -r)
  26. #MACH=$(uname -m)
  27.  
  28. if [ "${OS}" = "SunOS" ] ; then
  29.   OS=Solaris
  30.   ARCH=$(uname -p)
  31.   OSSTR="${OS} ${REV}(${ARCH} $(uname -v))"
  32.  
  33. elif [ "${OS}" = "AIX" ] ; then
  34.   OSSTR="${OS} $(oslevel) ($(oslevel -r))"
  35.  
  36. elif [ "${OS}" = "Linux" ] ; then
  37.   #KERNEL=$(uname -r)
  38.  
  39.   if [ -f /etc/fedora-release ]; then
  40.     DIST=$(cat /etc/fedora-release | awk '{print $1}')
  41.     REV=$(cat /etc/fedora-release | sed s/.*release\ // | sed s/\ .*//)
  42.  
  43.   elif [ -f /etc/redhat-release ] ; then
  44.     DIST=$(cat /etc/redhat-release | awk '{print $1}')
  45.     if [ "${DIST}" = "CentOS" ]; then
  46.       DIST="CentOS"
  47.       IGNORE_OS_RELEASE=1 # https://bugs.centos.org/view.php?id=8359
  48.     elif [ "${DIST}" = "CloudLinux" ]; then
  49.       DIST="CloudLinux"
  50.     elif [ "${DIST}" = "Mandriva" ]; then
  51.       DIST="Mandriva"
  52.       #PSEUDONAME=$(cat /etc/mandriva-release | sed s/.*\(// | sed s/\)//)
  53.       REV=$(cat /etc/mandriva-release | sed s/.*release\ // | sed s/\ .*//)
  54.     elif [ -f /etc/oracle-release ]; then
  55.       DIST="Oracle"
  56.     elif [ -f /etc/rockstor-release ]; then
  57.       DIST="Rockstor"
  58.     else
  59.       DIST="RedHat"
  60.     fi
  61.  
  62.     #PSEUDONAME=$(cat /etc/redhat-release | sed s/.*\(// | sed s/\)//)
  63.     REV=$(cat /etc/redhat-release | sed s/.*release\ // | sed s/\ .*//)
  64.  
  65.   elif [ -f /etc/mandrake-release ] ; then
  66.     DIST='Mandrake'
  67.     #PSEUDONAME=$(cat /etc/mandrake-release | sed s/.*\(// | sed s/\)//)
  68.     REV=$(cat /etc/mandrake-release | sed s/.*release\ // | sed s/\ .*//)
  69.  
  70.   elif [ -f /etc/devuan_version ] ; then
  71.     DIST="Devuan $(cat /etc/devuan_version)"
  72.     REV=""
  73.  
  74.   elif [ -f /etc/debian_version ] ; then
  75.     DIST="Debian $(cat /etc/debian_version)"
  76.     REV=""
  77.     IGNORE_OS_RELEASE=1
  78.     if [ -f /usr/bin/lsb_release ] ; then
  79.       ID=$(lsb_release -i | awk -F ':' '{print $2}' | sed 's/\s//g')
  80.     fi
  81.     if [ "${ID}" = "Raspbian" ] ; then
  82.       DIST="Raspbian $(cat /etc/debian_version)"
  83.     fi
  84.     if [ -f /usr/bin/pveversion ]; then
  85.       DIST="${DIST}/PVE $(/usr/bin/pveversion | cut -d '/' -f 2)"
  86.     fi
  87.     if [ -f /usr/bin/pmgversion ]; then
  88.       # pmgversion requires root permissions to run, please add NOPASSWD setting to visudo.
  89.       DIST="${DIST}/PMG $(sudo /usr/bin/pmgversion | cut -d '/' -f 2)"
  90.     fi
  91.     if [ -f /etc/dogtag ]; then
  92.       DIST=$(cat /etc/dogtag)
  93.     fi
  94.  
  95.   elif [ -f /etc/gentoo-release ] ; then
  96.     DIST="Gentoo"
  97.     REV=$(tr -d '[[:alpha:]]' </etc DIST="Arch Linux" REV="" IGNORE_LSB=1 DIST=$(head REV=$(sed PHOTON_BUILD_NUMBER=//p IGNORE_LSB=1 DIST="OpenWrt" REV=$(cat DIST=$(cat REV="" DIST=$(echo xss=removed REV=$(echo xss=removed DIST="dd-wrt" DIST="ASUSWRT-Merlin" REV=$(nvram xss=removed> /dev/null 2>&1
  98.     fi
  99.   fi
  100.  
  101.   # try standardized os version methods
  102.   if [ -f /etc/os-release ] && [ "${IGNORE_OS_RELEASE}" != 1 ] ; then
  103.     . /etc/os-release
  104.     STD_DIST="$NAME"
  105.     STD_REV="$VERSION_ID"
  106.   elif [ -f /etc/lsb-release ] && [ "${IGNORE_LSB}" != 1 ] ; then
  107.     STD_DIST=$(lsb_release -si)
  108.     STD_REV=$(lsb_release -sr)
  109.   fi
  110.   if [ -n "${STD_DIST}" ]; then
  111.     DIST="${STD_DIST}"
  112.   fi
  113.   if [ -n "${STD_REV}" ]; then
  114.     REV="${STD_REV}"
  115.   fi
  116.  
  117.   if [ -n "${REV}" ]; then
  118.     OSSTR="${DIST} ${REV}"
  119.   else
  120.     OSSTR="${DIST}"
  121.   fi
  122.  
  123. elif [ "${OS}" = "Darwin" ] ; then
  124.   if [ -f /usr/bin/sw_vers ] ; then
  125.     OSSTR=$(/usr/bin/sw_vers|grep -v Build|sed 's/^.*:.//'| tr "\n" ' ')
  126.   fi
  127.  
  128. elif [ "${OS}" = "FreeBSD" ] ; then
  129.   if [ -f /etc/version ] ; then
  130.     DIST=$(cat /etc/version | cut -d'-' -f 1)
  131.     if [ "${DIST}" = "FreeNAS" ]; then
  132.       OSSTR=$(cat /etc/version | cut -d' ' -f 1)
  133.     fi
  134.   else
  135.     OSSTR=$(/usr/bin/uname -mior)
  136.   fi
  137. fi
  138.  
  139. echo "${OSSTR}"
  140.  
  141.  
  142.  
  143.  
  144.  
captcha