mirror of https://github.com/Icinga/icinga2.git
parent
47fe59e4de
commit
c580632e90
|
@ -44,6 +44,7 @@ install_if_not_exists(icinga2/features-available/perfdata.conf ${CMAKE_INSTALL_S
|
|||
install_if_not_exists(icinga2/features-available/statusdata.conf ${CMAKE_INSTALL_SYSCONFDIR}/icinga2/features-available)
|
||||
install_if_not_exists(icinga2/features-available/syslog.conf ${CMAKE_INSTALL_SYSCONFDIR}/icinga2/features-available)
|
||||
install_if_not_exists(icinga2/scripts/mail-notification.sh ${CMAKE_INSTALL_SYSCONFDIR}/icinga2/scripts)
|
||||
install_if_not_exists(icinga2/scripts/snmp-extend.sh ${CMAKE_INSTALL_SYSCONFDIR}/icinga2/scripts)
|
||||
install_if_not_exists(logrotate.d/icinga2 ${CMAKE_INSTALL_SYSCONFDIR}/logrotate.d)
|
||||
|
||||
install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}${CMAKE_INSTALL_FULL_SYSCONFDIR}/icinga2/features-enabled\")")
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
#!/bin/sh
|
||||
SNMPGET=$(which snmpget)
|
||||
test -x $SNMPGET || exit 3
|
||||
|
||||
if [ -z "$3" ]; then
|
||||
echo "Syntax: $0 <host> <community> <plugin>"
|
||||
exit 3
|
||||
fi
|
||||
|
||||
HOST=$1
|
||||
COMMUNITY=$2
|
||||
PLUGIN=$3
|
||||
|
||||
RESULT=$(snmpget -v2c -c $COMMUNITY -OQv $HOST .1.3.6.1.4.1.8072.1.3.2.3.1.2.\"$PLUGIN\" 2>&1 | sed -e 's/^"//' -e 's/"$//')
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo $RESULT
|
||||
exit 3
|
||||
fi
|
||||
|
||||
STATUS=$(echo $RESULT | cut -f1 -d' ')
|
||||
OUTPUT=$(echo $RESULT | cut -f2- -d' ')
|
||||
|
||||
echo $OUTPUT
|
||||
exit $STATUS
|
|
@ -241,3 +241,14 @@ object CheckCommand "icinga" inherits "icinga-check-command" {
|
|||
|
||||
object CheckCommand "cluster" inherits "cluster-check-command" {
|
||||
}
|
||||
|
||||
object CheckCommand "snmp-extend" inherits "plugin-check-command" {
|
||||
command = [
|
||||
IcingaSysconfDir + "/icinga2/scripts/snmp-extend.sh",
|
||||
"$HOSTADDRESS$",
|
||||
"$community$",
|
||||
"$plugin$"
|
||||
],
|
||||
|
||||
macros["community"] = "public"
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue