• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python Generic.GenericServer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中Nagstamon.Server.Generic.GenericServer的典型用法代码示例。如果您正苦于以下问题:Python GenericServer类的具体用法?Python GenericServer怎么用?Python GenericServer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了GenericServer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: __init__

    def __init__(self, **kwds):
        GenericServer.__init__(self, **kwds)

        # Entries for monitor default actions in context menu
        self.MENU_ACTIONS = ["Monitor", "Recheck", "Acknowledge", "Downtime"]
        self.STATUS_SVC_MAPPING = {"0": "OK", "1": "WARNING", "2": "CRITICAL", "3": "UNKNOWN"}
        self.STATUS_HOST_MAPPING = {"0": "UP", "1": "DOWN", "2": "UNREACHABLE"}
开发者ID:jhenkins,项目名称:Nagstamon,代码行数:7,代码来源:op5Monitor.py


示例2: init_HTTP

    def init_HTTP(self):
        if self.HTTPheaders == {}:
            GenericServer.init_HTTP(self)

        # get cookie to access Opsview web interface to access Opsviews Nagios part
        if len(self.Cookie) == 0:

            if str(self.conf.debug_mode) == "True":
                self.Debug(server=self.get_name(), debug="Fetching Login token")

            # put all necessary data into url string
            logindata = urllib.urlencode({"username":self.get_username(),\
                             "password":self.get_password(),})

            # the following is necessary for Opsview servers
            # get cookie from login page via url retrieving as with other urls
            try:
                # login and get cookie
                urlcontent = self.urlopener.open(self.monitor_url + "/rest/login", logindata)
                resp = literal_eval(urlcontent.read().decode("utf8", errors="ignore"))

                if str(self.conf.debug_mode) == "True":
                    self.Debug(server=self.get_name(), debug="Login Token: " + resp.get('token') )

                self.HTTPheaders["raw"] = {"Accept":"application/json","Content-Type":"application/json", "X-Opsview-Username":self.get_username(), "X-Opsview-Token":resp.get('token')}

                urlcontent.close()
            except:
                self.Error(sys.exc_info())
开发者ID:jhenkins,项目名称:Nagstamon,代码行数:29,代码来源:Opsview.py


示例3: __init__

    def __init__(self, **kwds):
        GenericServer.__init__(self, **kwds)

        # Entries for monitor default actions in context menu
        self.MENU_ACTIONS = ["Monitor", "Recheck", "Acknowledge", "Downtime"]
        self.STATUS_SVC_MAPPING = {'0':'OK', '1':'WARNING', '2':'CRITICAL', '3':'UNKNOWN'}
        self.STATUS_HOST_MAPPING = {'0':'UP', '1':'DOWN', '2':'UNREACHABLE'}
开发者ID:mattiasr,项目名称:Nagstamon,代码行数:7,代码来源:op5Monitor.py


示例4: init_HTTP

    def init_HTTP(self):
        if self.HTTPheaders == {}:
            GenericServer.init_HTTP(self)
            # special Opsview treatment, transmit username and passwort for XML requests
            # http://docs.opsview.org/doku.php?id=opsview3.4:api
            # this is only necessary when accessing the API and expecting a XML answer
            self.HTTPheaders["xml"] = {
                "Content-Type": "text/xml",
                "X-Username": self.get_username(),
                "X-Password": self.get_password(),
            }

        # get cookie to access Opsview web interface to access Opsviews Nagios part
        if len(self.Cookie) == 0:
            # put all necessary data into url string
            logindata = urllib.urlencode(
                {
                    "login_username": self.get_username(),
                    "login_password": self.get_password(),
                    "back": "",
                    "app": "",
                    "login": "Log In",
                }
            )

            # the following is necessary for Opsview servers
            # get cookie from login page via url retrieving as with other urls
            try:
                # login and get cookie
                urlcontent = self.urlopener.open(self.monitor_url + "/login", logindata)
                urlcontent.close()
            except:
                self.Error(sys.exc_info())
开发者ID:johncanlam,项目名称:Nagstamon,代码行数:33,代码来源:Opsview.py


示例5: init_HTTP

    def init_HTTP(self):
        """
        partly not constantly working Basic Authorization requires extra Autorization headers,
        different between various server types
        """
        GenericServer.init_HTTP(self)

        #if self.HTTPheaders == {}:
        #    for giveback in ["raw", "obj"]:
        #        self.HTTPheaders[giveback] = {"Authorization": "Basic " + base64.b64encode(self.get_username() + ":" + self.get_password())}

        # only if cookies are needed
        if self.CookieAuth:
            # get cookie to access Check_MK web interface
            if len(self.Cookie) < 2:
                # put all necessary data into url string
                logindata = urllib.urlencode({"login":self.get_username(),\
                                 "password":self.get_password(),\
                                 "submit":"Login"})
                # get cookie from login page via url retrieving as with other urls
                try:
                    # login and get cookie
                    # empty referer seems to be ignored so add it manually
                    urlcontent = self.urlopener.open(self.monitor_cgi_url + "/login.cgi?", logindata + "&referer=")
                    urlcontent.close()
                except:
                    self.Error(sys.exc_info())
