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
364 changes: 183 additions & 181 deletions .github/copilot-instructions.md

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions .github/workflows/plugin-ci-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ jobs:
- name: Check PHP version
run: php -v

- name: Validate plugin manifest (expected-file drift)
run: php cacti/plugins/thold/tests/bin/validate-manifest.php

- name: Run apt-get update
run: sudo apt-get update

Expand Down
24 changes: 0 additions & 24 deletions .mdlrc

This file was deleted.

2 changes: 1 addition & 1 deletion INFO
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ longname = Thresholds
author = The Cacti Group
email =
homepage = http://www.cacti.net
compat = 1.2.25
compat = 1.2.29
Comment thread
TheWitness marked this conversation as resolved.
capabilities = online_view:1, online_mgmt:1, offline_view:0, offline_mgmt:0, remote_collect:1
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,12 @@ thresholds, note that you must modify and install the thold_daemon.service file
into your systemd configuration, and then start and test the service. If you
fail to perform these steps, thold will appear to not work as expected.

When upgrading the plugin while the Threshold Daemon is running, restart the
`thold_daemon` service (for example `systemctl restart thold_daemon`) after
the upgrade so the long-lived process picks up the new code. On upgrade the
plugin also prunes its own bundled development-only files (for example the
`tests/` directory) from the installed tree.

Lastly, please note that several forks of the thold plugin are available from
different sources. These forks of thold are not necessarily compatible with the
current version of Cacti's thold plugin. Please be aware of this when
Expand Down
2 changes: 1 addition & 1 deletion cli_import.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

include(__DIR__ . '/../../include/cli_check.php');
include_once($config['base_path'] . '/lib/xml.php');
include_once($config['base_path'] . '/plugins/thold/thold_functions.php');
include_once($config['base_path'] . '/plugins/thold/includes/functions.php');

// set the defaults
$force = false;
Expand Down
2 changes: 1 addition & 1 deletion cli_thresholds.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

include('./include/cli_check.php');

include_once($config['base_path'] . '/plugins/thold/thold_functions.php');
include_once($config['base_path'] . '/plugins/thold/includes/functions.php');

// set the defaults
$force = false;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion includes/database.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function thold_upgrade_database($force = false) {
thold_setup_database();

include_once($config['base_path'] . '/plugins/thold/setup.php');
include_once($config['base_path'] . '/plugins/thold/thold_functions.php');
include_once($config['base_path'] . '/plugins/thold/includes/functions.php');

$v = plugin_thold_version();

Expand Down
4 changes: 2 additions & 2 deletions thold_functions.php → includes/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -482,12 +482,12 @@ function thold_rpn_math_binary($operator, $v2, $v1) {
case '/':
return $v2 / $v1;
case '%':
return $v2 % $v1;
return (int) $v2 % (int) $v1;
case '^':
// Bitwise XOR, not exponentiation: eval('$v3 = ' . $v2 . ' ^ ' . $v1 . ';')
// always computed XOR (PHP's ^ operator), and existing user thresholds
// rely on that. See TholdExpressionMathRpnTest::testCaretOperatorIsIntegerXorNotExponentiation.
return $v2 ^ $v1;
return (int) $v2 ^ (int) $v1;
default:
cacti_log("ERROR: RPN unknown binary operator '$operator'", false, 'THOLD');
$rpn_error = true;
Expand Down
6 changes: 3 additions & 3 deletions includes/polling.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ function thold_cleanup_log() {
function thold_poller_output(&$rrd_update_array) {
global $config, $debug;

include_once($config['base_path'] . '/plugins/thold/thold_functions.php');
include_once($config['base_path'] . '/plugins/thold/includes/functions.php');
include_once($config['library_path'] . '/snmp.php');

$rrd_reindexed = [];
Expand Down Expand Up @@ -338,7 +338,7 @@ function thold_check_all_thresholds() {
global $config;

include($config['base_path'] . '/plugins/thold/includes/arrays.php');
include_once($config['base_path'] . '/plugins/thold/thold_functions.php');
include_once($config['base_path'] . '/plugins/thold/includes/functions.php');
include_once($config['base_path'] . '/lib/time.php');

if (read_config_option('remote_storage_method') == 1) {
Expand Down Expand Up @@ -461,7 +461,7 @@ function thold_update_host_status() {
return 0;
}

include_once($config['base_path'] . '/plugins/thold/thold_functions.php');
include_once($config['base_path'] . '/plugins/thold/includes/functions.php');
include_once($config['library_path'] . '/snmp.php');

if (api_plugin_is_enabled('maint')) {
Expand Down
2 changes: 1 addition & 1 deletion includes/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ function thold_config_settings() {

include($config['base_path'] . '/plugins/thold/includes/arrays.php');
include_once($config['base_path'] . '/plugins/thold/setup.php');
include_once($config['base_path'] . '/plugins/thold/thold_functions.php');
include_once($config['base_path'] . '/plugins/thold/includes/functions.php');
include_once($config['base_path'] . '/plugins/thold/includes/database.php');

// check to see if there is an upgrade required
Expand Down
2 changes: 1 addition & 1 deletion thold_webapi.php → includes/webapi.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
function thold_add_graphs_action_execute() {
global $config;

include_once($config['base_path'] . '/plugins/thold/thold_functions.php');
include_once($config['base_path'] . '/plugins/thold/includes/functions.php');

$host_id = get_filter_request_var('host_id');
$local_graph_id = get_filter_request_var('local_graph_id');
Expand Down
Loading
Loading