def __init__(self, host, community="public", version="1", port=161,
retries=3, timeout=1):
"""Makes a new Snmp-object.
:param host: hostname or IP address
:param community: community (password), defaults to "public"
:param port: udp port number, defaults to "161"
"""
self.host = host
self.community = str(community)
self.version = str(version)
if self.version == '2':
self.version = '2c'
if self.version not in ('1', '2c'):
raise UnsupportedSnmpVersionError(self.version)
self.port = int(port)
self.retries = retries
self.timeout = timeout
self.handle = _MySnmpSession(self._build_cmdline())
self.handle.open()
评论列表
文章目录