Ostatnio aktywny 6 months ago

waja zrewidował ten Gist 11 years ago. Przejdź do rewizji

1 file changed, 2 insertions, 1 deletion

snmp_kernel_check.sh

@@ -1,7 +1,8 @@
1 1 #!/bin/sh
2 2 # wget -q --no-check-certificate https://gist.githubusercontent.com/waja/676ea6c3a67842a337dd/raw/snmp_kernel_check.sh -O /tmp/snmp_kernel_check.sh && sh /tmp/snmp_kernel_check.sh
3 3 #
4 - if [ "$(dpkg -l | grep linux-image | grep ^ii | wc -l)" -gt "0" -a ! "$(grep check_running_kernel /etc/snmp/snmpd.conf | wc -l)" -gt "0" -a "$(dmesg | grep -i 'Xen version:' | wc -l)" -eq "0" ]; then
4 + #if [ "$(dpkg -l | grep linux-image | grep ^ii | wc -l)" -gt "0" -a ! "$(grep check_running_kernel /etc/snmp/snmpd.conf | wc -l)" -gt "0" -a "$(dmesg | grep -i 'Xen version:' | wc -l)" -eq "0" ]; then
5 + if [ "$(dpkg -l | grep linux-image | grep ^ii | wc -l)" -gt "0" -a ! "$(grep check_running_kernel /etc/snmp/snmpd.conf | wc -l)" -gt "0" ]; then
5 6 aptitude install nagios-plugins-contrib && \
6 7 echo "extend .1.3.6.1.4.1.2021.8.30 check_running_kernel /usr/lib/nagios/plugins/check_running_kernel" >> /etc/snmp/snmpd.conf && \
7 8 /etc/init.d/snmpd restart

waja zrewidował ten Gist 11 years ago. Przejdź do rewizji

1 file changed, 1 insertion, 1 deletion

detect_kernel.sh

@@ -1,5 +1,5 @@
1 1 #!/bin/sh
2 2 KERNEL="$(dpkg -l | grep linux-image | grep ^ii | awk '{print $2}')"
3 3 if [ "$(echo ${KERNEL} | wc -l)" -gt "0" ]; then
4 - echo "${KERNEL}" | mail -s "Kernel installed on $(hostname -f)" ${1}
4 + echo "${KERNEL}" | mail -E -s "Kernel installed on $(hostname -f)" ${1}
5 5 fi

waja zrewidował ten Gist 11 years ago. Przejdź do rewizji

1 file changed, 5 insertions

detect_kernel.sh(stworzono plik)

@@ -0,0 +1,5 @@
1 + #!/bin/sh
2 + KERNEL="$(dpkg -l | grep linux-image | grep ^ii | awk '{print $2}')"
3 + if [ "$(echo ${KERNEL} | wc -l)" -gt "0" ]; then
4 + echo "${KERNEL}" | mail -s "Kernel installed on $(hostname -f)" ${1}
5 + fi

waja zrewidował ten Gist 11 years ago. Przejdź do rewizji

1 file changed, 2 insertions

snmp_kernel_check.sh

@@ -1,4 +1,6 @@
1 1 #!/bin/sh
2 + # wget -q --no-check-certificate https://gist.githubusercontent.com/waja/676ea6c3a67842a337dd/raw/snmp_kernel_check.sh -O /tmp/snmp_kernel_check.sh && sh /tmp/snmp_kernel_check.sh
3 + #
2 4 if [ "$(dpkg -l | grep linux-image | grep ^ii | wc -l)" -gt "0" -a ! "$(grep check_running_kernel /etc/snmp/snmpd.conf | wc -l)" -gt "0" -a "$(dmesg | grep -i 'Xen version:' | wc -l)" -eq "0" ]; then
3 5 aptitude install nagios-plugins-contrib && \
4 6 echo "extend .1.3.6.1.4.1.2021.8.30 check_running_kernel /usr/lib/nagios/plugins/check_running_kernel" >> /etc/snmp/snmpd.conf && \

waja zrewidował ten Gist 11 years ago. Przejdź do rewizji

1 file changed, 1 insertion, 1 deletion

snmp_kernel_check.sh

@@ -1,5 +1,5 @@
1 1 #!/bin/sh
2 - if [ "$(dpkg -l | grep linux-image | grep ^ii | wc -l)" -gt "0" -a ! "$(grep check_running_kernel /etc/snmp/snmpd.conf | wc -l)" -gt "0" -a "$(dmesg | grep -i xen | wc -l)" -eq "0" ]; then
2 + if [ "$(dpkg -l | grep linux-image | grep ^ii | wc -l)" -gt "0" -a ! "$(grep check_running_kernel /etc/snmp/snmpd.conf | wc -l)" -gt "0" -a "$(dmesg | grep -i 'Xen version:' | wc -l)" -eq "0" ]; then
3 3 aptitude install nagios-plugins-contrib && \
4 4 echo "extend .1.3.6.1.4.1.2021.8.30 check_running_kernel /usr/lib/nagios/plugins/check_running_kernel" >> /etc/snmp/snmpd.conf && \
5 5 /etc/init.d/snmpd restart

waja zrewidował ten Gist 11 years ago. Przejdź do rewizji

1 file changed, 6 insertions

snmp_kernel_check.sh(stworzono plik)

@@ -0,0 +1,6 @@
1 + #!/bin/sh
2 + if [ "$(dpkg -l | grep linux-image | grep ^ii | wc -l)" -gt "0" -a ! "$(grep check_running_kernel /etc/snmp/snmpd.conf | wc -l)" -gt "0" -a "$(dmesg | grep -i xen | wc -l)" -eq "0" ]; then
3 + aptitude install nagios-plugins-contrib && \
4 + echo "extend .1.3.6.1.4.1.2021.8.30 check_running_kernel /usr/lib/nagios/plugins/check_running_kernel" >> /etc/snmp/snmpd.conf && \
5 + /etc/init.d/snmpd restart
6 + fi
Nowsze Starsze