]> granicus.if.org Git - icinga2/commitdiff
Remove the SNMP auto-discovery scripts.
authorGunnar Beutner <gunnar.beutner@netways.de>
Sat, 12 Apr 2014 23:20:51 +0000 (01:20 +0200)
committerGunnar Beutner <gunnar.beutner@netways.de>
Sat, 12 Apr 2014 23:20:51 +0000 (01:20 +0200)
Refs #4865

contrib/discover-snmp.py [deleted file]
etc/CMakeLists.txt
etc/icinga2/scripts/snmp-extend.sh [deleted file]
itl/command-common.conf

diff --git a/contrib/discover-snmp.py b/contrib/discover-snmp.py
deleted file mode 100755 (executable)
index 3372ace..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-#!/usr/bin/env python
-from __future__ import print_function
-import sys, getopt, hmac, hashlib, subprocess
-
-def warning(*objs):
-    print(*objs, file=sys.stderr)
-
-opts, args = getopt.getopt(sys.argv[1:], "k:h", [ "key=", "help" ])
-
-pkey = None
-
-for opt, arg in opts:
-    if opt == "-?" or opt == "--help":
-        warning("Syntax: %s --key <key> <ipaddr>")
-        sys.exit(1)
-    elif opt == "-k" or opt == "--key":
-        pkey = arg
-
-if not pkey:
-    warning("You must specify a key with the --key option.")
-    sys.exit(1)
-
-if len(args) != 1:
-    warning("Please specify exactly one IP address.")
-    sys.exit(1)
-
-ipaddr = args[0]
-
-def ukey(ipaddr):
-    return hmac.new(pkey, ipaddr, hashlib.sha256).hexdigest()[0:12]
-
-plugins = []
-
-community = ukey(ipaddr)
-warning("IP address: %s, SNMP Community: %s" % (ipaddr, community))
-
-process = subprocess.Popen(["snmpwalk", "-v2c", "-c", community, "-On", ipaddr, ".1.3.6.1.4.1.8072.1.3.2.3.1.2"], stdout=subprocess.PIPE)
-(out, err) = process.communicate()
-
-if process.returncode != 0:
-    sys.exit(1)
-
-for line in out.split("\n"):
-    oid = line.split(" ")[0]
-    plugin = oid.split(".")[15:]
-    if len(plugin) == 0:
-        continue
-    plugin = "".join([chr(int(ch)) for ch in plugin])
-    plugins.append(plugin)
-
-for plugin in plugins:
-    print("apply Service \"%s\" {" % (plugin))
-    print("  import \"snmp-extend-service\",")
-    print()
-    print("  check_command = \"snmp-extend\",")
-    print("  vars.community = \"%s\"," % (community))
-    print("  vars.plugin = \"%s\"," % (plugin))
-    print()
-    print("  assign where host.address == \"%s\"" % (ipaddr))
-    print("}")
-    print()
-
-sys.exit(0)
index 7a5dd5109c99b095b6d03aae5405e087a5f1657d..e0ace12cf4fe6532d57d18e06d585b1075e7f321 100644 (file)
@@ -48,7 +48,6 @@ install_if_not_exists(icinga2/features-available/syslog.conf ${CMAKE_INSTALL_SYS
 install_if_not_exists(icinga2/scripts/check_kernel ${CMAKE_INSTALL_SYSCONFDIR}/icinga2/scripts)
 install_if_not_exists(icinga2/scripts/mail-host-notification.sh ${CMAKE_INSTALL_SYSCONFDIR}/icinga2/scripts)
 install_if_not_exists(icinga2/scripts/mail-service-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\")")
diff --git a/etc/icinga2/scripts/snmp-extend.sh b/etc/icinga2/scripts/snmp-extend.sh
deleted file mode 100755 (executable)
index 85772d9..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/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
index 2369af200616d2baacc601ed3e1a5ab5a7f8584a..49b23911184df2aaee4d1602cd2525998a35fbf7 100644 (file)
@@ -285,19 +285,6 @@ object CheckCommand "cluster" {
 
 }
 
-object CheckCommand "snmp-extend" {
-       import "plugin-check-command",
-
-       command = [
-               SysconfDir + "/icinga2/scripts/snmp-extend.sh",
-               "$address$",
-               "$community$",
-               "$plugin$"
-       ],
-
-       vars.community = "public"
-}
-
 object CheckCommand "agent" {
        import "agent-check-command"
 }