OpenView and NetView Appendix 3: OVW-Specific Tips for Reporting

Table Of ContentsIT Service Vision Help


Subsetting by Using a Format in Local or Global Where

If you have too many values of interest to fit in a WHERE expression or if a variable needs some sort of transformation (for example, a table lookup) before you can construct a WHERE expression, you may want to use a user-written format.

In a simple WHERE expression (see Subsetting by a Simple Local Query Expression in Open Systems Appendix 2: Tips for Reports or see Subsetting by a Simple Global Query Expression in Open Systems Appendix 2: Tips for Reports), you may want to construct an expression using the contains operator. For instance,

variable-name ? 'value'

where ? means contains. You can use the contains operator only if variable-name is of IT Service Vision interpretation type STRING.

However, with a format some IT Service Vision numeric variables can be transformed into more meaningful string values, and you can subset based on the transformed values.

For example, you can subset on the machines that provide a specific service, such as IP gateway service. In HP-OV table HN2NIX, the service is described in the SYSSERV variable. Because the SYSSERV variable is numeric, you cannot use a WHERE expression like this:

SYSSERV ? 'IPGATEWAY'

However, if you convert the value of the SYSSERV variable to a string by using the SYSSERV format supplied in IT Service Vision, you can test on the converted value of SYSSERV. In that case, you can use a WHERE expression like this:

put(sysserv,sysserv.) ? 'IPGATEWAY'

where the put function causes the original value of the SYSSERV variable to be replaced by the value produced by the application of the SYSSERV format.

Finding an IT Service Vision Supplied Format

To find the IT Service Vision supplied format, if any, for converting a numeric metric to a character string, follow this path from the IT Service Vision main window:

Administration -> Manage Tables ->
select your table -> click right mouse button ->
Properties -> Variables ->
select your variable -> click right mouse button-> Properties -> Advanced

where the variable is the variable for which you want to find a format and the table is the table in which that variable resides. The Format field displays the supplied format, if any.

Creating a User-Written Format

Explanations that are associated with supplied report definitions sometimes refer you to IT Service Vision supplied example programs for building user-written formats. You can submit the example programs as-is in the PROGRAM EDITOR window, or modify them, or write format-generating programs from scratch.

The csgfmt2 example program is an example of a user-written format that provides the same capability of testing for a string, but the user format is based on the value of MACHINE rather than SYSSERV (and thus can be used on tables that do not contain the SYSSERV variable). The csgfmt2 program generates a format named $USVCS, which translates the MACHINE value to a string. This must be a user-written format because it uses the values of MACHINE at your site as read from your DETAIL.HN2NIX view.

To create the $USVCS format:

  1. Make the SAS PROGRAM EDITOR window the active window.
  2. Issue this command
    include !sasroot/misc/cpe/csgfmt2

    SAS displays the program in the body of the PROGRAM EDITOR window.

    The program has a comment that describes the PDB table and level on which it runs to create the format. In this case, the program is designed to run on SNMP MIB-II data in the DETAIL.HN2NIX table.

  3. To modify the program so that the format is saved in SITELIB.CPFMTS and, thus, is available to any IT Service Vision user at your site, in the program portion of csgfmt2, edit this line:
    if _n_=1 then put "PROC FORMAT;" /

    to be

    if _n_=1 then put "PROC FORMAT library=sitelib.cpfmts;" /

    Note: If you do not save the format in SITELIB, the format lasts only as long as your current SAS session. To be able to save the format in SITELIB, prior to submitting this program you must invoke the IT Service Vision server with SITEACC=WRITE.

    Note: You may want to keep the FORMAT procedure code as part of your daily job so that it is easy to remember how to update the $USVCS format.

  4. To build the format, select Locals -> Submit.
  5. To use this format, in the Local Where expression or Global Where expression (see above), you can construct a WHERE expression like this:
put(machine,$USVCS.) ? 'IPGATEWAY'

Note: You may find it helpful to look at other IT Service Vision supplied examples for building formats in other ways. For instance, the csgfmt1 example program builds a format $UMACHTY that contains a user-supplied list of key machines. To use this format, you can construct a WHERE expression like this:

put(machine,$UMACHTY.) = 'SERVER';

Because this format uses a user-supplied list rather than an automatic list, you need to edit the program and rebuild the format if the list of key machines in your network changes.

Note: You may want to keep the FORMAT procedure code as part of your daily job so that it is easy to remember how to update the $USVCS format.

Note: For more information on the example programs and their formats, see the comments in the programs. For more information on user-written formats in general, see "The FORMAT Procedure" in the SAS Procedures Guide in the documentation for your current version of SAS.

Using One or More Formula Variables

Formula variables are variables whose values are calculated (from the values of other variables) when you access the data. The values of the formula variables do not occupy disk space in the PDB.

You can add formula variables to PDB tables by using the the IT Service Vision server's interactive interface or by using the IT Service Vision %CPDDUTL macro. It is generally preferable to use the %CPDDUTL macro for your production PDB because the macro documents what you did exactly and enables you to add the variables to many tables easily and accurately.

For information on adding a formula variable using %CPDDUTL, see the Macro Reference documentation for IT Service Vision.

Note: The appropriate table to add the formula variable to is the table that contains the variables on which the formula variable is based. In addition to making the Kept status of the formula variable Yes, remember to check that the variables on which the formula variable is based also have Kept status set to Yes.

Adding a Formula Variable By Using the %CPDDUTL Macro

IT Service Vision supplies a example program for using the %CPDDUTL macro to define formula variables. To view and optionally run it, follow these steps when IT Service Vision is running:

  1. Make the PROGRAM EDITOR window the active window.
  2. Issue this command:
    include !sasroot/misc/cpe/csgfvar1

    SAS displays the program in the body of the PROGRAM EDITOR window.

    The program has a comment that describes the PDB table and level on which the program runs to create the formula. In this case, the program is designed to add formula variables to the HP-OV MIB-II tables HN2IFT and HN2NIX. UWEEK (a name chosen to be unique in this table and starting with U for user-defined formula) is defined to be the date of the Sunday preceding the DATETIME value. UDAY (a name similarly chosen) is defined to be the numeric day of the week (where 1=Sunday).

    You can edit those formulas if you want to construct the values in a different way. For more about the construction of formula variables, follow this path from the main menu:

    Administration -> Manage Tables -> select any table -> click right mouse button -> List Variables -> Tools -> Create Formula -> type TEST -> OK

    IT Service Vision displays the Make/Edit Formula window. Select Help for information about formula variables and the source statements that define their formulas.

    Note: You may find UWEEK and UDAY useful in other PDB tables; the other formula variables are rather specific to the specified tables.

    Note: Formula variables do not have selectable statistics. If you want statistics on a formula variable, you must define the statistics as formula variables at the desired non-detail levels.

  3. Submit the program by selecting Locals -> Submit.

  4. To examine the effect of defining the formula variable, follow this path from the main menu:

    Administration -> Examine PDB Data -> Levels: All -> select a table/level combination that you want to check-> click right mouse button -> View Data

    You can use the scroll bars the UDAY and UWEEK values for each observation (if you have data).

    Note: You can also use the Report Style PRINT in the GUI to view the data.

Note: For more information about the example programs, see the comments in the programs. For more information about the %CPDDUTL macro, see the Macro Reference documentation for IT Service Vision.

Adding a Formula Variable By Using the Interactive Interface

The formula variables UDAY and UWEEK can be useful when reporting on data in your PDB. To create them if they do not already exist:

  1. Follow this path from the main menu:

    Administration -> Manage Tables -> select the table -> click right mouse button -> Properties -> General -> Variables

  2. For one formula variable, for instance UWEEK, select Tools and Create Formula. IT Service Vision displays the Create New Formula window. Type in the variable name UWEEK and select OK. IT Service Vision displays the Make/Edit Formula window. Select General.

  3. Select the levels at which you want the formula calculated. In this case, select Detail, Day, Week, Month, and Year in the Apply to level field.

    Note: If you choose to define a formula variable for multiple levels, you must be sure that any variables on which it is based have a Kept status of Yes and any statistics on which it is based are selected at those levels and their base variables have a Kept status of Yes.

  4. Specify the length. In this case, type over the 8 with a 6 in the Length field.

  5. Select the data type. In this case, select Numeric in the Type field.

  6. Select the Kept status. In this case, select Yes in the Kept in PDB field.

  7. Specify the label. In this case, type Week in the Label field.
  8. Specify the description. In this case, in the Description field type The Sunday immediately previous to the date in DATETIME.
  9. Select Formula Source. If you have questions about what constitutes a valid formula, select Help. You are presented with a largely blank window with numbers on the left side. Type in the formula to calculate values for the formula variable; in this case define UWEEK as follows:
    UWEEK = datepart(datetime) - weekday(datepart(datetime)) + 1;

    and then select Check Code. The results of the check display in the message area at the bottom of the SAS window.

  10. Select Advanced and provide the subject and format, if applicable. In this case, select the right arrow that is associated with the Format field, date7., and OK. Edit the format to DATE. and then select OK. Note that the new formula variable is now on the list of variables.

Repeat these steps to define another formula variable, UDAY, which has the formula:

UDAY = weekday(datepart(datetime));

and the description Number of the day of the week (1-7), where 1=Sunday, and defaults for the remaining values.

To return to the main window, select Close -> OK -> Close -> OK.

Note: Your views will be rebuilt.

To examine the effect of defining the formula variable, follow this path from the main window:

Administration -> Examine PDB Data -> select a table/level combination that you want to check -> click right mouse button -> View Data

Use the scroll bars to view the UDAY and UWEEK values for each observation (if you have data).

Note: For other browsing methods, see the information on the Print Report Style in the GUI or see the information about the %CPPRINT macro in the Macro Reference documentation for IT Service Vision.

Note: Formula variables do not have selectable statistics. If you want statistics on a formula variable, you must define the statistics as formula variables at the desired non-detail levels.