hvrstats
Usage
hvrstats -C hub(Re-)create the hvrstats job.hvrstats -flogf [-Ttimegran_mask] hub</code>Gather statistics data from specific log file logf with specific time granularity.hvrstats -gonceonly [-Ttimegran_mask] [-Gtype] hub</code>Gather statistics data into the HVR_STATS repository table with specific time granularity and specific type of information.hvrstats -ofname [-outopts] hub</code>Fetch statistics data from the HVR_STATS repository table to file fname.hvrstats -ppurge_pol hub</code>Purge data from the HVR_STATS repository table according to purge policy purge_pol.
Description
Command hvrstats gathers or outputs statistics information. For more information see, Statistics and Metrics for Statistics.
Regular Options
This section describes the options available for command hvrstats.
| Parameter | Description |
|---|---|
-C | (Re-)create the hvrstats job. |
-flogf | Gather statistics measurements from HVR log file logf. Examples of use are to catch up with the current log file (in HVR_CONFIG/hubs/hub/logs/hvr.out) or to consume archived log files (in HVR_CONFIG/hubs/hub/logarchives). This option does not change the statistics offset state file. This option cannot be used with options-C, -g, -o, or -p. |
-gonceonly | Gather statistics data into the HVR_STATS repository table; normal run-time hvrstats processing. Value onceonly 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. |
-Gtype | Type of information to gather. Valid values for
The default is -g. |
-k | Only fetch distinct keys. |
-ofname | Fetch statistics data from the HVR_STATS repository table to file fname. The default file format is JSON, for other file formats see output option -o. |
-ppurge_pol | Purge statistics data from the HVR_STATS repository table according to purge policy. Valid values for
-C, -g, -f, or -o. |
-Ttimegran_mask | Only fetch data for specific time granularity. Valid values for
The default is to run all time granularities ( This option can only be used with options -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, if option -T t (for 10 minutes) is supplied, then aggregate values are also calculated for an hour and day granularity. With option -o(view output), multiple letters can be supplied. |
Output Options
The following options (-outopts) can only be used with option -o.
| Parameter | Description | |||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
-bbegin_time | Only write statistics information since begin_time. Value begin_time must have one of the following forms:
| |||||||||||||||||||||||||||||||||||
-cchn | Only write statistics information for channel chn. This option can be supplied multiple times. | |||||||||||||||||||||||||||||||||||
-eend_time | Only write statistics information up to end_time. Value end_time must have one of the following forms:
| |||||||||||||||||||||||||||||||||||
-lloc | Only write statistics information for location loc. This option can be supplied multiple times. | |||||||||||||||||||||||||||||||||||
-mmchoice | 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. | |||||||||||||||||||||||||||||||||||
-sscope | Only write statistics information for metric with specific scope. A scope is identified by three letters for channel ( Value scope must be one of the following:
Note that two combinations ( | |||||||||||||||||||||||||||||||||||
-ttbl | Only write statistics information for table tbl. This option can be supplied multiple times. | |||||||||||||||||||||||||||||||||||
-Vfmt | Format of the output file fname. Value fmt can be one of the following:
| |||||||||||||||||||||||||||||||||||
-wwaitpoint | Only write statistics information that was updated after waitpoint. Value waitpoint must have one of the following forms:
| |||||||||||||||||||||||||||||||||||
Examples
This section provides examples of using the hvrstats command.
Example 1. Create the hvrstats job
Run this command to create the hvrstats job and the HVR_STATS repository table on hub myhub.
hvrstats -C myhub
Example 2. Gather statistics continuously
Run this command to start continuous statistics gathering into the HVR_STATS repository table on hub myhub. The process runs in a loop until terminated.
hvrstats -g0 myhub
Example 3. Gather statistics once
Run this command to perform a single statistics gathering cycle on hub myhub, then stop.
hvrstats -g1 myhub
Example 4. Gather statistics from a log file
Run this command to gather statistics from the current log file on hub myhub. This is useful for catching up after a gap in statistics collection.
hvrstats -f$HVR_CONFIG/hubs/myhub/logs/hvr.out myhub
Example 5. Output statistics to a JSON file
Run this command to fetch all statistics data from the HVR_STATS table and write it to file mystats.json. JSON is the default output format.
hvrstats -omystats.json myhub
Example 6. Output statistics to a CSV file
Run this command to fetch statistics data and write it to file mystats.csv in CSV format.
hvrstats -omystats.csv -Vcsv myhub
Example 7. Output statistics for a specific channel and time range
Run this command to fetch statistics for channel mychannel between two timestamps and write the result to mystats.json.
hvrstats -omystats.json -cmychannel -b"2024-01-01 00:00:00" -e"2024-01-31 23:59:59" myhub
Example 8. Purge statistics data
Run this command to purge old statistics data from the HVR_STATS table on hub myhub according to the MEDIUM purge policy, which is the default.
hvrstats -pMEDIUM myhub
Example 9. Full statistics workflow: create, gather, output, and purge
To set up and run a complete statistics workflow on hub myhub, run these commands in sequence:
# Step 1: Create the HVR_STATS table hvrstats -C myhub # Step 2: Gather statistics from a log file at 10-minute granularity hvrstats -f$HVR_CONFIG/hubs/myhub/logs/hvr.out -Tt myhub # Step 3: Write the statistics data to a file hvrstats -omystats.json myhub # Step 4: Purge old rows using the SMALL purge policy hvrstats -pSMALL myhub