mirror of https://github.com/Icinga/icinga2.git
parent
6ef2cdb0eb
commit
3ce7262aa8
|
@ -48,14 +48,15 @@ for line in out.split("\n"):
|
|||
plugin = "".join([chr(int(ch)) for ch in plugin])
|
||||
plugins.append(plugin)
|
||||
|
||||
print("template Host \"snmp-extend:%s\" {" % (ipaddr))
|
||||
print(" macros[\"community\"] = \"%s\"," % (community))
|
||||
for plugin in plugins:
|
||||
print(" services[\"%s\"] = {" % (plugin))
|
||||
print(" templates = [ \"snmp-extend-service\" ],")
|
||||
print("apply Service \"%s\" {" % (plugin))
|
||||
print(" import \"snmp-extend-service\",")
|
||||
print()
|
||||
print(" check_command = \"snmp-extend\",")
|
||||
print(" macros[\"plugin\"] = \"%s\"" % (plugin))
|
||||
print(" },")
|
||||
print(" macros[\"community\"] = \"%s\"," % (community))
|
||||
print()
|
||||
print(" assign where host.macros.address == \"%s\"" % (ipaddr))
|
||||
print("}")
|
||||
print()
|
||||
|
||||
sys.exit(0)
|
||||
|
|
|
@ -106,19 +106,20 @@ def process_host(host_element):
|
|||
hosts[name] = { "name": name, "address": address, "services": services }
|
||||
|
||||
def print_host(host):
|
||||
print "object Host \"%s\" inherits \"discovered-host\" {" % (host["name"])
|
||||
print "\tmacros[\"address\"] = \"%s\"," % (host["address"])
|
||||
print "object Host \"%s\" {" % (host["name"])
|
||||
print "\timport \"discovered-host\","
|
||||
print ""
|
||||
print "\tmacros.address = \"%s\"," % (host["address"])
|
||||
print "}"
|
||||
print ""
|
||||
|
||||
for serv, service in host["services"].iteritems():
|
||||
print "apply Service \"%s\" {" % (serv)
|
||||
print "\timport \"discovered-service\","
|
||||
print ""
|
||||
print "\tservices[\"%s\"] = {" % (serv)
|
||||
print "\t\ttemplates = [ \"discovered-service\" ],"
|
||||
print "\tcheck_command = \"%s\"," % (service["command"])
|
||||
print ""
|
||||
print "\t\tcheck_command = \"%s\"," % (service["command"])
|
||||
print ""
|
||||
print "\t\tmacros[\"port\"] = %s" % (service["port"])
|
||||
print "\t},"
|
||||
|
||||
print "\tmacros.port = %s" % (service["port"])
|
||||
print "}"
|
||||
print ""
|
||||
|
||||
|
|
Loading…
Reference in New Issue