Exemplo n.º 1
0
 def open_monitor(self, host, service=''):
     '''
         open monitor from tablewidget context menu
     '''
     # only type is important so do not care of service '' in case of host monitor
     if service == '':
         url = '{0}/monitoring/list/hosts?host_problem=1&sort=host_severity#!{1}/monitoring/host/show?{2}'.format(
             self.monitor_url,
             (urllib.parse.urlparse(self.monitor_url).path),
             urllib.parse.urlencode({
                 'host': self.hosts[host].real_name
             }).replace('+', ' '))
     else:
         url = '{0}/monitoring/list/services?service_problem=1&sort=service_severity&dir=desc#!{1}/monitoring/service/show?{2}'.format(
             self.monitor_url,
             (urllib.parse.urlparse(self.monitor_url).path),
             urllib.parse.urlencode({
                 'host':
                 self.hosts[host].real_name,
                 'service':
                 self.hosts[host].services[service].real_name
             }).replace('+', ' '))
     if conf.debug_mode:
         self.Debug(
             server=self.get_name(),
             host=host,
             service=service,
             debug='Open host/service monitor web page {0}'.format(url))
     webbrowser_open(url)
Exemplo n.º 2
0
 def open_monitor(self, host, service=''):
     """
     open monitor for alert
     """
     url = '%s/graph?g0.range_input=1h&g0.expr=%s'
     url = url % (self.monitor_url,
                  urllib.parse.quote('ALERTS{alertname="%s"}' % service))
     webbrowser_open(url)
Exemplo n.º 3
0
 def open_monitor(self, host, service):
     if not service:
         url = "%s/monitor/index.php/extinfo/details?host=%s" % (
             self.monitor_url, host)
     else:
         url = "%s/monitor/index.php/extinfo/details?host=%s&service=%s" % (
             self.monitor_url, host, service)
     webbrowser_open(url)
Exemplo n.º 4
0
 def open_monitor(self, host, service=''):
     '''
         open monitor from tablewidget context menu
     '''
     detail_url = self.monitor_url + '/#/client/' + self.uchiwa_datacenter + '/' + host
     if service != '':
         detail_url += '?check=' + service
     webbrowser_open(detail_url)
Exemplo n.º 5
0
    def open_monitor_webpage(self):
        '''
            open monitor from systray/toparea context menu
        '''

        if conf.debug_mode:
            self.Debug(server=self.get_name(),
                       debug='Open monitor web page ' + self.monitor_url)
        webbrowser_open(self.monitor_url)
Exemplo n.º 6
0
    def open_monitor(self, host, service=''):
        # Autologin seems deprecated as admin must enable it globaly and use the old pages
        # Ex : http://10.66.113.52/centreon/main.php?autologin=1&useralias=admin&token=xxxxxx
        # if self.use_autologin is True:
        #     auth = '&autologin=1&useralias=' + self.username + '&token=' + self.autologin_key
        # else:
        #     auth = ''
        # webbrowser_open(self.urls_centreon['resources'] + auth )

        webbrowser_open(self.urls_centreon['resources'] )
Exemplo n.º 7
0
    def open_monitor(self, host, service=''):
        '''
            open monitor from tablewidget context menu
        '''

        if conf.debug_mode:
            self.Debug(server=self.get_name(), host=host, service=service,
                       debug='Open host/service monitor web page ' +
                             self.monitor_url + '/graph?g0.range_input=1h&g0.expr=' +
                             urllib.parse.quote('ALERTS{alertname="' + service + '",pod_name="' + host + '"}', safe='') + '&g0.tab=1')
        webbrowser_open(self.monitor_url + '/graph?g0.range_input=1h&g0.expr=' +
                        urllib.parse.quote('ALERTS{alertname="' + service + '",pod_name="' + host + '"}', safe='') + '&g0.tab=1')
