def __init__(self, single=True ):
        """
        Initalizer

        @param single: collect from a single device?
        @type single: boolean
        """
        ZenModeler.__init__(self, single )
        self.discovered = []

        # pyraw inserts IPV4_SOCKET and IPV6_SOCKET globals
        if IPV4_SOCKET is None:
            self._pinger4 = None
        else:
            protocol = Ping4(IPV4_SOCKET)
            self._pinger4 = PingService(protocol,
                                        timeout=self.options.timeout,
                                        defaultTries=self.options.tries)

        if IPV6_SOCKET is None:
            self._pinger6 = None
        else:
            protocol = Ping6(IPV6_SOCKET)
            self._pinger6 = PingService(protocol,
                                        timeout=self.options.timeout,
                                        defaultTries=self.options.tries)
Beispiel #2
0
    def __init__(self, single=True):
        """
        Initalizer

        @param single: collect from a single device?
        @type single: boolean
        """
        ZenModeler.__init__(self, single)
        self.discovered = []

        # pyraw inserts IPV4_SOCKET and IPV6_SOCKET globals
        if IPV4_SOCKET is None:
            self._pinger4 = None
        else:
            protocol = Ping4(IPV4_SOCKET)
            self._pinger4 = PingService(protocol,
                                        timeout=self.options.timeout,
                                        defaultTries=self.options.tries)

        if IPV6_SOCKET is None:
            self._pinger6 = None
        else:
            protocol = Ping6(IPV6_SOCKET)
            self._pinger6 = PingService(protocol,
                                        timeout=self.options.timeout,
                                        defaultTries=self.options.tries)
Beispiel #3
0
    def __init__(self, single=True):
        """
        Initalizer

        @param single: collect from a single device?
        @type single: boolean
        """
        ZenModeler.__init__(self, single)
        self.discovered = []
Beispiel #4
0
    def __init__(self, single=True):
        """
        Initalizer

        @param single: collect from a single device?
        @type single: boolean
        """
        ZenModeler.__init__(self, single)
        self.discovered = []
 def buildOptions(self):
     """
     Command-line option builder for optparse
     """
     ZenModeler.buildOptions(self)
     self.parser.add_option('--net', dest='net', action="append",
                 help="Discover all device on this network")
     self.parser.add_option('--range', dest='range', action='append',
                 help="Discover all IPs in this range")
     self.parser.add_option('--deviceclass', dest='deviceclass',
                 default="/Discovered",
                 help="Default device class for discovered devices")
     self.parser.add_option('--prod_state', dest='productionState',
                 default=1000, type='int',
                 help="Initial production state for discovered devices")
     self.parser.add_option('--remodel', dest='remodel',
                 action="store_true", default=False,
                 help="Remodel existing objects")
     self.parser.add_option('--routers', dest='routersonly',
                 action="store_true", default=False,
                 help="Only discover routers")
     self.parser.add_option('--tries', dest='tries', default=1, type="int",
                 help="How many ping tries")
     self.parser.add_option('--timeout', dest='timeout',
                 default=2, type="float",
                 help="ping timeout in seconds")
     self.parser.add_option('--chunk', dest='chunkSize',
                 default=10, type="int",
                 help="Number of in-flight ping packets")
     self.parser.add_option('--snmp-missing', dest='snmpMissing',
                 action="store_true", default=False,
                 help="Send an event if SNMP is not found on the device")
     self.parser.add_option('--add-inactive', dest='addInactive',
                 action="store_true", default=False,
                 help="Add all IPs found, even if they are unresponsive")
     self.parser.add_option('--reset-ptr', dest='resetPtr',
                 action="store_true", default=False,
                 help="Reset all IP PTR records")
     self.parser.add_option('--no-snmp', dest='nosnmp',
                 action="store_true", default=False,
                 help="Skip SNMP discovery on found IP addresses")
     self.parser.add_option('--subnets', dest='subnets',
                 action="store_true", default=False,
                 help="Recurse into subnets for discovery")
     self.parser.add_option('--walk', dest='walk', action='store_true',
                 default=False,
                 help="Walk the route tree, performing discovery on all networks")
     self.parser.add_option('--max-devices', dest='maxdevices',
                 default=0,
                 type='int',
                 help="Collect a maximum number of devices. Default is no limit.")
     self.parser.add_option('--snmp-strict-discovery',
                 dest='zSnmpStrictDiscovery',
                 action="store_true", default=False,
                 help="Only add devices that can be modeled via SNMP." )
     self.parser.add_option('--prefer-snmp-naming',
                 dest='zPreferSnmpNaming',
                 action="store_true", default=False,
                 help="Prefer SNMP name to DNS name when modeling via SNMP." )
     # --job: a development-only option that jobs will use to communicate
     # their existence to zendisc. Not for users, so help is suppressed.
     self.parser.add_option('--job', dest='job', help=SUPPRESS_HELP )
