Ejemplo n.º 1
0
from rvbd_portal_profiler.datasources.profiler import GroupByTable
from rvbd_portal_sharepoint.datasources.sharepoint import (SharepointTable,
                                                           create_sharepoint_column)


logger = logging.getLogger(__name__)

#
# HTML Example Report
#

report = Report(title="Landing Page Example", position=1, hide_criteria=True,
                reload_minutes=5)
report.save()

section = Section.create(report, title='Raw HTML')


# Define an image
imgurl = 'http://radar.weather.gov/Conus/Loop/NatLoop_Small.gif'
html = '<img src="%s" alt="Doppler Radar National Mosaic Loop">' % imgurl

table = StaticHTMLTable.create('Weather Image', html)
raw.TableWidget.create(section, table, 'weather image', width=6)


# Define an html table of links
# As an example of how the module loading works, this table
# may end up being shorter than the actual total number of reports
# because at the time this is calculated, all the remaining reports
# may not yet be in the database.
#   https://github.com/riverbed/flyscript-portal/blob/master/LICENSE ("License").
# This software is distributed "AS IS" as set forth in the License.

from rvbd_portal.apps.datasource.models import Column
from rvbd_portal.apps.report.models import Report, Section
import rvbd_portal.apps.report.modules.yui3 as yui3

from rvbd_portal_sharepoint.datasources.sharepoint import (SharepointTable,
                                                           create_sharepoint_column)
#
# Profiler report
#

report = Report(title="Sharepoint", position=2)
report.save()

section = Section.create(report)


# Define a Sharepoint Table
table = SharepointTable.create('sp-documents', '/', 'Shared Documents')

create_sharepoint_column(table, 'BaseName', issortcol=True)
create_sharepoint_column(table, 'Created', datatype='time')
create_sharepoint_column(table, 'Modified', datatype='time')
create_sharepoint_column(table, 'ID')
create_sharepoint_column(table, 'EncodedAbsUrl')

yui3.TableWidget.create(section, table, "Sharepoint Documents List",
                        height=300, width=12)
from rvbd_portal.apps.datasource.models import TableField, Column

from rvbd_portal.apps.report.models import Report, Section
from rvbd_portal.apps.report.modules import raw

from rvbd_portal.apps.report.tests.reports import criteria_functions as funcs

report = Report(title='Criteria Defaults')
report.save()

# Report-level criteria
TableField.create(keyword='report-1', label='Report 1', obj=report, initial='r1')
TableField.create(keyword='report-2', label='Report 2', obj=report, required=True)

# Section 
section = Section(report=report, title='Section 0')
section.save()

# Section-level criteria
TableField.create(keyword='section-1', label='Section 1', obj=section, initial='s1')
TableField.create(keyword='section-2', label='Section 2', obj=section, required=True, initial='s2')

# Table
table = AnalysisTable.create('test-criteria-postprocess', tables={}, 
                             func = funcs.analysis_echo_criteria)

# Table-level criteria
TableField.create(keyword='table-1', label='Table 1', obj=table, initial='t1')
TableField.create(keyword='table-2', label='Table 2', obj=table, initial='t2')

Ejemplo n.º 4
0
from rvbd_portal.apps.datasource.modules.analysis import AnalysisTable
from rvbd_portal.apps.datasource.models import TableField, Column
from rvbd_portal.libs.fields import Function

from rvbd_portal.apps.report.models import Report, Section
from rvbd_portal.apps.report.modules import raw

from rvbd_portal.apps.report.tests.reports import criteria_functions as funcs

report = Report(title='Criteria Shared Fields')
report.save()

section = Section(report=report, title='Section')
section.save()