Exemplo n.º 8
0
    def open_monitor(self, host, service=''):
        """
            open monitor from treeview context menu
        """

        if service == '':
            url = self.urls['human_host'] + urllib.parse.urlencode({'x': 'site='+self.hosts[host].site+'&host='+host}).replace('x=', '%26')
        else:
            url = self.urls['human_service'] + urllib.parse.urlencode({'x': 'site='+self.hosts[host].site+'&host='+host+'&service='+service}).replace('x=', '%26')

        if conf.debug_mode == True:
            self.Debug(server=self.get_name(), host=host, service=service, debug='Open host/service monitor web page ' + url)
        webbrowser_open(url)
Exemplo n.º 9
0
    def open_monitor(self, host, service=''):
        """
            open monitor from treeview context menu
        """

        if service == '':
            url = self.urls['human_host'] + urllib.parse.urlencode({'x': 'site='+self.hosts[host].site+'&host='+host}).replace('x=', '%26')
        else:
            url = self.urls['human_service'] + urllib.parse.urlencode({'x': 'site='+self.hosts[host].site+'&host='+host+'&service='+service}).replace('x=', '%26')

        if conf.debug_mode == True:
            self.Debug(server=self.get_name(), host=host, service=service, debug='Open host/service monitor web page ' + url)
        webbrowser_open(url)
Exemplo n.º 10
0
    def open_monitor(self, host, service=''):
        """
            Open specific Host or Service in SNAG-View 3 browser window

            :param host: String - Host name
            :param service: String - Service name
        """
        if service == '':
            url = '{0}/#/object/details/{1}'.format(self.monitor_url,
                                                    self.hosts[host].svid)
        else:
            url = '{0}/#/object/details/{1}'.format(
                self.monitor_url, self.hosts[host].services[service].svid)

        webbrowser_open(url)
Exemplo n.º 11
0
    def open_monitor(self, host, service=''):
        """
            Open specific Host or Service in SNAG-View 3 browser window

            :param host: String - Host name
            :param service: String - Service name
        """
        if service == '':
            url = '{0}/#/object/details/{1}'.format(
                self.monitor_url, self.hosts[host].svid)
        else:
            url = '{0}/#/object/details/{1}'.format(
                self.monitor_url, self.hosts[host].services[service].svid)

        webbrowser_open(url)
Exemplo n.º 12
0
 def open_monitor(self, host, service=''):
     '''
         open monitor from tablewidget context menu
     '''
     # only type is important so do not care of service '' in case of host monitor
     if service == '':    
         url = '{0}/monitoring/list/hosts?host_problem=1&sort=host_severity#!{1}/monitoring/host/show?{2}'.format(self.monitor_url,
                                                                                                                  (urllib.parse.urlparse(self.monitor_url).path),
                                                                                                                  urllib.parse.urlencode(
                                                                                                                     {'host': self.hosts[host].real_name}).replace('+', ' '))
     else:
         url = '{0}/monitoring/list/services?service_problem=1&sort=service_severity&dir=desc#!{1}/monitoring/service/show?{2}'.format(self.monitor_url,
                                                                                                                                (urllib.parse.urlparse(self.monitor_url).path),
                                                                                                                                 urllib.parse.urlencode(
                                                                                                                                     {'host': self.hosts[host].real_name,
                                                                                                                                      'service': self.hosts[host].services[service].real_name}).replace('+', ' '))
     if conf.debug_mode:
         self.Debug(server=self.get_name(), host=host, service=service,
                    debug='Open host/service monitor web page {0}'.format(url))
     webbrowser_open(url)
Exemplo n.º 13
0
    def open_monitor(self, host, service=''):
        '''
            open monitor from tablewidget context menu
        '''
        # only type is important so do not care of service '' in case of host monitor
        if service == '':
            url = self.monitor_cgi_url + '/extinfo.cgi?type=1&' + urllib.parse.urlencode(
                {'host': host})
        else:
            url = self.monitor_cgi_url + '/extinfo.cgi?type=2&' + urllib.parse.urlencode(
                {
                    'host': host,
                    'service': self.hosts[host].services[service].real_name
                })

        if conf.debug_mode:
            self.Debug(
                server=self.get_name(),
                host=host,
                service=service,
                debug='Open host/service monitor web page {0}'.format(url))
        webbrowser_open(url)
