mirror of
				https://github.com/Icinga/icinga2.git
				synced 2025-10-31 03:03:52 +01:00 
			
		
		
		
	
							parent
							
								
									4a0a7e5b27
								
							
						
					
					
						commit
						e1563191a5
					
				| @ -29,18 +29,15 @@ for arg in args: | |||||||
|     community = ukey(arg) |     community = ukey(arg) | ||||||
|     warning("IP address: %s, SNMP Community: %s" % (arg, community)) |     warning("IP address: %s, SNMP Community: %s" % (arg, community)) | ||||||
| 
 | 
 | ||||||
|     process = subprocess.Popen(["snmpwalk", "-v2c", "-c", community, arg, ".1.3.6.1.4.1.8072.1.3.2.3.1.2"], stdout=subprocess.PIPE) |     process = subprocess.Popen(["snmpwalk", "-v2c", "-c", community, "-On", arg, ".1.3.6.1.4.1.8072.1.3.2.3.1.2"], stdout=subprocess.PIPE) | ||||||
|     (out, err) = process.communicate() |     (out, err) = process.communicate() | ||||||
| 
 | 
 | ||||||
|     for line in out.split("\n"): |     for line in out.split("\n"): | ||||||
|         oid = line.split(" ")[0] |         oid = line.split(" ")[0] | ||||||
|         plugin = oid.split(".")[-1] |         plugin = oid.split(".")[15:] | ||||||
|         if plugin == "": |         if len(plugin) == 0: | ||||||
|             continue |             continue | ||||||
|         if plugin[0] == "\"": |         plugin = "".join([chr(int(ch)) for ch in plugin]) | ||||||
|             plugin = plugin[1:] |  | ||||||
|         if plugin[-1] == "\"": |  | ||||||
|             plugin = plugin[:-1] |  | ||||||
|         plugins.append(plugin) |         plugins.append(plugin) | ||||||
| 
 | 
 | ||||||
|     print("template Host \"snmp-extend:%s\" {" % (arg)) |     print("template Host \"snmp-extend:%s\" {" % (arg)) | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user