Beispiel #6
0
 def buildOptions(self):
     """
     Command-line option builder for optparse
     """
     ZenModeler.buildOptions(self)
     self.parser.add_option('--net',
                            dest='net',
                            action="append",
                            help="Discover all device on this network")
     self.parser.add_option('--range',
                            dest='range',
                            action='append',
                            help="Discover all IPs in this range")
     self.parser.add_option(
         '--deviceclass',
         dest='deviceclass',
         default="/Discovered",
         help="Default device class for discovered devices")
     self.parser.add_option(
         '--prod_state',
         dest='productionState',
         default=1000,
         type='int',
         help="Initial production state for discovered devices")
     self.parser.add_option('--remodel',
                            dest='remodel',
                            action="store_true",
                            default=False,
                            help="Remodel existing objects")
     self.parser.add_option('--routers',
                            dest='routersonly',
                            action="store_true",
                            default=False,
                            help="Only discover routers")
     self.parser.add_option('--tries',
                            dest='tries',
                            default=1,
                            type="int",
                            help="How many ping tries")
     self.parser.add_option('--timeout',
                            dest='timeout',
                            default=2,
                            type="float",
                            help="ping timeout in seconds")
     self.parser.add_option('--chunk',
                            dest='chunkSize',
                            default=10,
                            type="int",
                            help="Number of in-flight ping packets")
     self.parser.add_option(
         '--snmp-missing',
         dest='snmpMissing',
         action="store_true",
         default=False,
         help="Send an event if SNMP is not found on the device")
     self.parser.add_option(
         '--add-inactive',
         dest='addInactive',
         action="store_true",
         default=False,
         help="Add all IPs found, even if they are unresponsive")
     self.parser.add_option('--reset-ptr',
                            dest='resetPtr',
                            action="store_true",
                            default=False,
                            help="Reset all IP PTR records")
     self.parser.add_option(
         '--no-snmp',
         dest='nosnmp',
         action="store_true",
         default=False,
         help="Skip SNMP discovery on found IP addresses")
     self.parser.add_option('--subnets',
                            dest='subnets',
                            action="store_true",
                            default=False,
                            help="Recurse into subnets for discovery")
     self.parser.add_option(
         '--walk',
         dest='walk',
         action='store_true',
         default=False,
         help="Walk the route tree, performing discovery on all networks")
     self.parser.add_option(
         '--max-devices',
         dest='maxdevices',
         default=0,
         type='int',
         help="Collect a maximum number of devices. Default is no limit.")
     self.parser.add_option(
         '--snmp-strict-discovery',
         dest='zSnmpStrictDiscovery',
         action="store_true",
         default=False,
         help="Only add devices that can be modeled via SNMP.")
     self.parser.add_option(
         '--prefer-snmp-naming',
         dest='zPreferSnmpNaming',
         action="store_true",
         default=False,
         help="Prefer SNMP name to DNS name when modeling via SNMP.")
     # --job: a development-only option that jobs will use to communicate
     # their existence to zendisc. Not for users, so help is suppressed.
     self.parser.add_option('--job', dest='job', help=SUPPRESS_HELP)