.
This commit is contained in:
		
							
								
								
									
										14
									
								
								scripts/fan.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								scripts/fan.py
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,14 @@
 | 
			
		||||
# pkgk install py37-pysnmp
 | 
			
		||||
 | 
			
		||||
from pysnmp import hlapi
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def get(target, oids, credentials, port=161, engine=hlapi.SnmpEngine(), context=hlapi.ContextData()):
 | 
			
		||||
    handler = hlapi.getCmd(
 | 
			
		||||
        engine,
 | 
			
		||||
        credentials,
 | 
			
		||||
        hlapi.UdpTransportTarget((target, port)),
 | 
			
		||||
        context,
 | 
			
		||||
        *construct_object_types(oids)
 | 
			
		||||
    )
 | 
			
		||||
    return fetch(handler, 1)[0]
 | 
			
		||||
		Reference in New Issue
	
	Block a user