Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
c159d8e
Fix explicit nullable DNS constructors for PHP 8.4
alcatron Oct 18, 2026
2a26a05
Add Cisco NBAR application reports and shared history summaries
alcatron Oct 18, 2026
bfa0e9b
Share isolated request harness and use generated test sessions
alcatron Oct 18, 2026
3b9b5a1
Correct exporter scoping, report failures and bounded database work
alcatron Oct 18, 2026
3bfe178
Handle application-list failures and isolate regression dependencies
alcatron Oct 18, 2026
b85394c
Bound NBAR maintenance and stabilize connection paging
alcatron Oct 18, 2026
d2c5c56
Match process test doubles to Cacti helper contracts
alcatron Oct 18, 2026
42423ee
Isolate NBAR timespans and correct retention and feed reporting
alcatron Oct 18, 2026
fad9b03
Reject invalid NBAR templates and preserve unnamed chart groups
alcatron Oct 18, 2026
3c69e49
Bound NBAR template state and numeric decoding work
alcatron Oct 18, 2026
628bec1
Validate numeric template widths against their data field types
alcatron Oct 18, 2026
d3dc902
Localize conversation report details and retention text
alcatron Oct 18, 2026
58ade22
Supervise NBAR maintenance independently of Cacti timeout helpers
alcatron Oct 19, 2026
c7e666e
Cover lookup isolation and retained-day boundaries explicitly
alcatron Oct 19, 2026
ef317f6
fix: preserve fragment headers when restoring report sections
alcatron Oct 19, 2026
d9626cf
fix: prevent saved column widths collapsing observation dates
alcatron Oct 19, 2026
fe6f6fa
Merge branch 'develop' into feature/cisco-nbar-reports
TheWitness Oct 19, 2026
d1e4bb1
Merge develop and reconcile the FlowView upgrade and test changes
somethingwithproof Dec 3, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ installation guidance and source-checked behavior.

--- develop ---

* feature: Add Cisco Apps (NBAR) reports for application-bearing NetFlow v9 exports, with IPv4/IPv6 application totals, conversations, paged connections, per-account capture/network options, recent-record status, first/last observation dates and a router setup guide
* feature: Maintain reusable per-capture NBAR hourly/daily summaries through the existing Cacti poller, with raw partial-boundary fallback and a separate retention setting capped at 30 days

* issue#308: Launch the background database upgrade only once and raise the "upgrading in the background" notice a single time, instead of relaunching the CLI and repeating the notice on every Plugins page visit while the recorded version still lags the code. A crashed upgrade past its process timeout is relaunched, and the CLI clears the notice and records the new version when it finishes. Whitelist the customer-created config.php in manifest.json so upgrade pruning never touches it, and run flowview_upgrade.php via __DIR__ so it works when invoked from outside the Cacti root
* issue#306: Match flows that start before and end after the report time window; flows are still read only from the partitions inside that window
* dev: Run the CI poller with the shared runner group so RRD files and structured directories pass permission verification
Expand Down
86 changes: 86 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -335,5 +335,91 @@ an issue.
Got any ideas or complaints, please see the Cacti forums or GitHub for a
resolution.


## Cisco Apps (NBAR)

Cisco Apps is a separate application report within FlowView. The current NBAR
integration reads application IDs and names from NetFlow v9 data and options
templates, including IPv4 and IPv6 records. IPFIX application decoding is not
implemented by this integration. Existing FlowView reports retain their normal
collector and report paths.

Configure a FlowView listener for each export stream and configure the router to
export application-bearing records to it. The report's Setup guide contains a
Cisco 1100 Series example with placeholders for the collector, UDP port and router
interfaces. Check Cisco documentation for the exact platform and IOS XE release.
Creating a listener alone does not enable NBAR on the router.

The report offers Top applications, Conversations and Connections. Filter by IP
matches either endpoint. Conversations requires the account's Internal Networks
settings to identify hosts and upload/download direction. Combine Options accepts
two or three captures; leave them all unselected to save networks without combining.
Choose one observation point per traffic path: overlapping LAN/WAN captures add
both copies and can overcount traffic.

STATUS describes recent retained application records for each selected capture,
independently of historical report filters. A quiet capture can show no recent
NBAR despite a working exporter. It is not a connectivity test.

