# ------------------------------------------------------------------------------ # SNMP monitoring conf # This file is part of the init.sh project # Copyright (c) 2019-2021 Geoffray Levasseur # ------------------------------------------------------------------------------ # This file is distributed under 3-clause BSD license. # The complete license agreement can be obtained at: # https://opensource.org/licenses/BSD-3-Clause # ------------------------------------------------------------------------------ export VER_patch_snmp="0.1.1" export DEP_patch_snmp="install_pkg" patch_snmp() { pkginst snmpd backup_dist /etc/snmp/snmpd.conf /etc/default/snmpd \ /lib/systemd/system/snmpd.service /etc/init.d/snmpd install_file snmpd/snmpd.conf /etc/snmp/snmpd.conf tag_file /etc/snmp/snmpd.conf # No longer required with Debian >= 11 or Devuan >= 4 if [[ ($SYS_DIST == 'debian' && $SYS_VER -lt 11) || ($SYS_DIST == 'devuan' && $SYS_VER -lt 4) ]]; then install_file snmpd/snmpd.init /etc/init.d/snmpd fi install_file snmpd/snmpd.default /etc/default/snmpd tag_file /etc/default/snmpd if [[ -e /lib/systemd/system/snmpd.service ]]; then install_file snmpd/snmpd.service /lib/systemd/system/snmpd.service if command -v systemctl &> /dev/null; then systemctl daemon-reload fi fi svc_restart snmpd } precheck_patch_snmp() { file_must_exists snmpd/snmpd.{conf,default} if [[ -e /lib/systemd/system/snmpd.service ]]; then file_must_exists snmpd/snmpd.service fi } export -f patch_snmp export -f precheck_patch_snmp # EOF