开发者ID:nono-gdv,项目名称:Nagstamon,代码行数:27,代码来源:Thruk.py


示例6: __init__

    def __init__(self, **kwds):
        # add all keywords to object, every mode searchs inside for its favorite arguments/keywords
        for k in kwds: self.__dict__[k] = kwds[k]

        GenericServer.__init__(self, **kwds)

        # Entries for monitor default actions in context menu
        self.MENU_ACTIONS = ["Monitor", "Recheck", "Acknowledge", "Downtime"]
开发者ID:schurzi,项目名称:Nagstamon,代码行数:8,代码来源:Centreon.py


示例7: init_HTTP

 def init_HTTP(self):
     """
     initialize HTTP connection
     """
     if self.HTTPheaders == {}:
         GenericServer.init_HTTP(self)
         # Centreon xml giveback method just should exist
         self.HTTPheaders["xml"] = {}
开发者ID:schurzi,项目名称:Nagstamon,代码行数:8,代码来源:Centreon.py


示例8: __init__

    def __init__(self, **kwds):
        GenericServer.__init__(self, **kwds)

        # dictionary to translate status bitmaps on webinterface into status flags
        # this are defaults from Nagios

        # Entries for monitor default actions in context menu
        self.MENU_ACTIONS = ["Monitor", "Recheck", "Acknowledge", "Downtime"]
开发者ID:ageric,项目名称:Nagstamon,代码行数:8,代码来源:Ninja.py


示例9: init_HTTP

    def init_HTTP(self):
        """
        Icinga 1.11 needs extra Referer header for actions
        """
        GenericServer.init_HTTP(self)

        if not "Referer" in self.HTTPheaders:
            # to execute actions since Icinga 1.11 a Referer Header is necessary
            for giveback in ["raw", "obj"]:
                self.HTTPheaders[giveback]["Referer"] = self.monitor_cgi_url + "/cmd.cgi"
开发者ID:EEJ9000,项目名称:Nagstamon,代码行数:10,代码来源:Icinga.py


示例10: __init__

    def __init__(self, **kwds):
        GenericServer.__init__(self, **kwds)

        # Prepare all urls needed by nagstamon - 
        self.urls = {}
        self.statemap = {}

        # Entries for monitor default actions in context menu
        self.MENU_ACTIONS = ["Recheck", "Acknowledge", "Downtime"]
        self.username = self.conf.servers[self.get_name()].username
        self.password = self.conf.servers[self.get_name()].password
开发者ID:clark42,项目名称:Nagstamon,代码行数:11,代码来源:Zabbix.py


示例11: __init__

    def __init__(self, **kwds):
        # add all keywords to object, every mode searchs inside for its favorite arguments/keywords
        for k in kwds: self.__dict__[k] = kwds[k]

        GenericServer.__init__(self, **kwds)
        
        # Entries for monitor default actions in context menu
        self.MENU_ACTIONS = ["Recheck", "Acknowledge", "Downtime"]        

        # cache MD5 username + password to reduce load
        self.MD5_username = Actions.MD5ify(self.conf.servers[self.get_name()].username)   
        self.MD5_password = Actions.MD5ify(self.conf.servers[self.get_name()].password)
开发者ID:jrottenberg,项目名称:nagstamon,代码行数:12,代码来源:Centreon.py


示例12: __init__

    def __init__(self, **kwds):
        GenericServer.__init__(self, **kwds)
        
        # dictionary to translate status bitmaps on webinterface into status flags
        # this are defaults from Nagios
        self.STATUS_MAPPING = { "acknowledged.png" : "acknowledged",\
                                "active-checks-disabled.png" : "passiveonly",\
                                "notify-disabled.png" : "notifications_disabled",\
                                "scheduled_downtime.png" : "scheduled_downtime",\
                                "flapping.gif" : "flapping" }   

        # Entries for monitor default actions in context menu
        self.MENU_ACTIONS = ["Recheck", "Acknowledge", "Downtime"]      
开发者ID:jrottenberg,项目名称:nagstamon,代码行数:13,代码来源:Ninja.py


示例13: init_HTTP

    def init_HTTP(self):

        self.statemap = {
            'UNREACH': 'UNREACHABLE',
            'CRIT': 'CRITICAL',
            'WARN': 'WARNING',
            'UNKN': 'UNKNOWN',
            'PEND': 'PENDING',
            '0': 'OK',
            '1': 'UNKNOWN',
            '2': 'WARNING',
            '5': 'CRITICAL',
            '3': 'WARNING',
            '4': 'CRITICAL'}
        GenericServer.init_HTTP(self)