First seen and Last seen are the earliest/latest retained observation minutes in
the selected period. They do not prove continuous activity, or give exact connection
start/end times. Missing dates are shown as Unavailable. Average bandwidth divides
data volume by the full selected period. Column sorting applies to the displayed
page; resizing is saved in that browser.

NBAR History Retention is separate from the existing FlowView Data Retention Policy.
It offers 1, 3, 7, 14 or 30 days, with a seven-day default. Timespan choices and custom
ranges respect this setting. The existing Cacti poller maintains summaries and
performs bounded cleanup; no extra scheduled task is required. A shorter retention
setting cannot be undone to recover deleted history. If polling stops, maintenance
and cleanup stop too. Shared maintenance locks are scoped to the FlowView database.

## Cisco Apps (NBAR) historical Connections

Connections reads the automatically maintained daily history for each selected capture.
Opening a report or changing its IP filter does not queue a new complete connection build.
The normal FlowView poller maintains this history; no additional cron job is required.

Pages contain up to 100 connections, ordered by total data volume across the selected
captures and period. Indexed candidates are checked against every selected daily segment
so byte, packet and record totals remain exact. Partial days use hourly or raw data.
Previous, Next and a numeric page field provide navigation without a large dropdown or
an expensive full-result count. Very deep pages or broadly tied results can still require
more work; a shorter period or IP filter reduces that work.

A small account-scoped session cache holds nearby pages for 120 seconds for past periods
and 30 seconds for periods including current data. This is separate from retained history.
The existing authenticated FlowView realm controls access; capture selections and filters are included in cache keys.

## Reusable NBAR daily summaries

Top Applications, Conversations and Connections share daily summaries built automatically
per capture, independently of report filters and Cacti accounts. Calendar days run from
local midnight to the following midnight in the Cacti server timezone, including daylight
saving changes. Completed hours are added to today's summary in bounded transactions.
Completed days are reused; late exports invalidate affected summaries and trigger a rebuild.
Partial days and unpublished or changed intervals fall back to hourly summaries or raw records.
IP, application and IP-version filters are applied to the preserved summary fields.

Daily history follows Cisco Apps (NBAR) History Retention, currently selectable up to
30 days. Retention is a rolling data window, not a new retention period beginning each time
a report is opened. Daily summaries are shared source data and are reused for different
periods, filters and users, subject to listener permissions. Connections reads pages from
this history rather than preparing another full copy for every selection.

-----------------------------------------------
Copyright (c) 2004-2026 - The Cacti Group, Inc.

NBAR daily summary materialization and observation-date backfill require MariaDB statement deadlines. On MySQL 8, these workers safely defer their DML rather than running without a bound; reports continue through hourly/raw sources. Exact counts use the MySQL SELECT execution-time hint.

New NBAR records retain the actual exporter address through hourly and daily summaries. Legacy rows keep their counters with an unknown exporter; an exact single-address listener may still resolve their names, but earlier multi-exporter rows cannot be attributed retrospectively.

NBAR maintenance is launched independently of the poller. A registered supervisor runs the PHP maintenance child with a 90-second process deadline. MariaDB hourly mutations also set and restore a verified 20-second statement deadline. MySQL hourly builds remain available only inside the supervised child; raw records remain the fallback until a checkpoint is published.

NBAR timespan requests keep their session state separate from Flow Reports. Conversation totals exclude IPv4 and IPv6 multicast endpoints, and feed lookup failures are shown separately from empty captures. Retention maintenance drains additional batches across raw, hourly and daily tables within a shared ten-second cleanup budget, under the supervised worker deadline.

Template decoding rejects zero-length fields and invalidates the affected cached template until a valid refresh arrives. Chart fallback labels are grouped by their complete expression, so applications without learned names keep separate slices.

The NBAR template cache retains at most 256 templates / 8,192 field definitions in total and 64 templates / 2,048 fields per exporter, across all source IDs. Least recently used entries are evicted and inactive templates expire after 30 minutes (removed lazily on packet activity). Evicted templates are learned again from the next exporter refresh. Numeric data fields must fit unsigned 64-bit values; options scope fields are decoded separately and are not treated as counters.

