85 Commits
Author SHA1 Message Date
TheWitnessandCopilot 9b217e0e3a INFO: set compat to 1.2.29 (#838)
* INFO: set compat to 1.2.32

* docs: update Copilot instructions Cacti baseline to 1.2.32 (matches INFO compat)

* INFO: back off compat to 1.2.29

* Add manifest.json + upgrade-time file pruning

* Prune phpunit.xml on upgrade and ignore markdown-lint configs

phpunit.xml ships in the repo for CI but is a dev-only test artifact, so it
is removed from manifest.json 'expected', pruned from installs on upgrade
(like tests/), and excluded from the manifest drift check.

The retired markdown-lint configs (.mdlrc, .md_style.rb) are deleted, and
.md* is now ignored like .git*: protected from pruning and excluded from
drift if it reappears.

* Move thold_functions.php and thold_webapi.php into includes/; flatten css

The main threshold library becomes includes/functions.php and the web API
helper becomes includes/webapi.php; every caller (setup.php, includes/*, the
CLI/poller/notify entry points and the test suite) loads them from includes/.
Each per-theme stylesheet css/<theme>/main.css becomes css/<theme>.css so users
can drop their own css/<theme>.css into the css base, and the page_head hook
looks there. Old paths are tombstoned so existing installs drop the stale
copies on upgrade.

* Regenerate cacti.pot for the includes/ file relocations

Moving the plugin's library files into includes/ changed the source-reference
lines in the translation template; regenerate it so the 'Verify translation
template' CI check passes.

* Harden the hook-include test and make RPN integer ops explicit

The HookFunctionsIncludeTest invokes real hooks with placeholder input purely
to execute their relocated include_once lines; it now swallows engine
notices/warnings/deprecations during those calls (and restores the error
handler and config afterward) so it cannot trip the suite's failOnDeprecation
or leak state into other tests. The RPN % and ^ operators now cast their
operands to int explicitly, matching their long-standing integer-truncation
behaviour while silencing the implicit float-to-int conversion deprecation.

* Harden prune against tampered-manifest path traversal

The upgrade-time prune now rejects any tombstone containing '.'/'..' segments
(which could escape the plugin directory or resolve to its root) and treats
ancestors of whitelist entries as protected, so a tombstone on a parent
directory can no longer delete a whitelisted file beneath it.

* docs: update and align the Project Structure block

Point the structure tree at the relocated files (libraries now under
includes/, data files under docs/, stylesheets under css/) and align the
trailing '# ...' comments to a single column so they no longer drift right.

* docs/tests: standardize test header and correct manifest-contract notes

- Use the full license header (from the plugin's own setup.php) in
  tests/Unit/PruneFilesTest.php instead of the abbreviated copyright banner.
- Document that the manifest drift check and the upgrade-time prune also
  handle phpunit.xml and .md* files, matching the implemented behavior.

* refactor: rename prune helpers to the plugin-slug function prefix

The repository naming contract reserves the plugin_<name>_ prefix for plugin
lifecycle / hook-registration functions; all other functions use the plain
<name>_ prefix. Rename the internal upgrade helpers accordingly:

  plugin_<name>_prune_files() -> <name>_prune_files()
  plugin_<name>_rmtree()      -> <name>_rmtree()

The call site, unit tests, and the copilot-instructions.md references are
updated to match. No behavioral change.

* chore: set the Cacti compatibility floor to 1.2.29

Align the compat metadata (and the contributor-guide references) with the
team decision to standardize the minimum supported Cacti version at 1.2.29;
the previously proposed 1.2.32 floor was not adopted.

---------

Co-authored-by: Copilot <copilot@users.noreply.github.com>
2026-10-01 01:40:00 -05:00
TheWitness 41dc700357 Add PHPDoc blocks to undocumented functions (partial - thold_functions.php follow-up owed) (#828)
* Add PHPDoc blocks: small files batch (cli_import, poller_thold, includes/tab, includes/database, cli_thresholds, thold_notify, notify_queue)

* Add PHPDoc blocks: includes/polling.php, includes/settings.php (WIP checkpoint)

* Add PHPDoc blocks: thold_process.php, thold_daemon.php (WIP checkpoint)

* Add PHPDoc blocks: thold_webapi.php (WIP checkpoint)

* Add PHPDoc blocks: thold.php (WIP checkpoint)

* Add PHPDoc blocks: thold_graph.php (WIP checkpoint)

* Add PHPDoc blocks: notify_lists.php (WIP checkpoint)

* Add PHPDoc blocks: thold_templates.php (WIP checkpoint)

* Add PHPDoc blocks: setup.php batch 1-2 (WIP checkpoint)

* Add PHPDoc blocks: setup.php batch 3-4 (WIP checkpoint)

* Add PHPDoc blocks: setup.php batch 5 (WIP checkpoint)

* Add PHPDoc blocks: setup.php batch 6-7 (WIP checkpoint)

* Add PHPDoc blocks: setup.php complete

* Address review feedback and refresh translation template

- Fix thold_update_host_status() return type (int|null, since it
  falls through with no explicit return in the normal case)
- Fix @global $device_change_fields description in
  thold_config_arrays() (appends this plugin's fields, not unused)
- Fix @global $config description in thold_graph_button() (used to
  build the Create Threshold link's URL)
- Fix thold_data_source_action_prepare()/thold_graphs_action_prepare()
  return types (array|void; only the non-plugin_thold_create branch
  returns $save)
- Fix @global $timearray description in list_tholds() (used to render
  each baseline threshold's reference time range)
- Fix @global $thold_types description in thold_show_log() (used to
  render each log row's type column)
- Regenerate locales/po/cacti.pot (source line references only)
- Fix .gitignore pattern for compiled .mo files (locales/LC_MESSAGES/, not locales/po/)

* test(coverage): allowlist untestable entry points touched by PHPDoc pass

This PR only adds PHPDoc blocks (no functional changes), but touching every file in the plugin newly triggers the 'Enforce coverage of changed lines' CI gate for files that were never require()'d by any test before now:

- cli_import.php, cli_thresholds.php: CLI entry points (include cli_check.php / chdir + execute at the top level).

- poller_thold.php: poller entry point, same category.

- thold.php, thold_graph.php, thold_templates.php, notify_lists.php: authenticated web entry points (chdir + include(auth.php) at the top level), like notify_queue.php/thold_notify.php already allowlisted above.

- thold_daemon.php: daemon entry point, same category as thold_process.php already allowlisted above.

- includes/settings.php, includes/tab.php: Settings-page/header-tab-bar hook callbacks, only meaningful inside a live Cacti page render.

- thold_webapi.php: web-page action handlers that read \ and the database directly.

None of these can be require()'d into the isolated unit test process, matching the existing allowlist entries' precedent exactly. Verified locally: running patch-coverage.php against the PR's actual base ref confirms all 11 files are no longer reported as unexpected-unmeasured.

* docs: add PHPDoc blocks to remaining thold_functions.php functions

* chore: refresh translation template after PHPDoc line-number shifts
2026-09-25 12:30:04 -04:00
TheWitness 0f526404f7 Updating copyrights to 2026 (#740) 2026-02-14 14:16:33 -05:00
TheWitnessandCopilot 2d3b623d7a Updating workflow to include code validation PHP8.4 and MariaDB 10.6 (#739)
* Adding Worflows for code validation

* Apply php-cs-fixer rules

* Apply suggestion from @Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-02-06 06:59:30 -05:00
Petr Macek d43d679761 fix #721 - notification lists isn't visible (#738)
* fix #721 - notification lists isn't visible

* add missing column

* temporary disable check
2026-01-28 08:42:36 -05:00
TheWitness a7991dc6cf QA: Update Copyrights to 2025 2025-06-16 09:26:09 -04:00
TheWitness 9a60f8195e QA: Light repositioning 2025-01-27 21:32:19 -05:00
TheWitness 4aecc9e990 QA: Reposition form in Cacti 1.3 2025-01-12 13:31:54 -05:00
Petr Macek 974ca4e943 extend email replacement (#696)
* extend email replacement

* update
2024-09-23 10:13:26 -04:00
MSS 8338ae2423 Update settings.php missing 'description' key for 'thold_notification_delay' field (#681)
Update settings.php missing 'description' key for 'thold_notification_delay' field

'description' => __('Device Notification Delay Options', 'thold'),
2024-06-29 12:08:48 -04:00
TheWitness 4adcf96d1b Fixing #673, #678, and #677 - Single Email Notification Queue
* issue#673: Device up/down notification emails don't appear to be sent if the notification queue is enabled
* issue#674: Thold Current Value is incorrect in 1.8.1
* issue#678: Unable to remove suspended notifications one by one
* feature#677: Allow the Administrator to create a default Single Email Notification Subject
2024-06-20 18:02:47 -04:00
TheWitness 94905f3691 Fixing #664 - State Filter Issues Console and Top Tab
Inconsistent counts in thold tab and management -> thresholds
2024-04-06 14:35:24 -04:00
TheWitness c8b414d45a Fixing #655 & #666 - Time Based and Threshold Conditions
* Having to add a new log class as the warning behavior was ambiguous for both Time Based and High/Low based.
* Thresholds should be at or above or at or below not above or below.
2024-04-06 11:00:50 -04:00
TheWitness bba58e0045 QA: Holding off on notification delay for 1.8 2024-02-03 13:35:11 -05:00
TheWitness 4b14a89172 Allow Templates and Thresholds to have an External ID
feature: Allow Templates and Thresholds to include an External ID
2024-01-30 20:22:37 -05:00
Petr Macek c5844f4dd1 fix #650 - Consider Unknown Data as Zero" setting not working as expected (#652)
* fix #650 - Consider Unknown Data as Zero" setting not working as expected

* update

* add logging for Unknown data as zero
2024-01-27 14:46:07 -05:00
Linegod 1520ee1868 typos 2023-12-05 23:07:22 -06:00
TheWitness 887bcb64ad Remove redundant setting 2023-10-07 11:35:55 -04:00
TheWitness d6ee5e1236 Fixing #500 - Provide option to notify Warning list of Alerts
This is important in the model where the Warning list is for Administrators, and the Alert list is for Managers.  This way the Administrators can be also notified on Alerts.  There is a new checkbox option with the default of unchecked.
2023-08-05 09:57:23 -04:00
TheWitness d53222e82c QA: Tune Notification Delay
These changes simply make the settings delay a Cacti styled Multi-Select.
2023-07-30 10:00:24 -04:00
TheWitness c6501c1911 Starting #590 - Just the settings with some outstanding issues
Found that there is no good way to hook the settings page without a global JavaScript file.  Really need a hook at the bottom of the settings page.
2023-07-27 21:48:06 -04:00
TheWitness e4a511199a QA: Remove nofication daemon option add 'one email' option
- This is just pre-work for parallelization of notification which will be launched either by poller bottom, or through the thold daemon.
- The one Email is for the debouce feature as well as to combine down host notifications.
2023-07-25 20:35:45 -04:00
TheWitness b66b86a703 QA: Add Notify Queue UI
* Todo: Make suspension/resumption work
* Todo: Delete individual events
* Todo: Add Object Name as a column
* Todo: Add event_processing_time double to table
* Todo: Sort on name and filter by type Event Type, and Processed
2023-07-24 10:00:36 -04:00
TheWitness 2c81351fda Fixing #471 - Change Device Options for Thold
* New requirements will be Cacti 1.2.25
2023-07-23 10:01:59 -04:00
TheWitness a66dd38b97 Rearrange Settings for Notification Queue 2023-07-22 21:27:56 -04:00
TheWitness 21c921b888 Issue #435 - Notification Queue Implementation
This is the beginning of the notification queue.
It is not complete yet as the daemon and data collector must still be written.
Then the command line executor will have to be written as well.

Columns that have yet to be added include: environment, and process_id

It's likely that I will change the schema ever so slightly before I'm done as well.
2023-07-22 21:18:19 -04:00
TheWitness e184bf0ce4 Fixing #516 - Monitor Status does not belong in Thold
The Default Monitor Status setting belongs in the Monitor plugin.  Remove from Thold
2023-07-22 12:08:32 -04:00
TheWitness 3d67a5fe48 Allow thold id in notifications
feature: Add the Thold ID to the possible replacement value for notifications
2023-07-20 19:37:06 -04:00
TheWitness f98e067d5f Fixing #578 - Default Email Distro
Default setting for Threshold Up/Down Email Notification
2023-07-20 19:23:10 -04:00
TheWitness f531904a55 Feature: Site and Location to Device Notifications 2023-04-12 08:10:57 -04:00
netniV 4d9210e76b Update copyright for 2023 2023-01-04 22:31:06 +00:00
TheWitness 9e7443b3f0 Updating copyrights 2023-01-03 19:38:50 -05:00
TheWitness 33a1342835 Fixing Issue #542 and Copyright Years 2022-02-13 13:21:17 -05:00
TheWitness bded06c163 More logging, use json over serialize, new daemon debug option
This change should result in a functional daemon now.  It does the following:

* Uses JSON objects in the daemon data table instead of serialized objects
* Implements a new daemon debug option
* Renaming come functions to support daemon debug
* Instrumenting the thold_process.php script to add logging
* Correct some timestamp issues that were preventing processing
2021-08-28 15:13:43 -04:00
TheWitness 447345aa0e Thold daemon enhancement for testing by others
This patch requires that you restart your thold daemon.  There are table changes, and the minimum cacti release is 1.2.17.  Also, there is a lib/poller.php fix that needs to be implemented.
2021-08-27 23:49:46 -04:00
browniebraun 5ba68290fe implement #481
- move definition of SNMP event description to template as well as thold setup and drop global setting.
- increase version number to be in line with log
2021-01-12 23:26:26 +01:00
TheWitness c7b04dea2e Testing on command execution and form change 2020-09-13 14:24:58 -04:00
TheWitness fe93dfa281 Fixing Issue #304 - Notify Admin if Thold Daemon is Down 2020-09-13 11:55:25 -04:00
TheWitness ee4d99c412 Implementing Feature #372 - Allow Device Status Change Script Execution
This function implements the Device Status change script execution feature in addition to a few additional cleanups, and language changes:

* Change 'descriptors' to 'replacement tags'
* Change some logical arrangement code re-arrangements
* Properly report length at 1024 for Email/Notification bodies
* SQL Where cleanup in places
* Minor re-organization of settings page
2020-09-13 11:23:36 -04:00
TheWitness 1d2c24afd3 Fixing Issue #225 - Customize Thold Restore message 2020-09-12 19:15:47 -04:00
TheWitness 4c90181b49 Fixing Issue #366
When a value is undefined, Thresholds are no longer triggering when minimum is zero
2020-09-12 13:14:05 -04:00
TheWitness 7fc9def1e4 Light QA work on pull request #429, bumping version 2020-09-12 11:35:48 -04:00
Susanin63andTheWitness 05b4751fb9 Add new per host config thold_failure_count (#429)
* Add new per host config thold_failure_count

* Change value to a drop_array instead of a textbox.

* Update settings.php

* Update polling.php

* Update polling.php

* Update polling.php

* Update polling.php

* Update polling.php

Co-authored-by: TheWitness <thewitness@cacti.net>
2020-09-12 11:11:13 -04:00
Susanin63 a0bf376af0 Add HOST_ID template (#424) 2020-04-18 12:20:58 -04:00
Susanin63andSouth Park Neo cf98aff8e5 Add config - send each email separately (#414)
* Add config - send each email separately

* Update thold_functions.php

* Update thold_functions.php

Co-authored-by: South Park Neo <thewitness@cacti.net>
2020-04-16 19:42:47 -04:00
TheWitness d9e066b8b2 Minor update to support roles 2020-03-19 20:22:08 -04:00
TheWitness 2edce2ecdf Minor formatting issues 2020-03-13 18:46:45 -04:00
TheWitness 3eede02246 Correcting two additional bugs then re-release 2020-03-01 17:11:58 -05:00
netniV 2db7e7f61c Update copyright year and tweak service documentation 2020-02-15 09:56:40 +00:00
netniV a07df0846c Thresholds are not applying CDEF's correctly
Closes #361
2019-09-11 13:55:58 +00:00