开发者ID:clark42,项目名称:Nagstamon,代码行数:15,代码来源:Zabbix.py


示例14: __init__

    def __init__(self, **kwds):
        GenericServer.__init__(self, **kwds)
        self.States = ["UP", "UNKNOWN", "WARNING", "CRITICAL", "UNREACHABLE", "DOWN", "CRITICAL", "HIGH", "AVERAGE"]
        self.nagitems_filtered = {
            "services": {"CRITICAL": [], "HIGH": [], "AVERAGE": [], "WARNING": [], "INFORMATION": [], "UNKNOWN": []},
            "hosts": {"DOWN": [], "UNREACHABLE": []},
        }
        # Prepare all urls needed by nagstamon -
        self.urls = {}
        self.statemap = {}

        # Entries for monitor default actions in context menu
        self.MENU_ACTIONS = ["Recheck", "Acknowledge", "Downtime"]
        self.username = self.conf.servers[self.get_name()].username
        self.password = self.conf.servers[self.get_name()].password
        self.min_severity = self.conf.servers[self.get_name()].min_severity
开发者ID:sergeyignatov,项目名称:zagstamon,代码行数:16,代码来源:Zabbix.py


示例15: init_HTTP

 def init_HTTP(self):
     # Fix eventually missing tailing "/" in url
     self.statemap = {
         "UNREACH": "UNREACHABLE",
         "CRIT": "CRITICAL",
         "WARN": "WARNING",
         "UNKN": "UNKNOWN",
         "PEND": "PENDING",
         "0": "OK",
         "1": "UNKNOWN",
         "2": "WARNING",
         "5": "CRITICAL",
         "3": "WARNING",
         "4": "CRITICAL",
     }
     GenericServer.init_HTTP(self)
开发者ID:nono-gdv,项目名称:Nagstamon,代码行数:16,代码来源:Zabbix.py


示例16: init_HTTP

    def init_HTTP(self):
        # add default auth for monitor.old
        GenericServer.init_HTTP(self)

        # self.Cookie is a CookieJar which is a list of cookies - if 0 then emtpy
        if len(self.Cookie) == 0:
            try:
                # Ninja Settings
                # get a Ninja cookie via own method
                self.urlopener.add_handler(urllib2.HTTPDefaultErrorHandler())
                self.urlopener.open(self.login_url, urllib.urlencode({'username': self.get_username(), 'password': self.get_password(), 'csrf_token': self.csrf()}))

                if str(self.conf.debug_mode) == "True":
                    self.Debug(server=self.get_name(), debug="Cookie:" + str(self.Cookie))

            except:
                self.Error(sys.exc_info())
开发者ID:ageric,项目名称:Nagstamon,代码行数:17,代码来源:Ninja.py


示例17: init_HTTP

    def init_HTTP(self):
        # add default auth for monitor.old 
        GenericServer.init_HTTP(self)

        # self.Cookie is a CookieJar which is a list of cookies - if 0 then emtpy
        if len(self.Cookie) == 0: 
            try:
                # Ninja Settings
                self.commit_url = self.nagios_url + '/index.php/command/commit'
                self.login_url = self.nagios_url + '/index.php/default/do_login'
                self.time_url = self.nagios_url + '/index.php/extinfo/show_process_info'
                # get a Ninja cookie via own method
                self.urlopener.open(self.login_url, urllib.urlencode({'username': self.get_username(), 'password': self.get_password()}))

                if str(self.conf.debug_mode) == "True":
                    self.Debug(server=self.get_name(), debug="Cookie:" + str(self.Cookie))

            except:
                self.Error(sys.exc_info())
开发者ID:jrottenberg,项目名称:nagstamon,代码行数:19,代码来源:Ninja.py


示例18: __init__

    def __init__(self, **kwds):
        GenericServer.__init__(self, **kwds)

        # flag for newer cookie authentication
        self.CookieAuth = False
开发者ID:nono-gdv,项目名称:Nagstamon,代码行数:5,代码来源:Thruk.py


示例19: __init__

    def __init__(self, **kwds):
        GenericServer.__init__(self, **kwds)

        self.ws = None
开发者ID:mizunokazumi,项目名称:Nagstamon,代码行数:4,代码来源:Nagios.py


示例20: __init__

    def __init__(self, **kwds):
        GenericServer.__init__(self, **kwds)
	self.MENU_ACTIONS = []
开发者ID:gquadro,项目名称:Nagstamon,代码行数:3,代码来源:Dude.py



注:本文中的Nagstamon.Server.Generic.GenericServer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python Generic.GenericServer类代码示例发布时间:2022-05-24
下一篇:
Python NSCP.Settings类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap