|
|
You can make direct queries to the data tables of the TrafficDirector application and view statistical information in an ad hoc report format. An ad hoc report is an impromptu report that you create for the specific variables you select. The ability to create your own ad hoc reports is a feature that complements the structured, instant reports available in the TrafficDirector application by letting you choose what is reported and how the information is sorted. You can use wildcard characters in some fields to construct a query. When you query the database, the result is an ad hoc report.
The following sections contain more information about querying the report database:
The TrafficDirector application uses a single database---NSTREND_DB. It contains all of the tables related to the TrafficDirector application. This database contains different tables that provide a wide range of useful statistical information. For example, the many different statistics that SwitchProbe devices collect for reporting are:
After you decide which type of statistics you want to view, you can select the level of detail you want reflected as the result of your query---either detail or daily-level.
These two types of data tables for each of the statistic categories are described as follows:
On a Windows NT system using the Microsoft SQL Server, you will use the administrative tools provided with the Microsoft SQL Server client and server software to perform SQL ad hoc queries to the NSTREND_DB. Using the ISQL\w tool provided with the SQL client software, you can print ad hoc reports or save them to a file.
See the Microsoft SQL Server Administrator's Companion manual for more information about using ISQL\w.
On a Windows NT system using the embedded SQL server, you will use msql to run customized reports using SQL queries.
To generate ad hoc reports, you first must run the msql utility. After doing so, you can use standard SQL queries to specify certain reports.
To run msql, follow these steps:
Step 1 Go to the DOS command line.
Step 2 Enter the following command:
$NSHOME/bin/msql NSTREND_DB
If you are using the TrafficDirector application for logging on remote hosts, you can query the remote server daemon using the following command (where remote01 is the name of a remote host):
$NSHOME/bin/msql -h remote01 NSTREND_DB
See "Generating Ad Hoc Reports" for more information about performing queries and generating customized reports.
On UNIX platforms, you use the msql program to run customized reports using SQL queries. Before you begin using msql, it is important that you set up several UNIX environment variables.
For more information, see the following sections:
The server daemon---msqld---and the tools that access this daemon, use specific environment variables that are set using the same script file (the file that the installation script creates during installation). The script file is also used to set other environment variables, including NSHOME and HHHOME.
Table 32-1 describes the variables you must set for Trend Reporter/SQL queries to work correctly.
| Use This Variable... | To Perform This Function |
|---|---|
MSQL_TCP_PORT | TCP port number used for remote TCP connections. The msqld daemon must be able to open this port to support remote connections from other hosts. |
MSQL_HOME | Base directory for msql files. The $MSQL_HOME directory contains the msql.acl file and the subdirectory msqldb, which contains the NSTREND_DB database. |
MSQL_UNIX_PORT | UNIX socket used for local connections between the msqld daemon and client processes. |
To generate ad hoc reports on UNIX platforms, you first must run the msql utility. After doing so, you can use standard SQL queries to specify certain reports.
To run the msql utility, follow these steps:
Step 1 Go to the command line.
Step 2 Enter the following command:
$NSHOME/bin/msql NSTREND_DB
If you are using the TrafficDirector application for logging on remote hosts, you can query the remote server daemon using the following command (where remote01 is the name of a remote host):
$NSHOME/bin/msql -h remote01 NSTREND_DB
When you need to perform maintenance on the database, you must first enter the following command:
$NSHOME/bin/msqladmin
After you have started the msql program, you can use any of the following commands that apply to your situation:
![]() | Caution Cisco Systems recommends that you use only the shutdown, reload, and version commands. Information is provided here about the additional commands, but it is strongly recommended that you do not create a new database on the server containing the Trend Reporter database, or that you delete the Trend Reporter database. |
create NSTREND_DB
Depending on your platform (UNIX or Microsoft Windows), the tools you use to perform queries, to print, and to save your ad hoc reports are different. These tools are:
On UNIX platforms, SQL commands are always preceded by a backslash (\). Use the commands in the following list to process the SQL queries you construct, or to get help:
Before you use SQL queries with Trend Reporter, you must familiarize yourself with SQL syntax and usage.
The following sample query is one you might use to display intervals for the Ethernet SwitchProbe device, et105 where utilization exceeds 10%:
select Agent, Domain, StartTimeText, Utilization from segetdt_970410 where Agent = `et105' and Utilization > 10 order by Agent, Domain, StartTimeText\g
In the sample query, the following is applicable:
segetdt is the name of the table type, and yymmdd the two-digit year, month, and day that you specify.
The different names for the Detail tables on UNIX and Microsoft Windows platforms are described in Table 32-2.
| UNIX Table Name | Microsoft Windows Table Name |
|---|---|
protocoldt_yymmdd | protocol_detail |
segetdt_yymmdd | seg_et_detail |
segwandt_yymmdd | seg_wan_detail |
segfddidt_yymmdd | seg_fddi_detail |
segtrdt_yymmdd | seg_tr_detail |
hostdt_yymmdd | host_detail |
convdt_yymmdd | conv_detail |
ippingdt_yymmdd | ipping_detail |
artdt_yymmdd | art_detail |
artsummdt_yymmdd | artsumm_detail |
snmpgetdt_yymmdd | snmp_get_detail |
nltopncdt_yymmdd | nltopnc_detail |
altopncdt_yymmdd | altopnc_detail |
In the UNIX table names, yymmdd is the two-digit year, month, and day that the table was generated. On UNIX platforms, new detail tables are created for each 24-hour interval.
The msql program lets you use wildcards to specify agent or domain names in a query. You can use wildcards at the beginning, middle, or end of a name.
The valid wildcards you can use are:
When you use wildcards, remember to use the command like instead of the equals sign (=).
The following example shows a query you might use to discover which agents are logging utilization at greater than 65%:
select Agent, Domain, StartTimeText, Utilization from segetdt_970410 where Agent like `et%' and
Utilization > 65 order by Utilization, Agent, Domain, StartTimeText\g
The following list shows sample queries that run certain reports. These examples let you know how you might structure and run your own ad hoc queries:
select distinct Agent, Domain from protocol_summary order by Agent, Domain\g
select Agent, Domain, StartTimeText, Utilization from segwandt_yymmdd where Agent like `ny%' and Utilization > 60 order by Agent, Domain, StartTimeText\g
Examples of detailed table queries (for UNIX platforms) are as follows:
select Agent, Domain, SrcAddress, DstAddress, StartTimeText, EndTimeText, EndTime, Pkts, Octets, Utilization from convdt_yymmdd order by Agent, Domain, EndTime, SrcAddress, DstAddress\g
select Agent, Domain, StartTimeText, EndTimeText, Pkts, Octets, Utilization, StartTime from segfddidt_yymmdd order by Agent, Domain, StartTime\g
select Agent, Domain, StartTimeText, EndTimeText, Pkts, Octets, Utilization, StartTime from segetdt_yymmdd order by Agent, Domain, StartTime\g
select Agent, Domain, Address, StartTimeText, EndTimeText, EndTime, InPkts, OutPkts from hostdt_yymmdd order by Agent, Domain, EndTime, Address\g select Agent, Domain, Address, StartTimeText, EndTimeText, EndTime, InPkts, OutPkts from hostdt_yymmdd where Agent = 'et105' and
Domain = 'RMON' and Address = '00-80-8c-01-04-52' and StartTimeText like 'Mar 9%' order by Agent, Domain, EndTime, Address\g
select Address, StartTimeText, EndTimeText, EndTime, InPkts, OutPkts, InUtilization, OutUtilization
from hostdt_yymmdd where Address = '7e-f1-cc-f0-8f-07' order by EndTime, Address\g
select Agent, Domain, StartTimeText, EndTimeText, Pkts, Octets, Utilization, StartTime from protocoldt_yymmdd order by Agent, Domain, StartTime\g
select Agent, Domain, StartTimeText, EndTimeText, Pkts, Octets, Utilization, StartTime from segtrdt_yymmdd order by Agent, Domain, StartTime\g
Examples of detailed table queries (for Windows platforms) are as follows:
select Agent, Domain, SrcAddress, DstAddress, StartTimeText, EndTimeText, EndTime, Pkts, Octets, Utilization from conv_detail
where SrcAddress = '7e-f1-cc-f0-8f-07' or DstAddress = '7e-f1-cc-f0-8f-07' order by Agent, Domain, EndTime, SrcAddress, DstAddress\g
select Agent, Domain, StartTimeText, EndTimeText, Pkts, Octets, Utilization, StartTime from seg_wan_detail order by Agent, Domain, StartTime\g
select Address, StartTimeText, EndTimeText, EndTime, InPkts, OutPkts, InUtilization, OutUtilization
from host_detail where Address = '7e-f1-cc-f0-8f-07' order by EndTime, Address\g select Agent, Domain, StartTimeText, EndTimeText, Pkts, Octets, Utilization, StartTime from protocol_detail order by Agent, Domain, StartTime\g
select Agent, Domain, StartTimeText, EndTimeText, Pkts, Octets, Utilization, StartTime from seg_tr_detail order by Agent, Domain, StartTime\g
Additional examples of detailed table queries (for both UNIX and Windows platforms) are as follows:
select Agent, Domain, SrcAddress, DstAddress, StartTimeText, EndTimeText, EndTime, Pkts, Octets, Utilization from conv_summary order by Agent, Domain, EndTime, SrcAddress, DstAddress\g select Agent, Domain, StartTimeText, EndTimeText, Pkts, Octets, Utilization, StartTime from seg_et_summary order by Agent, Domain, StartTime\g select Agent, Domain, StartTimeText, EndTimeText, Pkts, Octets, Utilization, StartTime from seg_fddi_summary order by Agent, Domain, StartTime\g select Agent, Domain, Address, StartTimeText, EndTimeText, EndTime, InPkts, OutPkts from host_summary order by Agent, Domain, EndTime, Address\g
select DISTINCT Agent, Domain, StartTimeText, EndTimeText, Pkts, Octets, Utilization, NetType, IfSpeed, StartTime
from protocol_summary order by Agent, Domain, StartTime\g
select Agent, Domain, StartTimeText, EndTimeText, Pkts, Octets, Utilization, StartTime from seg_tr_summary order by Agent, Domain, StartTime\g
select Agent, Domain, StartTimeText, EndTimeText, Pkts, Octets, Utilization, StartTime from seg_wan_summary order by Agent, Domain, StartTime\g
You can store queries in a text file and direct the output to a text file, as the following example shows (where query-high-util is the name of the query file, and high-util-list is the name of the resulting output text file):
msql NSTREND_DB < query-high-util > high-util-list
Use the following guidelines to print any report generated on an ad hoc basis using SQL queries. Depending on what you want to print, and where you want to print it, you can use the following examples:
To print a report on your management console screen, use the following syntax:
msql NSTREND_DB < textfilename
where textfilename is the text file you have created that contains one or more SQL queries. Doing so prints query output on the management console screen.
To print the report to a file, use the following syntax:
msql NSTREND_DB < textfilename > filename
where textfilename is the text file you have created that contains one or more SQL queries. Doing so prints the output to the filename you specify.
To print the report directly to a printer, use the following syntax:
msql NSTREND_DB < textfilename | lpr
where textfilename is the text file you have created that contains one or more SQL queries. Doing so pipes the output ( | ) to the print spooler (lpr), which prints it to the default printer. To specify a different printer, you would also need to specify -Pprintername after the lpr command.
To send the report as an e-mail message, use the following syntax:
msql NSTREND_DB < textfilename | mail emailaddress
where textfilename is the text file you have created that contains one or more SQL queries. Doing so sends the output, as an email, to the emailaddress you specify.
![]()
![]()
![]()
![]()
![]()
![]()
![]()
Posted: Mon Apr 5 13:26:38 PDT 1999
Copyright 1989-1999©Cisco Systems Inc.