Esempio n. 1
0
    def setup(self, app, action, **kwargs):
        ''' show the setup page '''

        host_app = cherrypy.request.path_info.split('/')[3]
        user = cherrypy.session['user']['name']

        if not self.is_app_admin(host_app, user):
            raise cherrypy.HTTPRedirect(
                self._redirect(host_app, app, 'unauthorized'))

        mon = MonitorInput.all()
        mon = mon.filter_by_app(app)

        cannon = EventLogCannon.all()
        cannon = cannon.order_by('importance', sort_dir='asc')

        win = WinEventLogInput.all()
        win = win.search('name=localhost')

        system = (sys.platform.startswith("win"))
        optimize = bool(self.get_distsearch(host_app))

        return self.render_template(
            '/%s:/templates/setup_show.html' % host_app,
            dict(system=system,
                 mon=mon,
                 win=win,
                 cannon=cannon,
                 optimize=optimize,
                 app=app))
    def setup(self, app, action, **kwargs):
        ''' show the setup page '''

        host_app = cherrypy.request.path_info.split('/')[3]
        user = cherrypy.session['user']['name'] 
        
        if not self.is_app_admin(host_app, user):
            raise cherrypy.HTTPRedirect(self._redirect(host_app, app, 'unauthorized'))

        mon = MonitorInput.all()
        mon = mon.filter_by_app(app)

        cannon = EventLogCannon.all()
        cannon = cannon.order_by('importance', sort_dir='asc')

        win = WinEventLogInput.all()
        win = win.search('name=localhost')

        system = (sys.platform.startswith("win"))
        optimize = bool(self.get_distsearch(host_app))

        return self.render_template('/%s:/templates/setup_show.html' % host_app, 
                                    dict(system=system, mon=mon, win=win, cannon=cannon, optimize=optimize, app=app))
Esempio n. 3
0
        if evt_logs:

            win.logs = evt_logs

            if normBool(win.disabled):
                win.enable()
            try:
                win.edit()
            except Exception, ex:
                logger.exception(ex)
                raise cherrypy.HTTPRedirect(
                    self._redirect(host_app, app, 'failure'))
        else:
            win.disable()

        mon = MonitorInput.all()
        mon = mon.filter_by_app(app)

        for m in mon:
            disabled = normBool(params.get(m.name + '.disabled'))
            if disabled:
                m.disable()
            else:
                m.enable()
            m.share_global()

        self.update_distsearch(host_app,
                               normBool(params.get('optimize_dist_search')))

        logger.debug('Splunk Version = %s' % self._get_version())
        if self._get_version() <= LooseVersion('4.2.2'):
	if evt_logs:

            win.logs = evt_logs 

	    if normBool(win.disabled):
                win.enable()
	    try:
	        win.edit()
            except Exception, ex:
                logger.exception(ex)
	        raise cherrypy.HTTPRedirect(self._redirect(host_app, app, 'failure'))
	else:
            win.disable()

        mon = MonitorInput.all()
        mon = mon.filter_by_app(app)
  
        for m in mon:
            disabled = normBool(params.get(m.name + '.disabled'))
            if disabled:
                m.disable()
            else:
                m.enable()
            m.share_global()

        self.update_distsearch(host_app, normBool(params.get('optimize_dist_search')))

        logger.debug('Splunk Version = %s' % self._get_version())
        if self._get_version() <= LooseVersion('4.2.2'):
            temp_app = bundle.getConf('app', namespace=host_app, owner='nobody')