SQL Report Integration

Last modified by Carstein Seeberg on 2021/12/01 14:45

Ceeview offers a comprehensive reporting module generating reports using pdf format.
However, in scenarios where an external reporting tool is required, Ceeview’s report database support makes it possible to access data series using standard SQL queries.

1. Ceeview data series available for external reporting tools

The following types of data series are available for external report tools

Sla

The data series and metrics are available using the view reportSLA.

Service qualifiers

The data series are available using the view reportRegistryService.
The metrics is available in the table DATA_METRIC (METRIC for PostgreSql) and is matched with required data series using a standard join:

  • reportRegistryService.metricId = DATA_METRIC.metricId
Monitor metrics

The data series are available using the view reportRegistryMonitor.
The metrics is available in the table DATA_METRIC (METRIC for PostgreSql) and is matched with required data series using a standard join:

  • reportRegistryMonitor.metricId = DATA_METRIC.metricId
External metrics

The data series are available using the view reportRegistryExternal.
The metrics is available in the table DATA_METRIC (METRIC for PostgreSql) and is matched with required data series using a standard join:

  • reportRegistryExternal.metricId = DATA_METRIC.metricId

The SLA data is also available through the view reportSLAAll extending the view reportSLA with the internal identifiers for attributes like account, service etc.
Correspondingly, there is a view reportRegistryAll providing all service, monitor and external data series, and include the internal identifiers.

The report supporting views are available for Ceeview sites using Sqlserver and PostgreSQL as datastore for metrics.

1.1 SLA data series

The reportSLA view offers the following columns identifying the data series

  • accountName
  • serviceName
  • slaName

and the following columns for each recorded SLA period

  • start_date
    Time for start of period, GMT timestamp based on milliseconds since 1970 (epoch)
  • end_date
    Time for end of period, GMT timestamp based on milliseconds since 1970 (epoch)
  • percentage
    Percentage uptime for the SLA
  • threshold
    Required/promised percentage uptime for the SLA
  • totalTime
    The length of the SLA period in milliseconds (may differ from the base period (day, week or month) due to exclude periods etc.
  • downtime
    The amount of down time in milliseconds for the period.
  • Timezone
    The Timezone for the SLA period, a day SLA with Oslo time zone, ie 00:00, will typically start with a timestamp mapping to 22:00 GMT
  • Tag
    The base period for the SLA; D(ay), W(eek), M(onth)

For week and month there is also a postfix giving number of weeks/month, for instance W:02 for an SLA period of two weeks.

1.2 External data series

The reportRegistryMonitor view offers the following columns

  • accountName
    Name of account the data series belong to
  • agentName
    Name of agent that generates the data series
  • assetName
    Name of asset associated with the data series
  • created
    When the database series was created, GMT epoch timestamp
  • registryIdentifier
    String defined by the external source generating the data series
  • categoryName
    Category of metric
  • instanceName
    The object or instance the data series belongs to, defined by the source generating the data series
  • unitType
    The unit type the data series represents
  • metricType
    The data type of the metrics
  • metricId
    Internal id for the series, maps to the column id in DATA_METRIC (Sqlserver) or METRIC (PostgreSql)

1.3 Monitor data series

The reportRegistryMonitor view offers the following columns

  • accountName
    Name of account the data series belong to
  • agentName
    Name of agent that generates the data series
  • monitorName
    Name of the monitor generating the data series
  • assetName
    Name of asset associated with the data series
  • created
    GMT epoch timestamp representing when data series was created
  • registryIdentifier
    Type of monitor generating the data series, for instance VMWARE
  • categoryName
    Category of metric
  • instanceName
    The object or instance the data series belongs to, for instance CPU, Memory or a specific disk
  • unitType
    The unit type the data series represents
  • metricType
    The data type of the metrics
  • metricId
    Internal id for the series, maps to the column id in DATA_METRIC (Sqlserver) or METRIC (PostgreSql)

1.4 Service data series

The reportRegistryService view offers the following columns

  • accountName
    Name of account the data series belong to
  • agentName
    Name of agent that generates the data series
  • serviceName
    Name of the service the data series belongs to
  • assetName
    Name of asset associated with the data series
  • created
    GMT epoch timestamp representing when data series was created
  • registryIdentifier
    Type of service qualifier generating the data series
  • categoryName
    Category of metric
  • instanceName
    Name of service qualifier generating the data series
  • unitType
    The unit type the data series represents
  • metricType
    The data type of the metrics
  • metricId
    Internal id for the series, maps to the column id in DATA_METRIC (Sqlserver) or METRIC (PostgreSql)

2. Examples

2.1 Show SLA data series

The following query will list all defined SLA for the service ./Network/Connectivity/Ping in account ***Latest***:

select distinct accountName,serviceName,slaName
from reportSLA
where accountName='***Latest***' and serviceName = './Network/Connectivity/Ping'

returning

Ceeview-ReportDatabase-2.14_html_b0555d5430113d3e.png

Note the use of distinct in the query above, it is required since we at this stage are only interested in the distinct SLA’s for the service, not all the SLA periods.

Now if we want to view all SLA periods for the ping(day) SLA we could use the following query

select top 10 *
from reportSLA
where accountName='***Latest***' and serviceName = './Network/Connectivity/Ping' and slaName='ping(day)'
order by start_date desc

returning

Ceeview-ReportDatabase-2.14_html_3fbeec74380f9f5b.png

Note that the start and end date for the periods is GMT epoch timestamps based on milliseconds since 1970, while total and down time is in milliseconds.

2.2 Show monitor metric series

NB! Same method applies to service and external metric series!

The following query will list all monitor metric series collected by monitors with name starting with TheSystem for the asset agentM in account ***Latest*** :

select * from reportRegistryMonitor
where accountName='***Latest***' and monitorName like 'TheSystem%' and assetName='agentM'

and will return some like

Ceeview-ReportDatabase-2.14_html_280995e89a19fe27.png

Ie we only get a list of metric series, not the actual metrics.

Let us say that we are interested in the cpu usage. Cpu usage have categoryName equal to  CPU Usage so the query to list all such series is:

select *
from reportRegistryMonitor
where accountName='***Latest***' and monitorName like 'TheSystem%' and assetName='agentM' and categoryName='CPU Usage'

returning one row

Ceeview-ReportDatabase-2.14_html_e7a6e59a9ca2027d.png

We still have to join against the metric table in order to get the actual metrics, let us request the last 10 CPU usage samples

select top 10 m.time,m.value
from reportRegistryMonitor r, DATA_METRIC m
where r.metricId = m.id and accountName='***Latest***' and monitorName like 'TheSystem%' and assetName='agentM' and categoryName='CPU Usage'
order by time desc

returning

Ceeview-ReportDatabase-2.14_html_dd1c9f32b7139c6a.png

Note that the time for the metrics is GMT epoch timestamps based on milliseconds since 1970.
In order to provide more user-friendly visualization of the time you can use either the database’s datetime formatting functionality or similar functionality in the external reporting tool.

 

..