NBAR maintenance supervision uses PHP's direct argv-array process API rather than Cacti's version-dependent timeout command interface, so startup and hard child termination work on the minimum supported Cacti 1.2.29 and newer releases. Both output pipes are drained in bounded chunks.
246 changes: 246 additions & 0 deletions css/nbar.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,246 @@
/* Copyright (C) 2004-2026 The Cacti Group. GPL-2.0-or-later. */
#nbarTable th .ui-resizable-handle,#nbarConversationTable th .ui-resizable-handle {
display:none!important;
pointer-events:none!important}
.flowview-nbar-table-wrap {
position:relative;
width:100%;
max-width:100%;
min-width:0;
/* Saved column widths must scroll here instead of widening the report bar. */
contain:inline-size;
overflow-x:auto;
display:block}
.flowview-nbar-resize {
display:block!important;
z-index:10}
.flowview-nbar-resize .tablesorter-resizable-handle {
width:12px!important;
pointer-events:auto}
.flowview-nbar-resize .tablesorter-resizable-handle:before {
content:"";
position:absolute;
top:6px;
left:4px;
height:14px;
border-left:1px solid currentColor;
border-right:1px solid currentColor;
width:2px;
opacity:.35}
.flowview-nbar-resize .tablesorter-resizable-handle:hover {
background:rgba(127,127,127,.25)}
.nbarSettingsRow {
display:flex;
flex-wrap:wrap;
align-items:flex-start;
gap:8px 12px;
padding:4px}
.nbarSetting {
display:flex;
align-items:center;
gap:6px}
.nbarSettingsRow>details {
max-width:100%;
min-width:0}
.nbarSettingsRow>details>div {
width:400px;
max-width:100%;
box-sizing:border-box;
white-space:normal;
overflow-wrap:anywhere}
.nbarSettingsRow textarea {
width:100%;
max-width:100%;
box-sizing:border-box}
.nbarSettingsRow summary {
cursor:pointer}
.nbarChart {
max-width:100%}
.nbarReportBar {
display:flex;
flex-wrap:wrap;
align-items:flex-start;
gap:12px}
.nbarReportBar>form {
flex:1 1 660px;
min-width:0;
margin:0}
.nbarChart {
flex:0 1 340px;
padding:4px 12px;
box-sizing:border-box;
margin-right:40px}
.nbarChartBody {
display:flex;
align-items:center;
gap:14px;
margin-top:6px}
.nbarChartPie {
width:112px;
height:112px;
border-radius:50%;
flex-shrink:0}
.nbarChart ul {
list-style:none;
margin:0;
padding:0;
flex:1;
min-width:0}
.nbarChart li {
display:flex;
align-items:center;
gap:6px;
padding:0;
line-height:1.35;
white-space:nowrap}
.nbarChartKey {
width:9px;
height:9px;
flex-shrink:0}
.nbarChartName {
flex:1;
overflow:hidden;
text-overflow:ellipsis}
@media(max-width:1100px) {
.nbarChart {
flex-basis:100%;
padding-left:4px;
margin-right:0}
.nbarChartBody {
max-width:340px}
}
#nbarTable,#nbarConversationTable {
table-layout:auto;
width:100%}
#nbarTable th,#nbarTable td,#nbarConversationTable th,#nbarConversationTable td {
white-space:normal!important;
overflow-wrap:anywhere}
#nbarTable th .textSubHeaderDark,#nbarConversationTable th .textSubHeaderDark {
white-space:normal!important}
/* Observation dates must never wrap one character per line in a narrow column. */
#nbarTable th:nth-last-child(-n+2),#nbarTable td:nth-last-child(-n+2),
#nbarConversationTable th:nth-last-child(-n+2),#nbarConversationTable td:nth-last-child(-n+2) {
min-width:136px;
white-space:nowrap!important;
overflow-wrap:normal}
#nbarTable th:nth-last-child(-n+2) .textSubHeaderDark,
#nbarConversationTable th:nth-last-child(-n+2) .textSubHeaderDark {
white-space:nowrap!important}
#nbarCombineDialog {
width:min(640px,90vw);
max-height:85vh;
padding:0;
position:fixed;
margin:auto;
box-sizing:border-box;
overflow:hidden;
font-weight:normal;
}
#nbarCombineDialog::backdrop {
background:rgba(0,0,0,.4);
}
#nbarCombineDialog .nbarCombineHeader {
display:flex;
justify-content:space-between;
align-items:center;
gap:16px;
padding:12px 16px;
}
#nbarCombineDialog .nbarCombineBody {
padding:16px;
max-height:calc(85vh - 75px);
overflow:auto;
box-sizing:border-box;
font-weight:normal;
line-height:1.45;
}
#nbarCombineDialog textarea {
width:100%;
box-sizing:border-box;
max-width:100%;
}
#nbarCombineDialog h3 {
margin:0 0 8px;
}
#nbarCombineDialog p,#nbarCombineDialog small {
font-weight:normal;
font-size:inherit;
}
#nbarSetupGuide {
width:min(900px,90vw);
max-width:90vw;
max-height:85vh;
padding:0;
position:fixed;
margin:auto;
box-sizing:border-box;
overflow:hidden;
font-weight:normal;
}
#nbarSetupGuide::backdrop {
background:rgba(0,0,0,.4);
}
#nbarSetupGuide .nbarGuideHeader {
display:flex;
justify-content:space-between;
align-items:center;
gap:16px;
padding:12px 16px;
box-sizing:border-box;
}
#nbarSetupGuide .nbarGuideBody {
padding:16px;
max-height:calc(85vh - 75px);
overflow-y:auto;
overflow-x:hidden;
box-sizing:border-box;
min-width:0;
font-weight:normal;
line-height:1.45;
}
#nbarSetupGuide .nbarGuideBody p,#nbarSetupGuide .nbarGuideBody small {
font-weight:normal;
}
#nbarSetupGuide h3 {
font-size:1.15em;
margin:0 0 .8em;
font-weight:bold;
}
#nbarSetupGuide h3:not(:first-child) {
margin-top:1.3em;
}
#nbarSetupGuide p {
margin:0 0 1em;
overflow-wrap:anywhere;
}
#nbarSetupGuide pre {
padding:12px;
width:100%;
max-width:100%;
box-sizing:border-box;
overflow:auto;
white-space:pre;
font-weight:normal;
font-family:monospace;
line-height:1.3;
}
#nbarSetupGuide .nbarGuideHeader button {
flex-shrink:0;
}
#fv_section_tabs {
padding-bottom:0}
#fv_section_tabs + table {
margin-top:0}
#fv_section_tabs a[aria-current="page"] {
font-weight:bold;
text-decoration:none;
}
#fv_section_tabs a:focus-visible {
outline:2px solid currentColor;
outline-offset:2px;
}