Exemplo n.º 14
0
    def _open_browser(self, url):
        webbrowser_open(url)

        if conf.debug_mode is True:
            self.Debug(server=self.get_name(), debug="Open web page " + url)
Exemplo n.º 15
0
 def open_monitor(self, host, service=''):
     """
     open monitor for alert
     """
     url = self.monitor_url
     webbrowser_open(url)
Exemplo n.º 16
0
 def open_monitor_webpage(self, host, service):
     webbrowser_open('%s' % (self.monitor_url))
Exemplo n.º 17
0
 def open_monitor_webpage(self, host, service):
     webbrowser_open('%s/monitoring/#!?autoSelectHost=%s' % (self.monitor_url, host))
Exemplo n.º 18
0
    def _open_browser(self, url):
        webbrowser_open(url)

        if conf.debug_mode is True:
            self.Debug(server=self.get_name(), debug="Open web page " + url)
Exemplo n.º 19
0
 def open_monitor(self, host, service):
     if not service:
         url = "%s/monitor/index.php/extinfo/details?host=%s" % (self.monitor_url, host)
     else:
         url = "%s/monitor/index.php/extinfo/details?host=%s&service=%s" % (self.monitor_url, host, service)
     webbrowser_open(url)
Exemplo n.º 20
0
 def open_monitor(self, host, service=''):
     if self.use_autologin == True:
         auth = '&autologin=1&useralias=' + self.username + '&token=' + self.autologin_key
         if host == '_Module_Meta':
             webbrowser_open(self.monitor_cgi_url + '/index.php?' + urllib.parse.urlencode({'p':20206,'o':'meta'}) + auth )
         elif service == '':
             if self.centreon_version == 2.7:
                 webbrowser_open(self.monitor_cgi_url + '/main.php?' + urllib.parse.urlencode({'p':20202,'o':'hd', 'host_name':host}) + auth )
             else:
                 webbrowser_open(self.monitor_cgi_url + '/index.php?' + urllib.parse.urlencode({'p':201,'o':'hd', 'host_name':host}) + auth )
         else:
             webbrowser_open(self.monitor_cgi_url + '/index.php?' + urllib.parse.urlencode({'p':202, 'o':'svcd',  'host_name':host, 'service_description':service}) + auth )
     else:
         if host == '_Module_Meta':
             webbrowser_open(self.monitor_cgi_url + '/main.php?' + urllib.parse.urlencode({'p':20206,'o':'meta'}))
         # must be a host if service is empty...
         elif service == '':
             if self.centreon_version == 2.7:
                 webbrowser_open(self.monitor_cgi_url + '/main.php?' + urllib.parse.urlencode({'p':20202,'o':'hd', 'host_name':host}))
             else:
                 webbrowser_open(self.monitor_cgi_url + '/index.php?' + urllib.parse.urlencode({'p':201,'o':'hd', 'host_name':host}))
         else:
             webbrowser_open(self.monitor_cgi_url + '/main.php?' + urllib.parse.urlencode({'p':202, 'o':'svcd',  'host_name':host, 'service_description':service}))
Exemplo n.º 21
0
 def open_monitor_webpage(self, host, service):
     """
     open monitor from tablewidget context menu
     """
     webbrowser_open('%s' % (self.monitor_url))
