def __init__(self, name=os.path.basename(sys.argv[0]), version=None,
                 add_stdargs=True, catch_exceptions=True):
        """
        initialize the plugin object

        arguments:
            name: the name of the plugin, as used in the auto-generated help
            version: an optional version of your plugin
            add_stdargs: add hostname, timeout, verbose and version (default)
            catch_exceptions: gracefully catch exceptions
        """
        self._name = name
        self._args = None
        self._timeout = 10
        self._results = []
        self._perfdata = []
        self._extdata = []
        self._timeout_delay = None
        self._timeout_code = None
        if version is None:
            version = "undefined"
        if catch_exceptions is True:
            sys.excepthook = self._excepthook
        self._parser = ThrowingArgumentParser()
        if add_stdargs:
            self.parser.add_argument("-H", "--hostname",
                                     help="hostname", metavar="HOSTNAME")
            self.parser.add_argument("-t", "--timeout", help="timeout",
                                     metavar="TIMEOUT", default=30, type=int)
            self.parser.add_argument("-v", "--verbose",
                                     help="increase verbosity",
                                     action="count", default=0)
            self.parser.add_argument("-V", "--version", help="show version",
                                     action="version",
                                     version=name + " " + str(version))
def __init__ ( self , name = os . path . basename ( sys . argv [ 0 ] ) , version = None , add_stdargs = True , catch_exceptions = True ) : self . _name = name self . _args = None self . _timeout = 10 self . _results = [ ] self . _perfdata = [ ] self . _extdata = [ ] self . _timeout_delay = None self . _timeout_code = None if version is None : version = "undefined" if catch_exceptions is True : sys . excepthook = self . _excepthook self . _parser = ThrowingArgumentParser ( ) if add_stdargs : self . parser . add_argument ( "-H" , "--hostname" , help = "hostname" , metavar = "HOSTNAME" ) self . parser . add_argument ( "-t" , "--timeout" , help = "timeout" , metavar = "TIMEOUT" , default = 30 , type = int ) self . parser . add_argument ( "-v" , "--verbose" , help = "increase verbosity" , action = "count" , default = 0 ) self . parser . add_argument ( "-V" , "--version" , help = "show version" , action = "version" , version = name + " " + str ( version ) )
initialize the plugin object

        arguments:
            name: the name of the plugin, as used in the auto-generated help
            version: an optional version of your plugin
            add_stdargs: add hostname, timeout, verbose and version (default)
            catch_exceptions: gracefully catch exceptions