Ejemplo n.º 1
0
    def __init__(self, hostname, ipaddr, options=None, device=None, datacollector=None, plugins=[]):
        """
        Initializer

        @param hostname: name of the remote device
        @type hostname: string
        @param ipaddr: IP address of the remote device
        @type ipaddr: string
        @param options: optparse options
        @type options: optparse options object
        @param device: DMD device object
        @type device: device object
        @param datacollector: performance data collector object
        @type datacollector: datacollector object
        @param plugins: performance data collector plugin
        @type plugins: list of plugin objects
        """
        BaseClient.__init__(self, device, datacollector)
        self.hostname = hostname
        self.options = options
        self.plugins = plugins
        self.results = []

        maxPort = getattr(device, "zIpServiceMapMaxPort", 1024)
        self.portRange = (1, maxPort)

        # self.portList = getattr(device,'zPortscanPortList', [])
        self.portList = []

        if self.portList:
            kwds = {"portList": self.portList}
        else:
            kwds = {"portRange": self.portRange}
        kwds.update(dict(timeout=self.options.portscantimeout))
        self.scanner = PortScan.Scanner(ipaddr, **kwds)
Ejemplo n.º 2
0
    def __init__(self, device=None, datacollector=None, plugins=[]):
        """
        Initializer

        @param device: remote device to use the datacollector
        @type device: device object
        @param datacollector: performance data collector object
        @type datacollector: datacollector object
        @param plugins: Python-based performance data collector plugin
        @type plugins: list of plugin objects
        """
        BaseClient.__init__(self, device, datacollector)
        self.hostname = device.id
        self.plugins = plugins
        self.results = []
Ejemplo n.º 3
0
    def __init__(self, device=None, datacollector=None, plugins=[]):
        """
        Initializer

        @param device: remote device to use the datacollector
        @type device: device object
        @param datacollector: performance data collector object
        @type datacollector: datacollector object
        @param plugins: Python-based performance data collector plugin
        @type plugins: list of plugin objects
        """
        BaseClient.__init__(self, device, datacollector)
        self.hostname = device.id
        self.plugins = plugins
        self.results = []
Ejemplo n.º 4
0
    def __init__(self, hostname, ipaddr, options=None, device=None,
                 datacollector=None, plugins=[]):
        BaseClient.__init__(self, device, datacollector)
        global defaultTries, defaultTimeout
        self.hostname = hostname
        self.device = device
        self.options = options
        self.datacollector = datacollector
        self.plugins = plugins

        self._getdata = {}
        self._tabledata = {}

        from Products.ZenHub.services.PerformanceConfig import SnmpConnInfo
        self.connInfo = SnmpConnInfo(device)
        self.proxy = None
Ejemplo n.º 5
0
    def __init__(self,
                 hostname,
                 ipaddr,
                 options=None,
                 device=None,
                 datacollector=None,
                 plugins=[]):
        BaseClient.__init__(self, device, datacollector)
        global defaultTries, defaultTimeout
        self.hostname = hostname
        self.device = device
        self.options = options
        self.datacollector = datacollector
        self.plugins = plugins

        self._getdata = {}
        self._tabledata = {}

        from Products.ZenHub.services.PerformanceConfig import SnmpConnInfo
        self.connInfo = SnmpConnInfo(device)
        self.proxy = None
Ejemplo n.º 6
0
    def __init__(self, hostname, ipaddr, options=None, device=None, 
                 datacollector=None, plugins=[]):
        """
        Initializer

        @param hostname: name of the remote device
        @type hostname: string
        @param ipaddr: IP address of the remote device
        @type ipaddr: string
        @param options: optparse options
        @type options: optparse options object
        @param device: DMD device object
        @type device: device object
        @param datacollector: performance data collector object
        @type datacollector: datacollector object
        @param plugins: performance data collector plugin
        @type plugins: list of plugin objects
        """
        BaseClient.__init__(self, device, datacollector)
        self.hostname = hostname
        self.options = options
        self.plugins = plugins
        self.results = []

        maxPort = getattr(device,'zIpServiceMapMaxPort', 1024)
        self.portRange = (1, maxPort)

        #self.portList = getattr(device,'zPortscanPortList', [])
        self.portList = []

        if self.portList:
            kwds = {'portList': self.portList}
        else:
            kwds = {'portRange': self.portRange}
        kwds.update(dict(timeout=self.options.portscantimeout))
        self.scanner = PortScan.Scanner(ipaddr, **kwds)