Exemplo n.º 22
0
 def open_monitor(self, host, service=''):
     if self.use_autologin == True:
         auth = '&autologin=1&useralias=' + self.username + '&token=' + self.autologin_key
         if host == '_Module_Meta':
             webbrowser_open(self.monitor_cgi_url + '/index.php?' + urllib.parse.urlencode({'p':20206,'o':'meta'}) + auth )
         elif service == '':
             if self.centreon_version == 2.7:
                 webbrowser_open(self.monitor_cgi_url + '/main.php?' + urllib.parse.urlencode({'p':20202,'o':'hd', 'host_name':host}) + auth )
             else:
                 webbrowser_open(self.monitor_cgi_url + '/index.php?' + urllib.parse.urlencode({'p':201,'o':'hd', 'host_name':host}) + auth )
         else:
             webbrowser_open(self.monitor_cgi_url + '/index.php?' + urllib.parse.urlencode({'p':202, 'o':'svcd',  'host_name':host, 'service_description':service}) + auth )
     else:
         if host == '_Module_Meta':
             webbrowser_open(self.monitor_cgi_url + '/main.php?' + urllib.parse.urlencode({'p':20206,'o':'meta'}))
         # must be a host if service is empty...
         elif service == '':
             if self.centreon_version == 2.7:
                 webbrowser_open(self.monitor_cgi_url + '/main.php?' + urllib.parse.urlencode({'p':20202,'o':'hd', 'host_name':host}))
             else:
                 webbrowser_open(self.monitor_cgi_url + '/index.php?' + urllib.parse.urlencode({'p':201,'o':'hd', 'host_name':host}))
         else:
             webbrowser_open(self.monitor_cgi_url + '/main.php?' + urllib.parse.urlencode({'p':202, 'o':'svcd',  'host_name':host, 'service_description':service}))
Exemplo n.º 23
0
 def open_monitor(self, host, service):
     webbrowser_open('%s/status/service?host=%s' % (self.monitor_url, host))
Exemplo n.º 24
0
 def open_monitor_webpage(self, host, service):
     webbrowser_open('%s/monitoring/#!?autoSelectHost=%s' %
                     (self.monitor_url, host))
Exemplo n.º 25
0
    def open_monitor(self, host, service=''):
        if self.use_autologin is True:
            auth = '&autologin=1&useralias=' + self.username + '&token=' + self.autologin_key
        else:
            auth = ''

        #  Meta - Centreon < 2.7
        if host == '_Module_Meta' and self.centreon_version < 2.7:
            webbrowser_open(self.urls_centreon['index'] + '?' + urllib.parse.urlencode({'p': 20206, 'o': 'meta'}) + auth )
        #  Meta - Centreon 2.7
        elif host == '_Module_Meta' and self.centreon_version == 2.7:
            webbrowser_open(self.urls_centreon['main'] + '?' + urllib.parse.urlencode({'p':20206, 'o':'meta'}) + auth )
        #  Meta - Centreon 2.8
        elif host == '_Module_Meta' and self.centreon_version == 2.8:
            m =  re.search(r'^.+ \((?P<rsd>.+)\)$', service)
            if m:
                service = m.group('rsd')
                webbrowser_open(self.urls_centreon['main'] + '?' + urllib.parse.urlencode({'p':20201,'o':'svcd','host_name':'_Module_Meta','service_description':service}) + auth )
        # must be a host if service is empty
        elif service == '':
            if self.centreon_version == 2.7 or self.centreon_version == 2.8:
                webbrowser_open(self.urls_centreon['main'] + '?' + urllib.parse.urlencode({'p':20202,'o':'hd', 'host_name':host}) + auth )
            else:
                webbrowser_open(self.urls_centreon['main'] + '?' + urllib.parse.urlencode({'p':201,'o':'hd', 'host_name':host}) + auth )
        # so it's a service
        else:
            if self.centreon_version == 2.7 or self.centreon_version == 2.8:
                webbrowser_open(self.urls_centreon['main'] + '?' + urllib.parse.urlencode({'p':20201,'o':'svcd', 'host_name':host, 'service_description':service}) + auth )
            else:
                webbrowser_open(self.urls_centreon['main'] + '?' + urllib.parse.urlencode({'p':202, 'o':'svcd',  'host_name':host, 'service_description':service}) + auth )