Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
186 changes: 186 additions & 0 deletions .github/workflows/plugin-ci-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,191 @@ jobs:
exit 1
fi

# The milestone 3 and 4 end-to-end runs (tests/bin) against real poller
# runs: device flow, target churn and reindex, backup and restore, the Thold
# and Maint replay, and failure qualification. One PHP version per Cacti
# ref keeps the job time down; the scale harness stays a manual run
# (docs/release.md).
end-to-end:
name: End to end on Cacti ${{ matrix.cacti }}
runs-on: ubuntu-latest
timeout-minutes: 30

strategy:
fail-fast: false
matrix:
cacti: ['release/1.2.31', '1.2.x']

services:
mariadb:
image: mariadb:11.8@sha256:6422478cb8e159f080fb1d8ccf65101e26fe51385787fde7d16c3b165a331f15
env:
MYSQL_ROOT_PASSWORD: cactiroot
MYSQL_DATABASE: cacti
MYSQL_USER: cactiuser
MYSQL_PASSWORD: cactiuser
ports:
- 3306:3306
options: >-
--health-cmd="mariadb-admin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=3

steps:
- name: Checkout Cacti
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
repository: Cacti/cacti
ref: ${{ matrix.cacti }}
path: cacti

- name: Checkout pfs plugin
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
path: cacti/plugins/pfs

# Thold and Maint run unchanged, at the releases docs/alerting.md names.
- name: Checkout Thold v1.8.2
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
repository: Cacti/plugin_thold
ref: 1eb406bd0f81f3204358cce7bd43c8bb5adc8e4a
path: cacti/plugins/thold

- name: Checkout Maint v1.3
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
repository: Cacti/plugin_maint
ref: cd62de9cc323a4f5a8ac80a8d9dda3c7fa16c470
path: cacti/plugins/maint

- name: Install PHP 8.2
uses: shivammathur/setup-php@eb7c497e18156a6bbabfef1d3a82760b9eda3962 # 2.40.0
with:
php-version: '8.2'
extensions: intl, mysql, gd, ldap, gmp, xml, json, mbstring, openssl, snmp
ini-values: "post_max_size=256M, max_execution_time=60, date.timezone=America/New_York"
coverage: none

- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y rrdtool mariadb-client

- name: Initialize Cacti database
run: |
echo -e "[client]\nuser = root\npassword = cactiroot\nhost = 127.0.0.1\n" > ~/.my.cnf
chmod 600 ~/.my.cnf
mariadb -e "CREATE USER IF NOT EXISTS 'cactiuser'@'127.0.0.1' IDENTIFIED BY 'cactiuser';"
mariadb -e "GRANT ALL PRIVILEGES ON cacti.* TO 'cactiuser'@'127.0.0.1';"
mariadb -e "GRANT SELECT ON mysql.time_zone_name TO 'cactiuser'@'127.0.0.1';"
mariadb -e "FLUSH PRIVILEGES;"
mariadb cacti < cacti/cacti.sql
mariadb -e "INSERT INTO settings (name, value) VALUES ('path_php_binary', '$(command -v php)')" cacti
sed -r "s/localhost/127.0.0.1/g" cacti/include/config.php.dist > cacti/include/config.php

- name: Install Cacti via CLI
working-directory: cacti
run: php cli/install_cacti.php --accept-eula --install --force

- name: Install and enable the plugin
working-directory: cacti
run: php plugins/pfs/tests/bin/php-guard-check.php

- name: Device flow
working-directory: cacti
env:
PFS_TEST_DATABASE: disposable
# RRDtool refuses a second update to a file in the same second, and
# the flows run faster than that, so each forced poll waits a second.
run: |
set -eu
php plugins/pfs/tests/bin/device-flow.php setup
sleep 1
php poller.php --poller=1 --force > /dev/null
php plugins/pfs/tests/bin/device-flow.php check
Comment thread
somethingwithproof marked this conversation as resolved.
Resolved
sleep 1
php poller.php --poller=1 --force > /dev/null
php plugins/pfs/tests/bin/device-flow.php later

- name: Target churn and reindex
working-directory: cacti
env:
PFS_TEST_DATABASE: disposable
run: |
set -eu
for phase in setup remove add return; do
php plugins/pfs/tests/bin/target-flow.php "$phase"
sleep 1
php poller.php --poller=1 --force > /dev/null
done
php plugins/pfs/tests/bin/target-flow.php check

- name: Backup and restore
working-directory: cacti
env:
PFS_TEST_DATABASE: disposable
run: PFS_TEST_MYSQL_DEFAULTS="$HOME/.my.cnf" sh plugins/pfs/tests/bin/restore-replay.sh

# The poller logs a failed ownership change for each RRD file it has not
# created yet; that line is not a fault of the flows.
- name: Check the flows' log for errors
working-directory: cacti
run: |
if [ -f log/cacti.log ]; then
# Cacti 1.2.31 leaves incomplete poller-output rows when a
# multi-item source returns U. The churn replay checks those
# gaps; keep the diagnostics visible and restrict this allowance
# to the affected core release and the plugin's templates.
core_warnings='^$'
if [ "$(cat include/cacti_version)" = '1.2.31' ]; then
core_warnings="^[^ ]+ [0-9:]+ - POLLER: Poller\\[1\\] PID\\[[0-9]+\\] WARNING: (Poller Output Table not Empty\\. Issues: [0-9]+, DS\\[[0-9, ]+\\]|There are [0-9]+ Data Sources not returning all data leaving rows in the poller output table\\. Details to follow\\.|Data Template 'Parallel Filesystem [^']+' is impacted by lack of complete information)\$"
grep -E "$core_warnings" log/cacti.log || true
fi
if grep -E "FATAL:|ERROR:|WARNING:" log/cacti.log | grep -v "does not exist for ownership assignment" | grep -vE "$core_warnings" | grep -vE '^[^ ]+ [0-9:]+ - SYSTEM WARNING: Primary Admin account notifications disabled! Unable to send administrative Email\.$'; then
exit 1
fi
mv log/cacti.log log/flows.log
fi

- name: Thold and Maint replay
working-directory: cacti
env:
PFS_TEST_DATABASE: disposable
run: |
sh plugins/pfs/tests/bin/alert-replay.sh
if grep -E "PHP ERROR|DISABLING PLUGIN|TypeError|Fatal" log/cacti.log; then
exit 1
fi
mv log/cacti.log log/alert.log

# Provokes failed reads, a lost database connection, and slow nodes, so
# its log is printed, not checked. Not root here, so the RRD permission
# scenario is skipped; the container run covers it.
- name: Failure qualification
working-directory: cacti
env:
PFS_TEST_DATABASE: disposable
run: |
PFS_TEST_MYSQL_DEFAULTS="$HOME/.my.cnf" sh plugins/pfs/tests/bin/failure-replay.sh
if [ -f log/cacti.log ]; then mv log/cacti.log log/failure.log; fi

- name: Show the end-to-end logs
if: always()
working-directory: cacti
run: |
for f in log/flows.log log/alert.log log/failure.log log/cacti.log; do
if [ -f "$f" ]; then
echo "== $f"
cat "$f"
fi
done