x = TableField.create('x', 'X Value')
for i in range(2):

    table = AnalysisTable.create('test-criteria-sharedfields-%d' % i,
                                 tables={},
                                 func=funcs.analysis_echo_criteria)
    Column.create(table, 'key', 'Key', iskey=True, isnumeric=False)
    Column.create(table, 'value', 'Value', isnumeric=False)

    table.fields.add(x)
    y = TableField.create('y',
                          'Y Value',
                          table,
                          hidden=True,
                          parent_keywords=['x'],
                          post_process_func=Function(
Ejemplo n.º 5
0
from rvbd_portal_profiler.datasources import profiler
from rvbd_portal_profiler.datasources.profiler import (GroupByTable,
                                                       TimeSeriesTable)

report = Report(title="QoS Report", position=15)
report.save()

interface_field = TableField.create(keyword='interface',
                                    label='Interface',
                                    required=True)
datafilter_field = TableField.create(
    keyword='datafilter',
    hidden=True,
    post_process_template='interfaces_a,{interface}')

section = Section.create(report, title="Overall")

# Define a Overall TimeSeries showing In/Out Utilization
table = TimeSeriesTable.create('qos-overall-util',
                               duration=15,
                               resolution=60,
                               interface=True)
table.fields.add(interface_field)
table.fields.add(datafilter_field)

Column.create(table, 'time', 'Time', datatype='time', iskey=True)
Column.create(table,
              'in_avg_util',
              'Avg Inbound Util %',
              datatype='bytes',
              units='B/s')
Ejemplo n.º 6
0
from rvbd_portal.apps.report.models import Report, Section
import rvbd_portal.apps.report.modules.yui3 as yui3
from rvbd_portal_profiler.datasources.profiler import GroupByTable
from rvbd_portal.apps.datasource.modules.analysis import AnalysisTable

# helper libraries
from rvbd_portal.apps.plugins.builtin.whois.libs.whois import whois

#
# Profiler report
#

report = Report(title="Whois", position=5)
report.save()

section = Section.create(report)

# Define a Table that gets external hosts by avg bytes
table = GroupByTable.create('5-hosts', 'host', duration='1 hour',
                            filterexpr='not srv host 10/8 and not srv host 192.168/16')

Column.create(table, 'host_ip', 'IP Addr', iskey=True)
Column.create(table, 'avg_bytes', 'Avg Bytes', units='s', issortcol=True)


# Create an Analysis table that calls the 'whois' function to craete a link to 'whois'
whoistable = AnalysisTable.create('5-whois-hosts',
                                  tables={'t': table.id},
                                  func=whois)

Column.create(whoistable, 'host_ip', label="IP Addr", iskey=True)
from rvbd_portal.apps.datasource.forms import fields_add_time_selection
from rvbd_portal.apps.datasource.modules.analysis import AnalysisTable
from rvbd_portal.apps.datasource.models import TableField, Table, Column
from rvbd_portal.libs.fields import Function

from rvbd_portal.apps.report.models import Report, Section
from rvbd_portal.apps.report.modules import raw

from . import criteria_functions as funcs

report = Report(title='Criteria Changing with Sections',
                field_order =['first', 'second'])
report.save()

section = Section.create(report=report, title='Section 0', section_keywords=['first','second'])
section.save()

table = AnalysisTable.create('test-criteria-changingchoiceswithsections-0', tables={}, 
                             func = funcs.analysis_echo_criteria)
TableField.create ('first', 'First Choice', table,
                   field_cls = forms.ChoiceField,
                   field_kwargs = {'choices': (('a', 'Option A'),
                                               ('b', 'Option B') ) })

TableField.create ('second', 'Second Choice', table,
                   field_cls = forms.ChoiceField,
                   pre_process_func =
                   Function(funcs.preprocess_changesecond),
                   dynamic=True)
from rvbd_portal.apps.datasource.forms import fields_add_time_selection
from rvbd_portal.apps.datasource.modules.analysis import AnalysisTable
from rvbd_portal.apps.datasource.models import TableField, Table, Column
from rvbd_portal.libs.fields import Function

from rvbd_portal.apps.report.models import Report, Section
from rvbd_portal.apps.report.modules import raw

from . import criteria_functions as funcs

report = Report(title='Criteria Section Keywords')
report.save()


# Section 
section = Section.create(report=report, title='Section 0', section_keywords=['k1'])
section.save()

# Table
table = AnalysisTable.create('test-criteria-sectionkeywords-1', tables={}, 
                             func = funcs.analysis_echo_criteria)
TableField.create(keyword='k1', label='Key 1', obj=table, initial='r1')

Column.create(table, 'key', 'Key', iskey=True, isnumeric=False)
Column.create(table, 'value', 'Value', isnumeric=False)

raw.TableWidget.create(section, table, 'Table 1')

# Section 
section = Section.create(report=report, title='Section 1', section_keywords=['k1'])
section.save()
Ejemplo n.º 9
0
from django.core.urlresolvers import reverse

from rvbd_portal.apps.datasource.modules.html import StaticHTMLTable
from rvbd_portal.apps.report.models import Report, Section
import rvbd_portal.apps.report.modules.raw as raw

logger = logging.getLogger(__name__)

#
# HTML Example Report
#

report = Report(title="HTML Example", position=1)
report.save()

section = Section.create(report, title='Raw HTML')

# Define an image
imgurl = 'http://radar.weather.gov/Conus/Loop/NatLoop_Small.gif'
html = '<img src="%s" alt="Doppler Radar National Mosaic Loop">' % imgurl

table = StaticHTMLTable.create('Weather Image', html)
raw.TableWidget.create(section, table, 'weather image')

# Define an html table of links
# As an example of how the module loading works, this table
# may end up being shorter than the actual total number of reports
# because at the time this is calculated, all the remaining reports
# may not yet be in the database.
lines = []
reports = Report.objects.all().order_by('position')
Ejemplo n.º 10
0
import rvbd_portal.apps.report.modules.yui3 as yui3
import rvbd_portal.apps.report.modules.maps as maps

from rvbd_portal_profiler.datasources.profiler import GroupByTable, TimeSeriesTable
from rvbd_portal_shark.datasources.shark import SharkTable, create_shark_column

#
# Overall report
#

report = Report(title="Overall", position=1,
                field_order=['endtime', 'profiler_filterexpr', 'shark_filterexpr'],
                hidden_fields=['resolution', 'duration'])
report.save()

section = Section.create(report, title='Locations',
                         section_keywords=['resolution', 'duration'])
                         
# Define a map and table, group by location
table = GroupByTable.create('maploc', 'host_group', duration=60, resolution='auto')

Column.create(table, 'group_name',    label='Group Name', iskey=True)
Column.create(table, 'response_time', label='Resp Time',  datatype='metric')
Column.create(table, 'network_rtt',   label='Net RTT',    datatype='metric')
Column.create(table, 'server_delay',  label='Srv Delay',  datatype='metric')

maps.MapWidget.create(section, table, "Response Time", width=6, height=300)
yui3.TableWidget.create(section, table, "Locations by Avg Bytes", width=6)

# Define a Overall TimeSeries showing Avg Bytes/s
section = Section.create(report, title='Profiler Overall',
                         section_keywords=['resolution', 'duration'])
from rvbd_portal.apps.datasource.forms import fields_add_time_selection
from rvbd_portal.apps.datasource.modules.analysis import AnalysisTable
from rvbd_portal.apps.datasource.models import TableField, Table, Column
from rvbd_portal.libs.fields import Function

from rvbd_portal.apps.report.models import Report, Section
from rvbd_portal.apps.report.modules import raw

from . import criteria_functions as funcs

report = Report(title='Criteria Changing with Sections',
                field_order=['first', 'second'])
report.save()

section = Section.create(report=report,
                         title='Section 0',
                         section_keywords=['first', 'second'])
section.save()

table = AnalysisTable.create('test-criteria-changingchoiceswithsections-0',
                             tables={},
                             func=funcs.analysis_echo_criteria)
TableField.create(
    'first',
    'First Choice',
    table,
    field_cls=forms.ChoiceField,
    field_kwargs={'choices': (('a', 'Option A'), ('b', 'Option B'))})

TableField.create('second',
                  'Second Choice',
Ejemplo n.º 12
0
from rvbd_portal.apps.datasource.models import Column, TableField
from rvbd_portal.apps.report.models import Report, Section
import rvbd_portal.apps.report.modules.yui3 as yui3

from rvbd_portal_profiler.datasources import profiler
from rvbd_portal_profiler.datasources.profiler import (GroupByTable,
                                                       TimeSeriesTable)

report = Report(title="QoS Report", position=15)
report.save()

interface_field = TableField.create(keyword='interface', label='Interface', required=True)
datafilter_field = TableField.create(keyword='datafilter', hidden=True,
                                     post_process_template='interfaces_a,{interface}')

section = Section.create(report, title="Overall")

# Define a Overall TimeSeries showing In/Out Utilization
table = TimeSeriesTable.create('qos-overall-util', 
                               duration=15, resolution=60,
                               interface=True)
table.fields.add(interface_field)
table.fields.add(datafilter_field)

Column.create(table, 'time', 'Time', datatype='time', iskey=True)
Column.create(table, 'in_avg_util', 'Avg Inbound Util %', datatype='bytes', units='B/s')
Column.create(table, 'out_avg_util', 'Avg Outbound Util %', datatype='bytes', units='B/s')

yui3.TimeSeriesWidget.create(section, table, "Overall Utilization", width=12)

# Define a Overall TimeSeries showing In/Out Totals
Ejemplo n.º 13
0
from rvbd_portal.apps.datasource.forms import fields_add_time_selection
from rvbd_portal.apps.datasource.modules.analysis import AnalysisTable
from rvbd_portal.apps.datasource.models import TableField, Table, Column
from rvbd_portal.libs.fields import Function

from rvbd_portal.apps.report.models import Report, Section
from rvbd_portal.apps.report.modules import raw

from . import criteria_functions as funcs

report = Report(title='Criteria Section Keywords')
report.save()

# Section
section = Section.create(report=report,
                         title='Section 0',
                         section_keywords=['k1'])
section.save()

# Table
table = AnalysisTable.create('test-criteria-sectionkeywords-1',
                             tables={},
                             func=funcs.analysis_echo_criteria)
TableField.create(keyword='k1', label='Key 1', obj=table, initial='r1')

Column.create(table, 'key', 'Key', iskey=True, isnumeric=False)
Column.create(table, 'value', 'Value', isnumeric=False)

raw.TableWidget.create(section, table, 'Table 1')

# Section
from django import forms

from rvbd_portal.apps.datasource.forms import fields_add_time_selection
from rvbd_portal.apps.datasource.modules.analysis import AnalysisTable
from rvbd_portal.apps.datasource.models import TableField, Table, Column
from rvbd_portal.libs.fields import Function

from rvbd_portal.apps.report.models import Report, Section
from rvbd_portal.apps.report.modules import raw

from . import criteria_functions as funcs

report = Report(title='Criteria Two Reports - 2')
report.save()

TableField.create(keyword='k2', label='Key 2', obj=report, initial='r2')

# Section
section = Section.create(report=report, title='Section')
section.save()

# Table
table = AnalysisTable.create('test-criteria-tworeports-2', tables={},
                             func = funcs.analysis_echo_criteria)
TableField.create(keyword='k1', label='Key 1', obj=table, initial='r1')

Column.create(table, 'key', 'Key', iskey=True, isnumeric=False)
Column.create(table, 'value', 'Value', isnumeric=False)

raw.TableWidget.create(section, table, 'Table 2')
Ejemplo n.º 15
0
from rvbd_portal.apps.datasource.forms import fields_add_time_selection
from rvbd_portal.apps.datasource.modules.analysis import AnalysisTable
from rvbd_portal.apps.datasource.models import TableField, Table, Column
from rvbd_portal.libs.fields import Function

from rvbd_portal.apps.report.models import Report, Section
from rvbd_portal.apps.report.modules import raw

from . import criteria_functions as funcs

report = Report(title='Criteria Two Reports - 2')
report.save()

TableField.create(keyword='k2', label='Key 2', obj=report, initial='r2')

# Section
section = Section.create(report=report, title='Section')
section.save()

# Table
table = AnalysisTable.create('test-criteria-tworeports-2',
                             tables={},
                             func=funcs.analysis_echo_criteria)
TableField.create(keyword='k1', label='Key 1', obj=table, initial='r1')

Column.create(table, 'key', 'Key', iskey=True, isnumeric=False)
Column.create(table, 'value', 'Value', isnumeric=False)

raw.TableWidget.create(section, table, 'Table 2')