Ejemplo n.º 7
0
 def generate_url(self):
     return '{0}{1}{2}'.format(BaseClient.generate_url(self),
                               self.http_method, self.username)
    def __init__(self, hostname, ip, port, plugins=None, options=None, 
                    device=None, datacollector=None, alog=None):
        """
        Gather our required zProperties

        @param hostname: name of the remote device
        @type hostname: string
        @param ip: IP address of the remote device
        @type ip: string
        @param port: IP port number to listen on
        @type port: integer
        @param plugins: plugins to run
        @type plugins: list
        @param options: optparse options
        @type options: optparse options object
        @param device: DMD device object
        @type device: device object
        @param datacollector: datacollector
        @type datacollector: datacollector object
        @param alog: Python logging class object
        @type alog: Python logging class object
        """
        BaseClient.__init__(self, device, datacollector)
        from Products.ZenUtils.Utils import unused
        unused(alog)
        self.hostname = hostname
        self.ip = ip
        self.port = port
        plugins = plugins or []
        self.cmdmap = {}
        self._commands = []
        for plugin in plugins:
            self.cmdmap[plugin.command] = plugin
            self._commands.append(plugin.command)
        self.results = []
        self.protocol = None

        if options:
            defaultUsername = options.username
            defaultPassword = options.password
            defaultLoginTries = options.loginTries
            defaultLoginTimeout = options.loginTimeout
            defaultCommandTimeout = options.commandTimeout
            defaultKeyPath = options.keyPath
            defaultConcurrentSessions = options.concurrentSessions
            defaultSearchPath = options.searchPath
            defaultExistanceTest = options.existenceTest
            
        if device: # if we are in Zope look for parameters in the acquisition path
            self.username = getattr(device, 
                        'zCommandUsername', defaultUsername)
            self.password = getattr(device, 
                        'zCommandPassword', defaultPassword)
            self.loginTries = getattr(device, 
                        'zCommandLoginTries', defaultLoginTries)
            self.loginTimeout = getattr(device, 
                        'zCommandLoginTimeout', defaultLoginTimeout)
            self.commandTimeout = getattr(device, 
                        'zCommandCommandTimeout', defaultCommandTimeout)
            self.keyPath = getattr(device, 
                        'zKeyPath', defaultKeyPath)
            self.concurrentSessions = getattr(device,
                        'zSshConcurrentSessions', defaultConcurrentSessions)
            self.port = getattr(device, 'zCommandPort', self.port)
            self.searchPath = getattr(device, 
                        'zCommandSearchPath', defaultSearchPath)
            self.existenceTest = getattr(device, 
                        'zCommandExistanceTest', defaultExistanceTest)
        else:
            self.username = defaultUsername
            self.password = defaultPassword
            self.loginTries = defaultLoginTries
            self.loginTimeout = defaultLoginTimeout
            self.commandTimeout = defaultCommandTimeout
            self.keyPath = defaultKeyPath
            self.concurrentSessions = defaultConcurrentSessions
            self.searchPath = defaultSearchPath
            self.existenceTest = defaultExistanceTest
Ejemplo n.º 9
0
 def __init__(self, host='127.0.0.1', port=16713):
     BaseClient.__init__(self, host, port)
     self.name = 'ObserverBot'
     self.version = '1.0'
Ejemplo n.º 10
0
 def generate_url(self):
     return '{0}{1}{2}{3}'.format(BaseClient.generate_url(self),
                                  self.http_method, self.vk_id, self.fields)