Jan Wagner 修订了这个 Gist 2 years ago. 转到此修订
2 files changed, 3 insertions
deploy_icinga2_agent_hw.sh
| @@ -8,6 +8,8 @@ if [ "$(systemd-detect-virt)" == "none" ]; then | |||
| 8 | 8 | apt-get install -y --no-install-recommends -t ${VERSION_CODENAME}-backports freeipmi-tools libipc-run-perl pciutils && \ | |
| 9 | 9 | echo "nagios ALL=(root) NOPASSWD: /usr/sbin/ipmi-sensors, /usr/sbin/ipmi-sel, /usr/sbin/ipmi-fru, /usr/sbin/ipmi-dcmi" > /etc/sudoers.d/check_ipmi_sensor && \ | |
| 10 | 10 | echo "nagios ALL=(root) NOPASSWD: /usr/sbin/smartctl" > /etc/sudoers.d/check_smart && \ | |
| 11 | + | echo "nagios ALL = (root) NOPASSWD: /usr/lib/nagios/plugins/pmp-check-lvm-snapshots" > /etc/sudoers.d/check_lvm_snapshots && \ | |
| 12 | + | echo "nagios ALL = NOPASSWD: /usr/lib/monitoring-plugins/check_vgfree" > /etc/sudoers.d/check_vgfree && \ | |
| 11 | 13 | echo "ipmi_devintf" >> /etc/modules && echo "ipmi_si" >> /etc/modules | |
| 12 | 14 | apt-get install -y --no-install-recommends -t ${VERSION_CODENAME}-backports nagios-plugins-contrib sudo && \ | |
| 13 | 15 | if [ -f /proc/mdstat ]; then | |
deploy_icinga2_satellite.sh
| @@ -14,6 +14,7 @@ DIST=$(awk -F"[)(]+" '/VERSION=/ {print $2}' /etc/os-release); \ | |||
| 14 | 14 | fi && \ | |
| 15 | 15 | apt-get install -y --no-install-recommends monitoring-plugins-cyconet sysstat binutils sudo && \ | |
| 16 | 16 | echo "nagios ALL = NOPASSWD: /usr/lib/monitoring-plugins/check_oom" > /etc/sudoers.d/check_oom && \ | |
| 17 | + | echo 'nagios ALL = NOPASSWD: /usr/lib/nagios/plugins/check_pressure' > /etc/sudoers.d/check_pressure && \ | |
| 17 | 18 | sed -i 's#^include_recursive "conf.d"#//include_recursive "conf.d"#' /etc/icinga2/icinga2.conf && \ | |
| 18 | 19 | service icinga2 restart && icinga2 node wizard && \ | |
| 19 | 20 | sed -i 's#.*accept_config = false# accept_config = true#' /etc/icinga2/features-available/api.conf && \ | |
Jan Wagner 修订了这个 Gist 2 years ago. 转到此修订
2 files changed, 1 insertion, 1 deletion
deploy_icinga2_agent_hw.sh
| @@ -7,6 +7,7 @@ if [ "$(systemd-detect-virt)" == "none" ]; then | |||
| 7 | 7 | modprobe ipmi_si && modprobe ipmi_devintf && \ | |
| 8 | 8 | apt-get install -y --no-install-recommends -t ${VERSION_CODENAME}-backports freeipmi-tools libipc-run-perl pciutils && \ | |
| 9 | 9 | echo "nagios ALL=(root) NOPASSWD: /usr/sbin/ipmi-sensors, /usr/sbin/ipmi-sel, /usr/sbin/ipmi-fru, /usr/sbin/ipmi-dcmi" > /etc/sudoers.d/check_ipmi_sensor && \ | |
| 10 | + | echo "nagios ALL=(root) NOPASSWD: /usr/sbin/smartctl" > /etc/sudoers.d/check_smart && \ | |
| 10 | 11 | echo "ipmi_devintf" >> /etc/modules && echo "ipmi_si" >> /etc/modules | |
| 11 | 12 | apt-get install -y --no-install-recommends -t ${VERSION_CODENAME}-backports nagios-plugins-contrib sudo && \ | |
| 12 | 13 | if [ -f /proc/mdstat ]; then | |
deploy_icinga2_satellite.sh
| @@ -14,7 +14,6 @@ DIST=$(awk -F"[)(]+" '/VERSION=/ {print $2}' /etc/os-release); \ | |||
| 14 | 14 | fi && \ | |
| 15 | 15 | apt-get install -y --no-install-recommends monitoring-plugins-cyconet sysstat binutils sudo && \ | |
| 16 | 16 | echo "nagios ALL = NOPASSWD: /usr/lib/monitoring-plugins/check_oom" > /etc/sudoers.d/check_oom && \ | |
| 17 | - | echo "nagios ALL=(root) NOPASSWD: /usr/sbin/smartctl" > /etc/sudoers.d/check_smart && \ | |
| 18 | 17 | sed -i 's#^include_recursive "conf.d"#//include_recursive "conf.d"#' /etc/icinga2/icinga2.conf && \ | |
| 19 | 18 | service icinga2 restart && icinga2 node wizard && \ | |
| 20 | 19 | sed -i 's#.*accept_config = false# accept_config = true#' /etc/icinga2/features-available/api.conf && \ | |
Jan Wagner 修订了这个 Gist 2 years ago. 转到此修订
1 file changed, 3 insertions
deploy_icinga2_agent_hw.sh
| @@ -16,6 +16,9 @@ Defaults:CHECK_RAID !requiretty | |||
| 16 | 16 | CHECK_RAID ALL=(root) NOPASSWD: /sbin/dmsetup status --noflush | |
| 17 | 17 | EOF | |
| 18 | 18 | elif [[ "$(lspci | grep MegaRAID)" == *"MegaRAID"* ]]; then | |
| 19 | + | if [ ${VERSION_ID} -gt 11 ]; then | |
| 20 | + | VERSION_CODENAME="bullseye" | |
| 21 | + | fi | |
| 19 | 22 | cat > /etc/apt/sources.list.d/${VERSION_CODENAME}-le-vert.net.list <<EOF | |
| 20 | 23 | # Add key: wget -O - http://hwraid.le-vert.net/debian/hwraid.le-vert.net.gpg.key | sudo apt-key add - | |
| 21 | 24 | # | |
Jan Wagner 修订了这个 Gist 2 years ago. 转到此修订
1 file changed, 7 insertions, 4 deletions
deploy_icinga2_agent_hw.sh
| @@ -1,11 +1,14 @@ | |||
| 1 | 1 | #!/bin/bash | |
| 2 | 2 | # wget https://gist.githubusercontent.com/waja/d0995072b54b4ab5cb2b5e9ab9962543/raw/deploy_icinga2_agent_hw.sh -O /tmp/b && bash /tmp/b | |
| 3 | + | ||
| 4 | + | . /etc/os-release | |
| 5 | + | ||
| 3 | 6 | if [ "$(systemd-detect-virt)" == "none" ]; then | |
| 4 | 7 | modprobe ipmi_si && modprobe ipmi_devintf && \ | |
| 5 | - | apt-get install -y --no-install-recommends -t $(lsb_release -sc)-backports freeipmi-tools libipc-run-perl pciutils && \ | |
| 8 | + | apt-get install -y --no-install-recommends -t ${VERSION_CODENAME}-backports freeipmi-tools libipc-run-perl pciutils && \ | |
| 6 | 9 | echo "nagios ALL=(root) NOPASSWD: /usr/sbin/ipmi-sensors, /usr/sbin/ipmi-sel, /usr/sbin/ipmi-fru, /usr/sbin/ipmi-dcmi" > /etc/sudoers.d/check_ipmi_sensor && \ | |
| 7 | 10 | echo "ipmi_devintf" >> /etc/modules && echo "ipmi_si" >> /etc/modules | |
| 8 | - | apt-get install -y --no-install-recommends -t $(lsb_release -sc)-backports nagios-plugins-contrib sudo && \ | |
| 11 | + | apt-get install -y --no-install-recommends -t ${VERSION_CODENAME}-backports nagios-plugins-contrib sudo && \ | |
| 9 | 12 | if [ -f /proc/mdstat ]; then | |
| 10 | 13 | cat > /etc/sudoers.d/check_raid <<EOF | |
| 11 | 14 | User_Alias CHECK_RAID=nagios | |
| @@ -13,7 +16,7 @@ Defaults:CHECK_RAID !requiretty | |||
| 13 | 16 | CHECK_RAID ALL=(root) NOPASSWD: /sbin/dmsetup status --noflush | |
| 14 | 17 | EOF | |
| 15 | 18 | elif [[ "$(lspci | grep MegaRAID)" == *"MegaRAID"* ]]; then | |
| 16 | - | cat > /etc/apt/sources.list.d/$(lsb_release -sc)-le-vert.net.list <<EOF | |
| 19 | + | cat > /etc/apt/sources.list.d/${VERSION_CODENAME}-le-vert.net.list <<EOF | |
| 17 | 20 | # Add key: wget -O - http://hwraid.le-vert.net/debian/hwraid.le-vert.net.gpg.key | sudo apt-key add - | |
| 18 | 21 | # | |
| 19 | 22 | ||
| @@ -21,7 +24,7 @@ EOF | |||
| 21 | 24 | # Packages for RAID systems (http://hwraid.le-vert.net/wiki/DebianPackages) | |
| 22 | 25 | # | |
| 23 | 26 | ||
| 24 | - | deb http://hwraid.le-vert.net/debian $(lsb_release -sc) main | |
| 27 | + | deb http://hwraid.le-vert.net/debian ${VERSION_CODENAME} main | |
| 25 | 28 | EOF | |
| 26 | 29 | wget -O - http://hwraid.le-vert.net/debian/hwraid.le-vert.net.gpg.key | sudo apt-key add - && \ | |
| 27 | 30 | apt-get update && \ | |
Jan Wagner 修订了这个 Gist 3 years ago. 转到此修订
1 file changed, 2 insertions, 2 deletions
deploy_icinga2_satellite.sh
| @@ -9,8 +9,8 @@ DIST=$(awk -F"[)(]+" '/VERSION=/ {print $2}' /etc/os-release); \ | |||
| 9 | 9 | if [ "$(awk -F"[\"]+" '/VERSION_ID=/ {print $2}' /etc/os-release)" -ge "10" ]; then apt-get install -y --no-install-recommends -t ${DIST}-backports monitoring-plugins-contrib xz-utils lzop lz4; else apt-get install -y --no-install-recommends nagios-plugins-contrib xz-utils lzop; fi && \ | |
| 10 | 10 | apt-get install -y --no-install-recommends python3-nagiosplugin dbus && \ | |
| 11 | 11 | if [ ! $(apt-get install -qy --no-install-recommends -t $(lsb_release -sc)-backports monitoring-plugins-systemd>/dev/null) ]; then | |
| 12 | - | /usr/bin/wget -qP /tmp http://ftp.de.debian.org/debian/pool/main/m/monitoring-plugins-systemd/monitoring-plugins-systemd_2.3.1-2_all.deb && \ | |
| 13 | - | dpkg -i /tmp/monitoring-plugins-systemd_2.3.1-2_all.deb | |
| 12 | + | /usr/bin/wget -qP /tmp http://ftp.de.debian.org/debian/pool/main/m/monitoring-plugins-systemd/monitoring-plugins-systemd_2.3.1-4_all.deb && \ | |
| 13 | + | dpkg -i /tmp/monitoring-plugins-systemd_2.3.1-4_all.deb | |
| 14 | 14 | fi && \ | |
| 15 | 15 | apt-get install -y --no-install-recommends monitoring-plugins-cyconet sysstat binutils sudo && \ | |
| 16 | 16 | echo "nagios ALL = NOPASSWD: /usr/lib/monitoring-plugins/check_oom" > /etc/sudoers.d/check_oom && \ | |
Jan Wagner 修订了这个 Gist 3 years ago. 转到此修订
1 file changed, 1 insertion
deploy_icinga2_satellite.sh
| @@ -14,6 +14,7 @@ DIST=$(awk -F"[)(]+" '/VERSION=/ {print $2}' /etc/os-release); \ | |||
| 14 | 14 | fi && \ | |
| 15 | 15 | apt-get install -y --no-install-recommends monitoring-plugins-cyconet sysstat binutils sudo && \ | |
| 16 | 16 | echo "nagios ALL = NOPASSWD: /usr/lib/monitoring-plugins/check_oom" > /etc/sudoers.d/check_oom && \ | |
| 17 | + | echo "nagios ALL=(root) NOPASSWD: /usr/sbin/smartctl" > /etc/sudoers.d/check_smart && \ | |
| 17 | 18 | sed -i 's#^include_recursive "conf.d"#//include_recursive "conf.d"#' /etc/icinga2/icinga2.conf && \ | |
| 18 | 19 | service icinga2 restart && icinga2 node wizard && \ | |
| 19 | 20 | sed -i 's#.*accept_config = false# accept_config = true#' /etc/icinga2/features-available/api.conf && \ | |
Jan Wagner 修订了这个 Gist 3 years ago. 转到此修订
1 file changed, 2 insertions, 1 deletion
deploy_icinga2_satellite.sh
| @@ -12,7 +12,8 @@ DIST=$(awk -F"[)(]+" '/VERSION=/ {print $2}' /etc/os-release); \ | |||
| 12 | 12 | /usr/bin/wget -qP /tmp http://ftp.de.debian.org/debian/pool/main/m/monitoring-plugins-systemd/monitoring-plugins-systemd_2.3.1-2_all.deb && \ | |
| 13 | 13 | dpkg -i /tmp/monitoring-plugins-systemd_2.3.1-2_all.deb | |
| 14 | 14 | fi && \ | |
| 15 | - | apt-get install -y --no-install-recommends monitoring-plugins-cyconet sysstat binutils && \ | |
| 15 | + | apt-get install -y --no-install-recommends monitoring-plugins-cyconet sysstat binutils sudo && \ | |
| 16 | + | echo "nagios ALL = NOPASSWD: /usr/lib/monitoring-plugins/check_oom" > /etc/sudoers.d/check_oom && \ | |
| 16 | 17 | sed -i 's#^include_recursive "conf.d"#//include_recursive "conf.d"#' /etc/icinga2/icinga2.conf && \ | |
| 17 | 18 | service icinga2 restart && icinga2 node wizard && \ | |
| 18 | 19 | sed -i 's#.*accept_config = false# accept_config = true#' /etc/icinga2/features-available/api.conf && \ | |
Jan Wagner 修订了这个 Gist 3 years ago. 转到此修订
1 file changed, 7 insertions, 4 deletions
deploy_icinga2_satellite.sh
| @@ -2,13 +2,16 @@ | |||
| 2 | 2 | # wget https://gist.githubusercontent.com/waja/d0995072b54b4ab5cb2b5e9ab9962543/raw/deploy_icinga2_satellite.sh -O /tmp/a && bash /tmp/a | |
| 3 | 3 | DIST=$(awk -F"[)(]+" '/VERSION=/ {print $2}' /etc/os-release); \ | |
| 4 | 4 | echo "deb http://packages.icinga.com/debian icinga-${DIST} main" > /etc/apt/sources.list.d/${DIST}-icinga.list && \ | |
| 5 | - | if [ "${DIST}" == "stretch" -a ! -f /etc/apt/sources.list.d/stretch-backports.list ]; then wget -P /etc/apt/sources.list.d/ http://ftp.cyconet.org/debian/sources.list.d/stretch-backports.list; fi && \ | |
| 5 | + | if [ "${DIST}" == "stretch" -a ! -f /etc/apt/sources.list.d/stretch-backports.list ]; then wget -qP /etc/apt/sources.list.d/ http://ftp.cyconet.org/debian/sources.list.d/stretch-backports.list; fi && \ | |
| 6 | 6 | apt-get install -y --no-install-recommends gnupg apt-transport-https && \ | |
| 7 | - | wget -O - https://packages.icinga.com/icinga.key | apt-key add - && \ | |
| 7 | + | wget -qO - https://packages.icinga.com/icinga.key | apt-key add - && \ | |
| 8 | 8 | apt-get update && apt-get install -y --no-install-recommends icinga2-bin icinga2-common monitoring-plugins-basic libmonitoring-plugin-perl && \ | |
| 9 | - | apt-get install -y --no-install-recommends -t $(lsb_release -sc)-backports monitoring-plugins-contrib xz-utils lz4 lzop && \ | |
| 9 | + | if [ "$(awk -F"[\"]+" '/VERSION_ID=/ {print $2}' /etc/os-release)" -ge "10" ]; then apt-get install -y --no-install-recommends -t ${DIST}-backports monitoring-plugins-contrib xz-utils lzop lz4; else apt-get install -y --no-install-recommends nagios-plugins-contrib xz-utils lzop; fi && \ | |
| 10 | 10 | apt-get install -y --no-install-recommends python3-nagiosplugin dbus && \ | |
| 11 | - | apt-get install -y --no-install-recommends -t $(lsb_release -sc)-backports monitoring-plugins-systemd || /usr/bin/wget -P /tmp http://ftp.de.debian.org/debian/pool/main/m/monitoring-plugins-systemd/monitoring-plugins-systemd_2.3.1-2_all.deb && dpkg -i /tmp/monitoring-plugins-systemd_2.3.1-2_all.deb && \ | |
| 11 | + | if [ ! $(apt-get install -qy --no-install-recommends -t $(lsb_release -sc)-backports monitoring-plugins-systemd>/dev/null) ]; then | |
| 12 | + | /usr/bin/wget -qP /tmp http://ftp.de.debian.org/debian/pool/main/m/monitoring-plugins-systemd/monitoring-plugins-systemd_2.3.1-2_all.deb && \ | |
| 13 | + | dpkg -i /tmp/monitoring-plugins-systemd_2.3.1-2_all.deb | |
| 14 | + | fi && \ | |
| 12 | 15 | apt-get install -y --no-install-recommends monitoring-plugins-cyconet sysstat binutils && \ | |
| 13 | 16 | sed -i 's#^include_recursive "conf.d"#//include_recursive "conf.d"#' /etc/icinga2/icinga2.conf && \ | |
| 14 | 17 | service icinga2 restart && icinga2 node wizard && \ | |
Jan Wagner 修订了这个 Gist 3 years ago. 转到此修订
1 file changed, 2 insertions, 1 deletion
deploy_icinga2_satellite.sh
| @@ -5,7 +5,8 @@ DIST=$(awk -F"[)(]+" '/VERSION=/ {print $2}' /etc/os-release); \ | |||
| 5 | 5 | if [ "${DIST}" == "stretch" -a ! -f /etc/apt/sources.list.d/stretch-backports.list ]; then wget -P /etc/apt/sources.list.d/ http://ftp.cyconet.org/debian/sources.list.d/stretch-backports.list; fi && \ | |
| 6 | 6 | apt-get install -y --no-install-recommends gnupg apt-transport-https && \ | |
| 7 | 7 | wget -O - https://packages.icinga.com/icinga.key | apt-key add - && \ | |
| 8 | - | apt-get update && apt-get install -y --no-install-recommends icinga2-bin icinga2-common monitoring-plugins-basic nagios-plugins-contrib libmonitoring-plugin-perl && \ | |
| 8 | + | apt-get update && apt-get install -y --no-install-recommends icinga2-bin icinga2-common monitoring-plugins-basic libmonitoring-plugin-perl && \ | |
| 9 | + | apt-get install -y --no-install-recommends -t $(lsb_release -sc)-backports monitoring-plugins-contrib xz-utils lz4 lzop && \ | |
| 9 | 10 | apt-get install -y --no-install-recommends python3-nagiosplugin dbus && \ | |
| 10 | 11 | apt-get install -y --no-install-recommends -t $(lsb_release -sc)-backports monitoring-plugins-systemd || /usr/bin/wget -P /tmp http://ftp.de.debian.org/debian/pool/main/m/monitoring-plugins-systemd/monitoring-plugins-systemd_2.3.1-2_all.deb && dpkg -i /tmp/monitoring-plugins-systemd_2.3.1-2_all.deb && \ | |
| 11 | 12 | apt-get install -y --no-install-recommends monitoring-plugins-cyconet sysstat binutils && \ | |
Jan Wagner 修订了这个 Gist 3 years ago. 转到此修订
1 file changed, 2 insertions
deploy_icinga2_satellite.sh
| @@ -6,6 +6,8 @@ DIST=$(awk -F"[)(]+" '/VERSION=/ {print $2}' /etc/os-release); \ | |||
| 6 | 6 | apt-get install -y --no-install-recommends gnupg apt-transport-https && \ | |
| 7 | 7 | wget -O - https://packages.icinga.com/icinga.key | apt-key add - && \ | |
| 8 | 8 | apt-get update && apt-get install -y --no-install-recommends icinga2-bin icinga2-common monitoring-plugins-basic nagios-plugins-contrib libmonitoring-plugin-perl && \ | |
| 9 | + | apt-get install -y --no-install-recommends python3-nagiosplugin dbus && \ | |
| 10 | + | apt-get install -y --no-install-recommends -t $(lsb_release -sc)-backports monitoring-plugins-systemd || /usr/bin/wget -P /tmp http://ftp.de.debian.org/debian/pool/main/m/monitoring-plugins-systemd/monitoring-plugins-systemd_2.3.1-2_all.deb && dpkg -i /tmp/monitoring-plugins-systemd_2.3.1-2_all.deb && \ | |
| 9 | 11 | apt-get install -y --no-install-recommends monitoring-plugins-cyconet sysstat binutils && \ | |
| 10 | 12 | sed -i 's#^include_recursive "conf.d"#//include_recursive "conf.d"#' /etc/icinga2/icinga2.conf && \ | |
| 11 | 13 | service icinga2 restart && icinga2 node wizard && \ | |