mirror of
https://github.com/Cacti/documentation.git
synced 2026-10-24 12:07:19 +09:00
* docs: comprehensive audit, Spine poller overhaul, and technical refactor - Overhaul Spine documentation (Spine.md) with complete end-to-end guide: architecture, prerequisites for modern distros (EL8/9 CRB, Ubuntu 22/24, Debian 11/12, FreeBSD), SUID root permissions, secure spine.conf setup (0640), Web UI configuration (Paths, Poller type, Data Collectors tuning), MySQL max_connections sizing, and troubleshooting. - Fix broken links and anchors (Hardening, SNMP data queries, Hook API references). - Fix broken image reference in Sites.md (add-site.JPG -> add-site.png). - Fix syntax errors in documentation PHP code blocks, including invalid parenthesization, missing SQL execute quotes, and malformed comments in FAQ. - Fix DevOps installation commands: use config.php.dist, correct systemctl service names for MySQL/MariaDB/PHP-FPM, remove nonexistent php-json, add missing composer install, and correct Debian/Ubuntu systemd environment path. - Correct grammatical errors, repeated words, and typos across all markdown documents. - Remove obsolete unreferenced duplicate installation guides. Signed-off-by: Thomas Vincent <thomasvincent@gmail.com> * docs: correct reviewed examples and guidance Signed-off-by: Thomas Vincent <thomasvincent@gmail.com> * docs: correct guidance that disagrees with the Cacti source Verified each claim against include/global_arrays.php, lib/auth.php, lib/functions.php, host_templates.php and the Spine config parser. The notable ones: api_plugin_safe_exec() does not exist on either branch, Spine reads DB_Pass rather than DB_Password, and the CDEF special data source table was missing five entries and renamed four others. Signed-off-by: Thomas Vincent <thomasvincent@gmail.com> * docs: wrap Spine prose and fence the connection sizing formula The formula's bare asterisks rendered as emphasis, dropping the multiplication signs. Signed-off-by: Thomas Vincent <thomasvincent@gmail.com> * chore: refresh copyright year in scripts and issue templates Signed-off-by: Thomas Vincent <thomasvincent@gmail.com> --------- Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
145 lines
4.7 KiB
Markdown
145 lines
4.7 KiB
Markdown
# Reference Plugins
|
|
|
|
This guide outlines the architecture and standard conventions for reference plugins in Cacti.
|
|
|
|
The Reference Plugin(s) are generic plugins that implement key pieces of the
|
|
Plugin Architecture.
|
|
|
|
They are broken down into several separate plugins, each covering different
|
|
portions of the [Hook API Reference](Plugin-Hook-API-Ref.md)
|
|
|
|
## Standard Files
|
|
|
|
The following files should be included in every plugin
|
|
|
|
* CHANGELOG
|
|
* INFO
|
|
* LICENSE
|
|
* index.php
|
|
* README.md
|
|
* setup.php
|
|
|
|
In general, the index.php file example below should be included in every plugin
|
|
directory as it prevents remote file browsing of your Cacti site.
|
|
|
|
```php
|
|
<?php
|
|
|
|
/*
|
|
+-------------------------------------------------------------------------+
|
|
| Copyright (C) 2004-2026 The Cacti Group |
|
|
| |
|
|
| This program is free software; you can redistribute it and/or |
|
|
| modify it under the terms of the GNU General Public License |
|
|
| as published by the Free Software Foundation; either version 2 |
|
|
| of the License, or (at your option) any later version. |
|
|
| |
|
|
| This program is distributed in the hope that it will be useful, |
|
|
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
|
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
|
| GNU General Public License for more details. |
|
|
+-------------------------------------------------------------------------+
|
|
| Cacti: The Complete RRDtool-based Graphing Solution |
|
|
+-------------------------------------------------------------------------+
|
|
| This code is designed, written, and maintained by the Cacti Group. See |
|
|
| about.php and/or the AUTHORS file for specific developer information. |
|
|
+-------------------------------------------------------------------------+
|
|
| https://www.cacti.net/ |
|
|
+-------------------------------------------------------------------------+
|
|
*/
|
|
|
|
header("Location:../index.php");
|
|
|
|
?>
|
|
```
|
|
|
|
## File Structure
|
|
|
|
All plugin files should reside under their own respective plugin directory. The
|
|
example below is for a plugin called 'myplugin'.
|
|
|
|
```console
|
|
myplugin/
|
|
images/
|
|
myimage.png
|
|
index.php
|
|
lib/
|
|
index.php
|
|
functions.php
|
|
include/
|
|
index.php
|
|
settings.php
|
|
CHANGELOG
|
|
INFO
|
|
LICENSE
|
|
README.md
|
|
index.php
|
|
setup.php
|
|
```
|
|
|
|
## Contents of Files
|
|
|
|
The four core sub-directories included in your plugin should be docs, images,
|
|
lib, and include. As previously mentioned, each of these directories should
|
|
include an index.php that points to it's parent directory index.php. This way
|
|
we prevent people from randomly browsing the contents of our web site.
|
|
|
|
The two main files required for every plugin are the INFO and the setup.php
|
|
file. Without these two files, the plugin directory will not be recognized as a
|
|
valid plugin and will be skipped.
|
|
|
|
The INFO file is formatted as Microsoft standard INI file. It contains
|
|
information about the plugin including its version, author, dependencies,
|
|
functions, and minimum version of Cacti and other plugins required. Below, you
|
|
can see a reference INFO file for the myplugin plugin.
|
|
|
|
```console
|
|
[info]
|
|
name = mplugin
|
|
version = 1.0
|
|
longname = My First Plugin
|
|
author = Depeche Mode
|
|
email = somewhere@outthere.com
|
|
homepage = http://www.outthere.com
|
|
compat = 1.2
|
|
requires = thold monitor
|
|
capabilities = online_view:1, online_mgmt:1, offline_view:0, offline_mgmt:0, remote_collect:0
|
|
```
|
|
|
|
The setup file includes key plugin functions that allow the plugin to be
|
|
installed, uninstalled, upgraded, etc. Those core functions include:
|
|
|
|
```php
|
|
<?php
|
|
function plugin_myplugin_install() {
|
|
}
|
|
|
|
function plugin_myplugin_uninstall() {
|
|
}
|
|
|
|
function plugin_myplugin_check_config() {
|
|
}
|
|
|
|
function plugin_myplugin_upgrade() {
|
|
}
|
|
|
|
function plugin_myplugin_version() {
|
|
}
|
|
|
|
?>
|
|
```
|
|
|
|
Without these core functions, in your setup.php, your plugin will not fully
|
|
operate. We will document those functions and what they should include as we
|
|
continue to document the plugin design principals.
|
|
|
|
Any core plugin functions should always be placed in the lib/functions.php file,
|
|
and settings should go into the include/settings.php file. The plugin
|
|
architecture allows hooks to be defined that reach into the include/settings.php
|
|
file. Having those hooks point to the include version of the file will keep
|
|
Cacti page loads fast. Including too much in the setup.php slows Cacti and
|
|
should be avoided.
|
|
|
|
---
|
|
Copyright (c) 2004-2026 The Cacti Group
|