Hvrstats

From HVR
Jump to: navigation, search

  Since    v5.3.1/25  

Commands
Previous: hvrstatistics
Next: hvrsuspend
Command Reference

Name

hvrstats - Gather or output statistics information.

Note: Statistics generation for HVR version 5.3.1/24 and older, see hvrstatistics.

Synopsis

hvrstats [-h class] [-u user] -C lett hubdb

hvrstats [-h class] [-u user] -f logf [-f logf]... [-T gran] hubdb

hvrstats [-h class] [-u user] -g N [-T gran] [-G typ] hubdb

hvrstats [-h class] [-u user] -o fname [-outopts] hubdb

hvrstats [-h class] [-u user] -p pol hubdb

Description

Command hvrstats can be invoked in five distinct ways:

Option -C creates database objects.

Option -f gathers statistics information from a static log file.

Option -g gathers live information into its status tables.

Option -o outputs information from status tables.

Option -p purges old data from the status tables.
SC-Hvr-Stats.png

Regular Options

Parameter Description
-C letters Create database objects for hvrstats. Value letters can be one or more of the following:
t Create tables hvr_stats and hvr_stats_staging.
j Create hvrstats job in scheduler. Once created the job can be started and suspended using commands hvrstart and hvrsuspend respectively.

This option cannot be used with options -g -f -o or -p.

-f logf Gather statistics measurements from HVR log file logf. This option can be supplied multiple times. Examples of use are to catchup with the current log file ($HVR_CONFIG/log/hubdb.out) or to consume archived log files (in $HVR_CONFIG/logarchive) . This option does not change the statistics offset state file. This option cannot be used with options -C -g -o or -p.
-g bool Gather information from runtime; normal run-time hvrstats processing. Value bool should either be 0 (run continuously in a loop until terminated) or 1 (perform just one [full] cycle, then stop). This option cannot be used with options -C -f -o or -p.
-G letters Type of information to gather. By default all types of information is gathered (but not at same frequency). Value letters can one of the following:
j Job information, including latency (from $HVR_CONFIG/router) and log files sizes (from $HVR_CONFIG/log).
s Statistics metrics from live HVR log file's contents. This option requires option -g (gather). If this option is not supplied then all types of information is gathered (-Gjs).
-h class Hub class, for connecting to hub database.
-o fname Writes statistics information into file fname. The default file format is JSON. To filter the output written into file fname, you can use the output options along with -o.
-p policy Purge old records from table hvr_stats. Value policy can be one of the following:
NONE Purge all rows from stats table.
SMALL Per-table measurements at 1min/10 min/1hour/1day granularity are purged after 1hour/4hours/1day/7days respectively. Rows for all tables (table=*) at 1min/10 min/1hour/1day granularity are purged after 4hours/1day/7days/30days respectively.
MEDIUM Per-table measurements at 1min/10 min/1hour/1day granularity are purged after 4hours/1day/7days/30days respectively. Rows for all tables (table=*) at 1min/10min/1hour/1day granularity are purged after 1day/7days/30days/never respectively.
LARGE Per-table measurements at 1min/10min/1hour/1day granularity are purged after 1day/7days/30days/never respectively. Rows for all tables (table=*) at 1min/10min/1hour/1day granularity are purged after 7days/30days/never/never respectively.

Values UNBOUNDED is not allowed here but is valid for action Scheduling /StatsHistory. This option cannot be used with options -C -g -f or -o.

-T gran Time granularity of data to gather or to output. Value gran must be only one of the following:
m Minute granularity
t Ten (10) minutes granularity
h Hour granularity
d Day granularity
c Current granularity. This letter is allowed with option -o (view output), not option -g (gather from runtime).
This option can only be used with option -f (gather from file), -g (gather from runtime) or -o (view output). When gathering (option -g) if this option is omitted the default is m (minute granularity). Also, when gathering (but not when showing) if a small granularity is supplied then large granularities (e.g. m > t > h > d) will also be calculated. For example for option -T t (for 10 minutes) is supplied then aggregate values are also calculated for hour and day granularity. With option -o (view output), multiple letters can be supplied and the default is to return all time granularities (-T mthd).
-u user[/pwd] Username for hub database.

Output Options

The following options (-outopts) can only be used with option -o .

Note: For list of all statistics metrics, see Metrics for Statistics.
Parameter Description
-b begin_time Only write statistics information since begin_time. Value begin_time must have form YYYY-MM-DD HH:MM:SS, YYYY-MM-DDTHH:MM:SS+TZD or YYYY-MM-DDTHH:MM:SSZ.
-c chn Only write statistics information for channel chn. This option can be supplied multiple times.
-e end_time Only write statistics information upto end_time. Value end_time must have form YYYY-MM-DD HH:MM:SS, YYYY-MM-DDTHH:MM:SS+TZD or YYYY-MM-DDTHH:MM:SSZ.
-l loc Only write statistics information for location loc. This option can be supplied multiple times.
-m mchoice Only write statistics information for specific metrics. Values mchoice can be either a metric name (e.g. Integrated Updates), a group of metrics (e.g. Latency) or a named label of metrics (__kpi_lines). This option can be supplied multiple times; if it is not supplied then all metrics are displayed.
-s scope Only write statistics information for metric with specific scope. A scope is identified by three letters for channel, location and table The first letter of scope is either c if the value is for a specific channel or * if it is associated (an aggregate) for all channels. The second is either l if the value is for a specific location or * if it is associated (an aggregate) for all locations. The third is either t if the value is for a specific table or * if it is associated (an aggregate) for all tables.

Value scope must be one of the following:

clt Specific (named) channel, location and table.
cl* Specific channel and location, but for all tables (e.g. table=*).
c*t Specific channel and table, but for all locations.
*l* Specific locations, but for all channels and tables.
c** Specific channel, but for all locations and tables.
*** General values, which apply to all channels, locations and tables.

If this option is not supplied then measurements for all scope are shown. This option can be supplied multiple times.

cl* *l*
clt ***
c*t c**

Note that two combinations (*lt and **t) are not supported.

-t tbl Only write statistics information for table tbl. This option can be supplied multiple times.
-V fmt Format of the output file fname. Value fmt can be one of the following:
json JSON (default).
csv CSV format.
-w time Only write statistics information that was updated after time. Value time must have form YYYY-MM-DD HH:MM:SS, YYYY-MM-DDTHH:MM:SS+TZD or YYYY-MM-DDTHH:MM:SSZ.

Example

This command will create the hvrstats catalog tables (if necessary), gather all data from a log file (-f <hvr_log>), select data for time granularity ‘10minutes’ (-Tt) into a file (-o <ofile>) and purge (-p) old rows according to the SMALL purge policy. Note that these actions will be performed in that exact order.

hvrstats -Ct -f <hvr_log> -o <ofile> -Tt -pSMALL <hub_db>

Files

Folder-icon.png HVR_CONFIG
└─ Folder-icon.png files
├─ hvrstatistics-stats-hubdb.offset Statistics state file.
└─ hvr_stats_staging_hubdb.xml