Repository navigation
feat: ship the DigitalOcean Cacti templates and import them on install - #84
Merged
Merged
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 29 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
This was referenced Nov 15, 2026
The catalog now names its graphs: each metric and each resource type's collection age sits in exactly one graph. tests/bin/generate-templates.php turns that into Cacti template XML laid out like Cacti's own export: a "Cloud: DigitalOcean Scope" device template, a script server data query per resource type, and a data template and graph template per graph, so a graph's data source holds only its own metrics (ADR 0005). Every hash is fixed, so a re-import updates the objects it created. Install and upgrade copy the data query definitions into <path_cacti>/resource/script_server, where Cacti 1.2 requires them, and import the package under a lock when it changed or an object is missing. A failed import is logged and does not hold back the install. Unit tests compare the shipped XML with the generator's output and check the installer's decisions. Integration tests import into a real Cacti and show a re-import adds no rows and a deleted graph template is restored. Closes #42 Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Cacti needs 32 hex digits to identify a template object; the first 32 of a SHA-256 over the fixed key serve as well as an MD5 and avoid a weak hash algorithm, which SonarQube Cloud flags regardless of use. The templates are regenerated; nothing has shipped with the old hashes. Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
somethingwithproof
force-pushed
the
feat/m3-templates
branch
from
November 15, 2026 12:46
a1666ea to
6855265
Compare
|
2 tasks
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.



Stacked on #82: the base is
feat/m3-digitalocean. I'll retarget it tomainonce #82 merges.Closes #42
What ships
The catalog names its graphs.
DigitalOceanCatalog::GRAPHSputs every metric, and each resource type's collectionage(ADR 0006), in exactly one graph: 5 for Droplets and 10 for load balancers.tests/bin/generate-templates.phpturns that intotemplates/cloud_digitalocean.xml, laid out like Cacti's own export. The package contains:A graph's data source holds only that graph's metrics, so creating a CPU graph doesn't start collecting bandwidth or the agent-only metrics (ADR 0005). Every hash is fixed: the first 32 hex digits of a SHA-256 over a fixed key.
templates/resource/*.xmlare the data query definitions, pointing atss_cloud()inss_cloud.php. That script server function is Script server input for cloud data sources #44; until it exists, no graphs can be created. Scope devices and resource data queries #43 adds the scope devices.Install and upgrade
Templates::install()takes a lock, so two processes never import at once.<path_cacti>/resource/script_server/. Cacti 1.2 refuses data query XML outside<path_cacti>/resource. Each copy is written to a temporary file and renamed into place, and a link at the target is replaced rather than written through.import_xml_data()signals failure through its return value, the global$import_messages, and per-object results, so all three are checked. That check lives insetup.php, becauselib/may not read globals.Testing