Managing Calculated Performance Counters
Create calculated counters from existing performance counters and use them like regular metrics.
Settings Resources Calculated Performance Counters
Calculated Performance Counters let you define new counters by applying arithmetic formulas to existing counter values.
Use them when a device, system, or monitoring engine provides raw values, but you need a derived metric such as utilization percentage, total throughput, remaining capacity, or a normalized value.
For example, a device may expose bytes sent, bytes received, and interface speed separately. You can create a calculated counter that returns interface bandwidth utilization as a percentage.
Calculated counters extend counters from a monitoring engine by using named source counters and a numeric expression.
This is not the same as describing a counter that already exists. To set a counter's display name, units, formatting or default thresholds, see Counter Repository.
After you define a calculated counter, NetCrunch exposes it like any other counter from the selected monitoring engine. You can use it in charts, reports, dashboards, and performance trigger alerts.
Opening Calculated Performance Counters
pgcPage1
Open the Calculated Performance Counters window from:
Settings Resources Calculated Performance Counters
The window contains:
- a searchable list of calculated counters grouped by monitoring source
- existing counter definitions for Linux Counters, Mac OS Counters, SNMP Metrics, and other available engines
- an editor for the selected counter
- a variables section listing source counters used by the expression
- an expression editor
- save controls
Counter List
The left panel shows calculated counters grouped by monitoring engine or counter source.
You can:
- search counters by name
- expand or collapse counter groups
- select an existing calculated counter
- add a new calculated counter by clicking the + button
- delete a selected counter by clicking the delete icon
Counter groups depend on available monitoring engines and configured counter sources. Typical groups include:
- Linux Counters
- Mac OS Counters
- SNMP Metrics
Creating a Calculated Counter
pgcPage2
Click + in the counter list to add a new calculated counter.
Select or create the group where the calculated counter should belong. The group determines where the calculated counter will be available later when selecting performance counters.
Setting the Counter Name
pgcPage3
Enter the full calculated counter name in the Name field.
Use the standard counter path format:
Object/Counter.Instance
The instance part is optional and depends on the counter type.
Examples:
Interfaces/% HD Bandwidth Utilization Cisco Memory/% Memory Used Disk Performance/Total I/O Operations/sec System/% Free Memory
Counter names should be structured consistently with existing counters because users will later browse and select them in the same way as native counters.
Adding a Description
Use the Description field to explain what the calculated counter measures.
Example:
Half Duplex Interface bandwidth utilization
A useful description should state:
- what the counter measures
- which source values it uses
- whether the result is a percentage, rate, total, or normalized value
- any assumptions, such as full duplex or half duplex calculation
Adding Source Counters as Variables
pgcPage4
The Variables section lists source counters used by the calculated counter.
Each variable maps a readable variable name to an existing counter.
Example:
$BytesSent = Interfaces(_VCounter)\Bytes sent/sec $InterfaceSpeed = Interfaces(_VCounter)\Speed $BytesReceived = Interfaces(_VCounter)\Bytes received/sec
Variables must be referenced in the expression by using the $ prefix.
Example:
$BytesSent $BytesReceived $InterfaceSpeed
Click + in the Variables section to add another source counter. NetCrunch assigns or lets you define a variable name for the selected counter.
Use variable names that describe the value clearly. Avoid short or ambiguous names unless the expression is trivial.
Good examples:
$BytesSent $BytesReceived $InterfaceSpeed $MemoryUsed $MemoryFree
Poor examples:
$a $b $x1
Editing the Expression
pgcPage5
Use the Expression editor to enter the arithmetic formula for the calculated counter.
Example:
($BytesReceived + $BytesSent) / $InterfaceSpeed * 800
This example calculates half-duplex interface bandwidth utilization by adding received and sent bytes per second, dividing the result by interface speed, and converting bytes to bits.
The expression can use:
- variables defined in the Variables section
- arithmetic operators
- numeric constants
- supported functions such as
min()andmax()
Variables must match the names defined in the Variables list.
Expression Examples
Interface bandwidth utilization
($BytesReceived + $BytesSent) / $InterfaceSpeed * 800
Use this formula when byte counters are measured per second and interface speed is measured in bits per second.
Memory used percentage
100 * ($MemoryUsed / ($MemoryUsed + $MemoryFree))
Use this formula when a device exposes used and free memory as separate raw counters.
Free memory percentage
100 * ($MemoryFree / ($MemoryUsed + $MemoryFree))
Use this formula when you want the inverse of used memory percentage.
Total disk operations per second
$ReadsPerSec + $WritesPerSec
Use this formula when read and write operation rates are exposed separately.
Clamped utilization value
min(100, max(0, $Utilization))
Use this formula when a calculated result should be limited to a valid percentage range.
Saving Changes
Click Save after changing the counter name, description, variables, or expression.
The Save button is enabled only when the definition contains changes that can be saved.
Editing Existing Calculated Counters
Select an existing calculated counter from the list.
You can edit:
- name
- description
- source variables
- expression
Changing an existing calculated counter affects every place where the counter is used, including reports, dashboards, and alert definitions.
Review dependencies before changing the meaning or unit of an existing counter.
Deleting Calculated Counters
Select a counter and click the delete icon.
Before deleting a counter, verify that it is not used by:
- monitoring packs
- node settings
- performance trigger alerts
- reports
- dashboards
- graphical views
Deleting a counter that is already used can leave dependent configuration incomplete.
Best Practices
Use clear names that follow existing counter naming patterns.
Keep expressions simple enough to audit later.
Describe the expected unit in the description when the unit is not obvious.
Avoid changing the meaning of counters already used in alerts or reports.
Create a new calculated counter instead of rewriting an existing one when the old formula may still be needed.
Test calculated counters on real devices before using them in alert thresholds.
Common Problems
Variable is not recognized
Check that the variable exists in the Variables section and that the expression uses the $ prefix.
Correct:
$BytesSent + $BytesReceived
Incorrect:
BytesSent + BytesReceived
Result is much too small or too large
Check unit conversion. Network counters may be reported in bytes per second, while interface speed is often reported in bits per second.
Counter does not appear where expected
Check that the calculated counter was created under the correct monitoring source or counter group.
Expression is valid but alert thresholds behave unexpectedly
Verify the calculated counter unit and scale before creating performance trigger alerts.
Summary
Calculated Performance Counters convert existing counter values into derived metrics. They are useful when raw device counters do not directly match the value you want to monitor.
A calculated counter consists of:
- a counter name
- a description
- source counters mapped to variables
- an arithmetic expression
Once saved, the calculated counter becomes available like any other performance counter in NetCrunch.