/* Use the theme foreground while retaining the surrounding report text size. */
.nbarReportText {
font-size:inherit;
font-weight:normal}
10 changes: 10 additions & 0 deletions flow_collector.php
Original file line number Diff line number Diff line change
Expand Up @@ -1275,6 +1275,8 @@ function process_fv9($p, $ex_addr): void {
global $templates, $tlengths, $allfields, $pacmap, $listener_id;

flowview_connect();
require_once __DIR__ . '/nbar_collector.php';
fv_nbar_packet($p, $ex_addr);

if (!isset($templates[$ex_addr])) {
$templates[$ex_addr] = [];
Expand Down Expand Up @@ -1422,6 +1424,10 @@ function process_fv9($p, $ex_addr): void {

$field = substr($p, $h, $t['length']);

// Decode Cisco reduced-length three-byte unsigned integers.
if ($t['unpack'] === 'N' && $t['length'] == 3 && strlen($field) == 3) {
$field = chr(0) . $field;
}
$field = unpack($t['unpack'], $field) ?: [];

if ($t['pack'] == 'ipv4Address') {
Expand Down Expand Up @@ -1729,6 +1735,10 @@ function process_fv10($p, $ex_addr): void {
$id = $t['field_id'];

$field = substr($p, $h, $t['length']);
// Decode Cisco reduced-length three-byte unsigned integers.
if ($t['unpack'] === 'N' && $t['length'] == 3 && strlen($field) == 3) {
$field = chr(0) . $field;
}
$field = unpack($t['unpack'], $field) ?: [];

if ($t['pack'] == 'ipv4Address') {
Expand Down
Loading