workflow-lint:
name: Workflow lint
runs-on: ubuntu-latest
Expand Down Expand Up @@ -412,6 +597,7 @@ jobs:
- entry-point-lint
- integration-test
- php-guard
- end-to-end
- workflow-lint
- reuse
runs-on: ubuntu-latest
Expand Down
9 changes: 7 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ Phase 1, Lustre observation. Not released: pilots on real filesystems, the exter
- Registry of filesystems, nodes, and the networks each poller may reach; a background reader per poller that reads Lustre servers over SSH through a fixed forced-command script, `node/pfs-read.sh` (milestone 2).
- A cache of target inventory, condition, capacity, and counters with their freshness, and a health page (milestone 2).
- One Cacti device per filesystem with OST and MDT script server data queries, device, data, and graph templates, five overview graphs, and per-target graphs on demand; counters as DERIVE data sources that read unknown across a reset (milestone 3).
- A per-filesystem summary data source for Thold: fill and imbalance, target counts, capacity totals, filesystem throughput and metadata rates, and data age (milestones 3 and 4).
- A per-filesystem summary data source for Thold: fill and imbalance, target counts, capacity totals, filesystem throughput and metadata counters, and data age (milestones 3 and 4).
- Summary rate gauges, `read_bytes_rate`, `write_bytes_rate`, and `md_ops_rate`, computed by the reader so Thold can alert on rates without a counter data source ([ADR 0012 amendment](docs/decisions/0012-thold-rate-alerts-high-thresholds-only.md#amendment-2026-11-15)).
- An uninstall setting, off by default, that deletes the devices the plugin created, with their graphs and data sources, through Cacti's device delete; mapped existing devices always stay. The devices the plugin created are recorded one row each in `plugin_pfs_created_devices`, which outlives an uninstall that drops the other tables while it lists a device still in Cacti (REQ-LIFE-005, [#31](https://github.com/somethingwithproof/plugin_pfs/issues/31)).
- Device permissions on every page and admin action, and a `graph_buttons` link from a device's graphs to its filesystem view (milestone 3).
- End-to-end tests with unchanged Thold and Maint releases, target churn and reindex, backup and restore, failure scenarios, and a scale harness (milestone 4).
- Operator guide, alerting guide, release process, security self-review, and pilot plan (milestone 4).
Expand All @@ -23,9 +25,12 @@ Phase 1, Lustre observation. Not released: pilots on real filesystems, the exter

### Fixed

- Upgrade instructions now call out recreating the Throughput and Metadata graphs to add the rate gauges, and preserving any needed history first.
- A rate gauge was served from a counter read that was no longer current while the capacity read the summary time comes from still was; each rate now also needs its own counter read to be current.
- Uninstall now clears mappings for remotely soft-deleted devices before it forgets their ownership, and stops if mapping reads or writes fail.
- A target that a complete read left out serves unknown on its per-target data source at once, instead of its last value until that value went stale.
- The Fill graph did not draw `age`, so Cacti stored no value for it and Thold could not threshold it.

### Known issues

- Thold 1.8.2 thresholds on counter data sources (`read_bytes`, `write_bytes`, `md_ops`) are not supported: an unknown counter interval makes Thold's poller hook fail and Cacti disables Thold ([docs/alerting.md](docs/alerting.md#counters-and-thold-182)).
- Thold 1.8.2 thresholds on counter data sources (`read_bytes`, `write_bytes`, `md_ops`) are not supported: an unknown counter interval makes Thold's poller hook fail and Cacti disables Thold. Threshold the rate gauges instead ([docs/alerting.md](docs/alerting.md#counters-and-thold-182)).
5 changes: 3 additions & 2 deletions docs/PLAN.md
Original file line number Diff line number Diff line change
Expand Up @@ -283,13 +283,14 @@ The "Parallel Filesystem Summary" data source returns, from the reader's cache:
| `targets_missing` | Targets in inventory with no recent observation | `U` |
| `targets_unhealthy` | Targets with a non-healthy condition flag | `U` |
| `age` | Seconds since the oldest contributing observation | Always numeric once observed |
| `read_bytes_rate`, `write_bytes_rate`, `md_ops_rate` | Per-second rates of the aggregate counters, computed by the reader (GAUGE) | `U`, and `U` across a reset or member change |

Thold thresholds and Maint device schedules apply with no change to either plugin (ADR 0002).

Stated limits:

- **Sampling alignment.** Cacti polls on its own interval and the reader reads nodes on its own. Thold durations should be at least one poll interval.
- **Rates.** Superseded in practice by the milestone 4 finding below: with Thold 1.8.2, a threshold on a DERIVE data source that reads `U` once crashes Thold's poller output hook. Thold can compute a rate from a DERIVE data source, with one negative sample on a reset, and an endpoint-difference rate (a lower bound) if a reset is hidden by a larger later value ([thold-counters](research/thold-counters.md)). Decided in [ADR 0012](decisions/0012-thold-rate-alerts-high-thresholds-only.md) (#8): rate alerts on DERIVE data sources are supported for high thresholds with a duration of at least two polls; low-threshold rate alerts are unsupported in phase 1, because a reset can reach Thold as a negative rate.
- **Rates.** Amended in [ADR 0012](decisions/0012-thold-rate-alerts-high-thresholds-only.md#amendment-2026-11-15) after the milestone 4 run: rate alerts use the summary's rate gauges, and thresholds on DERIVE data sources are unsupported with Thold 1.8.2, because a threshold on a DERIVE data source that reads `U` once crashes Thold's poller output hook. The original reasoning follows. Thold can compute a rate from a DERIVE data source, with one negative sample on a reset, and an endpoint-difference rate (a lower bound) if a reset is hidden by a larger later value ([thold-counters](research/thold-counters.md)). Decided in [ADR 0012](decisions/0012-thold-rate-alerts-high-thresholds-only.md) (#8): rate alerts on DERIVE data sources are supported for high thresholds with a duration of at least two polls; low-threshold rate alerts are unsupported in phase 1, because a reset can reach Thold as a negative rate.
- **Resets.** A counter reset yields one unknown interval, which does not trigger a threshold.
- **Summary only.** Alerts see the summary and per-target gauges, not distributions.

Expand All @@ -305,7 +306,7 @@ Alternatives considered:

Milestone 4 implementation notes, where the build differs from or adds to the text above:

- **Counter thresholds are not supported with Thold 1.8.2.** Thold stores a `U` from a DERIVE data source as its previous raw value and on the next numeric value throws a PHP `TypeError` in the `poller_output` hook; Cacti then disables Thold. The plugin serves `U` for every reset and contributor change by design, so ADR 0012's supported rate alerts would disable Thold at the first reset. The end-to-end run checks a two-poll high rate threshold only before any `U` and then removes it. Thold's unreleased development branch changes this path. Whether to amend ADR 0012, report it to Thold, or add plugin-computed rate gauges is an owner decision ([alerting](alerting.md), [thold-counters](research/thold-counters.md#milestone-4-end-to-end-run)).
- **Counter thresholds are not supported with Thold 1.8.2; rate gauges replace them.** Thold stores a `U` from a DERIVE data source as its previous raw value and on the next numeric value throws a PHP `TypeError` in the `poller_output` hook; Cacti then disables Thold. The plugin serves `U` for every reset and contributor change by design. The summary therefore carries `read_bytes_rate`, `write_bytes_rate`, and `md_ops_rate`: GAUGE values the reader computes from consecutive sums with the same unknown rules, printed on the Throughput and Metadata Operations graphs so Cacti stores them. The end-to-end run thresholds `write_bytes_rate` through a counter reset with Thold still enabled ([ADR 0012 amendment](decisions/0012-thold-rate-alerts-high-thresholds-only.md#amendment-2026-11-15), [alerting](alerting.md), [thold-counters](research/thold-counters.md#milestone-4-end-to-end-run)). The rate's time base is the read time all summed values share, so a sum whose values were read in different runs has no rate; per-target rate gauges are not provided.
- **Absent counter lines in sums** count as zero only for a present, in-service OST whose other values are current in the same read ([ADR 0013](decisions/0013-absent-counter-lines-count-as-zero-in-sums.md)). The per-target series stays unknown. A read without `snapshot_time` is not complete, so nothing in it counts as absent.
- **A missing target serves `U` at once.** Milestone 3 served a missing or conflicting target's last gauge until it went stale (up to two intervals), which drew an outage as a flat line. The data query now serves `U` for any target that is not present; its index and data source stay.
- **`age` is drawn on the Fill graph.** Cacti creates in an RRD file only the values some graph item uses; `age` was not drawn, so it had no RRD value and no threshold could be made on it. The Fill graph now prints it.
Expand Down
Loading
Loading