Repository navigation
Update the README to match the code - #56
Open
somethingwithproof wants to merge 1 commit into
Open
somethingwithproof wants to merge 1 commit into
somethingwithproof wants to merge 1 commit into
Conversation
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description
The README describes the 2007 ExtJS plugin, not the code on
develop. This change makes each statement match the default branch as oforigin/develop(66b2cf3), without touching code. Statements that are wrong are corrected or removed, missing requirements and behaviour are added, and statements I could not check are left as they were and listed below.The largest corrections:
js/npc.js), not ExtJS, and it has seven screens. The context menus, drag and drop columns, portlets, graph icons, toggling of check marks, per user layouts and the N2C import screen that the README described do not exist.npc.phpdoes not loadcontrollers/controller.php, so every page request fails withClass "Controller" not found, and Cacti then disables the plugin. The README now says so in a Status section. The hardening PR (Harden the NPC controllers and fix review findings #54) fixes it; when that merges, the Status section should be removed.Related Issue
No open issue.
Scope and risk
README.mdand a CHANGELOG line.INFOandmanifest.jsonwere checked and are correct (below), so they are unchanged. No code is touched.perfdata.phpdescribes defects that exist today. If the defects are fixed first, those sentences have to be removed with the fix; the hardening PR fixes most of them and the README then needs a follow-up edit.Rollback
Revert the commit.
How the claims were verified
All runs used the code of
origin/developwith this README. Environment: PHP 8.4, MariaDB 11.8.9 in a throwaway container, Cacti 1.2.32 (the 1.2.x branch) with its own dependencies for the web checks (a second Cacti 1.3.0 tree for the test run), PHP's built-in web server, and a logged-in test user holding the realms needed for each page. "Read" means I read the code; "ran" means I executed it.INFO:compat = 1.2.1;.github/workflows/plugin-ci-workflow.yml:38CACTI: 1.2.x. Nothing in the repository shows 1.2.1 itself being tested; only 1.2.x is.tests/Security/PhpCompatibilityTest.php:27-28(floor 8.2), workflowmatrix php: ['8.2', '8.3', '8.4'](line 52). I could not run PHP 8.2 here; the floor is the one the repository states.mb_,curl_,iconv,xml,gd,ldap,snmp,gmp,openssl,intlcalls outsidetests/; the only process call isexec()incontrollers/sync.php:77.phpin the web user's PATH for the host import (new)controllers/sync.php:77exec('php ' . $path ...).includes/database.phpfollow the NDOUtils layout with thenpc_prefix.memory_limitmay be too lowgit clone https://github.com/Cacti/plugin_npc.git npcintopluginsgit remote -vshowsCacti/plugin_npc; the directory name must benpcbecausesetup.php:58readsplugins/npc/INFO(clarified in the text).Configuration > Plugins(lib/plugins.php:1564of Cacti); the row is named "Npc", described as "Nagios Plugin for Cacti", with the icons "Install Plugin" or "Enable Plugin" and "Uninstall Plugin" and the status "Installed". The README said "link".plugin_manage.php --install --enable(new)php cli/plugin_manage.php --plugin=npc --installprinted "installed successfully",plugin_config.status4 (Installed);--enableset it to 1 and all eight hooks to status 1.npc_%tables ininformation_schema,host.npc_host_object_id int(11),plugin_realmsrowsnpc.php"NPC" andnpc1.php"NPC Global Commands",settingsrowsnpc_date_format=Y-m-d,npc_time_format=H:i,npc_log_level=0.includes/database.php:44,:69-71,setup.php:66-67.--disablethen--uninstallleft 0npc_%tables, nonpc_host_object_idcolumn, 0 realms, 0npc_%settings, noplugin_configrow (setup.php:102-170). Reinstall with--install --enableworked.controllers/nagios.php:172checksnpc1.phpbefore any command. Read:user_admin.phpof Cacti 1.2.32 has the tab "Permissions" listing the realms under Console > Configuration > Users.settings.php?tab=npcshows the tab "NPC" with ten fields.controllers/nagios.php:156.nagioscmd.php:1681-1688requires the file to exist and be readable and writable.npcConfig(controllers/layout.php:49);js/npc.jsreads onlycsrfToken,npcUrl,userName,portletRefreshandcurrentTab(grep -o 'cfg\.\w*' js/npc.js). There is no Nagios link or iframe.Y-m-d; the stored default timeH:iis not one of the options. Read: the settings are only used bycontrollers/nagios.php:316(Process Info) and by detail formatters that no screen calls.js/npc.js:62interval || cfg.portletRefresh || 60, no minimum.controllers/controller.php:252and theconfig_type = ?conditions in the host and service queries.npcConfigand no code uses them.controllers/controller.php:400-416logs to the Cacti log with componentNPC.js/npc.js:4"jQuery UI frontend replacing ExtJS 2.2";tests/Security/NoExtJSDependencyTest.php.controllers/layout.php:18-26lists seven tabs. No code injs/calls thesyncorsettingsmodules.js/npc.js:25-30$.getJSON; tab links are normal links (controllers/layout.php:34), so a tab change loads a page. Auto refresh only for Hosts (js/npc.js:237), Services (:298) and Event Log (:390).js/npc.js; details open on a single click of the name (:226,:287), commands from a gear icon (:220,:231), a comment is deleted by the cross (:315,:332).controllers/controller.phpvar $limit = 25andjs/npc.jssends nostartorlimit.js/npc.js:498-590);nagioscmd.phprequiressticky,notify,persistent, times and so on for Acknowledge, Add Comment, Schedule Downtime and Schedule Check. Ran a script that extracts the required parameters fromnagioscmd.php. I could not send a command through the page because of the fatal error below.npc.phpin Cacti 1.2.32 returnedFatal error: Uncaught Error: Class "Controller" not found in controllers/layout.php on line 3;plugin_config.statuswent from 1 to 4 andcacti.logshows "ERRORS DETECTED - DISABLING PLUGIN 'npc'". Nothing requirescontrollers/controller.phpexceptconfig.php(grep -rn controller.php).settings.php?tab=npcrenders;host.php?action=editshows "Nagios Host Mapping"; the scripts below ran.index.phpcontains the link toplugins/npc/npc.php. The graph view header did not show one.plugin_config.versionto 3.0 and openedsettings.php?tab=npc. The version became 3.1,npc_settingswas reset and re-seeded, and the plugin directory losttests/andphpunit.xml.setup.php:349-369,npc_prune_files()atsetup.php:531. The same run logged an SQL error for the tablenpc_contracts(a typo fornpc_contactsinnpc_upgrade_tables()), which the hardening PR fixes.perfdata.phpcan be polled by Cacti (old text)php perfdata.php --type=service --id=777printedload1:0.52 load5:0.40 :(newest check);--type=service --host=web1 --service=Loadthe same;--type=host --id=778printed the oldest of two stored checks.cli.php:34-86,perfdata.php:27-60. Ran each without arguments and with--list-hosts,--list-hostgroups,--list-services,--perfdata,--perf-history. The usage text of both names--datasource, which neither parses;--dsis read into$dsand never used (grep -n '\$ds\b').db_prefix=npc_value matches the table names..github/copilot-instructions.mdsays Weblate owns the.poand.mofiles and a PR stages onlycacti.pot. Ranlocales/build_gettext.shin a copy: it works throughxgettext,msgmergeandmsgfmt, readsinclude/cacti_version(absent in the plugin directory, so the package version stays empty, as in the committedcacti.pot), and thesed -icalls fail with the BSDsedof macOS (observed), so GNUsedis listed.include/vendor/bin/pest --configuration=plugins/npc/phpunit.xml --coverage-clover=plugins/npc/coverage/clover.xml: 98 passed, 1 skipped.php tests/bin/patch-coverage.php coverage/clover.xml origin/develop 100: "no measured lines changed", exit 0.php tests/bin/check-i18n-pot.php origin/develop: no changes detected, exit 0.php tests/bin/validate-manifest.php: matches, exit 0. The.cacti-versionrule istests/bootstrap-unit.php:65.INFO(name,version = 3.1,compat = 1.2.1) andmanifest.jsonvalidate-manifest.phppasses;CHANGELOG.mdhas--- 3.1 ---below--- develop ---; Cacti listed version 3.1 and name "Nagios Plugin for Cacti". Thecapabilitiesline was not checked.Not checked: the NDOUtils and Nagios versions, the
memory_limitadvice, the Nagios configuration values, and thecapabilitiesentry inINFO. They are unchanged.Test run against both core refs
The README is the only changed file, so the code results are the same as
origin/develop. In CI order (plugin install withphp cli/plugin_manage.php --plugin=npc --install --enable,php -lon every PHP file, Pest with coverage, patch coverage, translation template check, manifest check,cacti.loggrep):php -lcacti.loggrep--uninstallstep of my simulation, which the workflow does not runI did not run PHP 8.2 or 8.3 or a fresh
composer installof the 1.2.x dependencies; the Pest version comes from the develop lock file.Types of changes
Documentation only.
Checklist: