mirror of
https://github.com/Cacti/documentation.git
synced 2026-12-06 15:13:53 +09:00
* docs: [1.2.x] refresh the manual front page The front page opened with version notes before saying what Cacti is, used headings as sentences in the credits, and its table of contents listed seven sections while the page has ten. Open with a short description and a getting-started sequence, link the website and forums, give the credits real headings, and list every section in the table of contents in page order. Record Jeff Pasnak under In Memoriam with a link to the 1.2.31 release announcement. Correct label typos and wrap long entries with reference links. Existing section anchors are unchanged, and every page is still linked. Signed-off-by: Thomas Vincent <thomasvincent@gmail.com> * docs: [1.2.x] fix typos, unrendered headings and forum links A check of every page linked from the front page found misspellings in eleven pages, three Mactrack headings written without a space after the hashes, which render as plain text, and two forum links still using http. Correct the spellings, add the missing space so the headings render, and point the forum links at https, where they already redirect. Signed-off-by: Thomas Vincent <thomasvincent@gmail.com> * docs: [1.2.x] align the plugin pages with the plugin READMEs The supported plugins list and the Syslog and Mactrack pages had drifted from the README and INFO files in the plugin repositories. Update the descriptions that the READMEs contradict: Monitor's Thold requirement, the Router Configs transfer methods, the ReportIt release and Cacti versions, the WMI collection methods and its development status, and NUT support in Apcupsd. Add the Syslog requirements, the upgrade procedure, the dedicated database settings and the remote collector settings, and correct the database grant and a misplaced code fence. Add the Mactrack requirements and a short section on history partitioning and ignored ports that links to the README. Signed-off-by: Thomas Vincent <thomasvincent@gmail.com> * docs: [1.2.x] correct grammar, spelling and broken Markdown A read of every page linked from the front page found grammar and spelling errors throughout, and Markdown that does not render as intended. Correct grammar, spelling, punctuation and product-name capitalization in 95 pages without changing headings, code blocks, link targets or the meaning of the text. Repair the Markdown defects: a code fence in the SSH tunnel how-to that never closed, malformed bold markers in the user management and device defaults pages, a release notes table with no blank line before it, split rows in the tree sorting table, and LDAP list items missing their markers. Correct three interface labels quoted with typos. Signed-off-by: Thomas Vincent <thomasvincent@gmail.com> * docs: [1.2.x] correct statements that differ from the 1.2.x source Reviewers of the linked pages flagged statements that looked wrong. Each was compared with the Cacti 1.2.x source at 1523aa04b, and only those the source or the page itself settles are changed. Correct interface labels and option names (Index Count Changed, Permissive, Not Selected, Utilities, the BCC description, the gear icon for plugin install), the default Maximum Value of U for a new data source item, the sysDescr object name, the PHP floor wording in the requirements table, the Mactrack wildcard character and the snmptrapd -On option. Repair cross-references, example values that disagree with their commands, two table captions, a split list and several sentences with missing words. Statements the source does not settle are left as written. Signed-off-by: Thomas Vincent <thomasvincent@gmail.com> --------- Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
187 lines
5.7 KiB
Markdown
187 lines
5.7 KiB
Markdown
# File System Layout
|
|
|
|
It is important that files are well placed and named within Cacti's directory
|
|
structure. The naming structure may contain a **category token** and/or an
|
|
**action**.
|
|
|
|
## Token
|
|
|
|
Under each category directory, functions should be broken out into multiple
|
|
files where applicable. All files must begin with the name of the category
|
|
(i.e., its parent directory name). Valid token names are
|
|
|
|
* auth
|
|
* automation
|
|
* color_template
|
|
* data_input
|
|
* data_query
|
|
* data_source
|
|
* data_source_profile
|
|
* data_template
|
|
* device (rename from host)
|
|
* device_template
|
|
* event (if we have event management in core)
|
|
* graph
|
|
* graph_template
|
|
* graph_tree
|
|
* package
|
|
* plugin
|
|
* poller
|
|
* preset (colors, cdefs, vdefs, gprints, etc)
|
|
* site
|
|
* user
|
|
|
|
## Actions
|
|
|
|
This part should reflect what type of actions the file contains. Specific
|
|
examples are listed below.
|
|
|
|
* info - reads information
|
|
* update - writes (or changes) information
|
|
* form - draws form-related information
|
|
* execute - performs some action that does not modify or return information
|
|
* utility - contains miscellaneous functions
|
|
|
|
## Function Verbs
|
|
|
|
Functions in those PHP modules shall name their token and shall contain a verb
|
|
to explain the purpose. Specific examples are listed below.
|
|
|
|
* list
|
|
* get
|
|
* save
|
|
* copy
|
|
* clear
|
|
* remove
|
|
* update
|
|
|
|
## Directory Structure
|
|
|
|
### cli/
|
|
|
|
`[token]_[action].php`
|
|
|
|
### images/
|
|
|
|
* icons/ # 16x16, 32x32 icons
|
|
* buttons/ # button images (save, cancel, etc)
|
|
* tabs/ # tab images
|
|
|
|
### include/
|
|
|
|
Code that must be accessed globally but is not contained inside of a function
|
|
should be stored in the `include/` directory. The most common examples are to
|
|
store globally accessible constants and arrays.
|
|
|
|
Directly under the `include/` directory, the files beginning with `global` are
|
|
used to store information that is accessible everywhere in the code. Only store
|
|
information in these files that are meaningful to the entire program. Also
|
|
under the `include/` directory is a directory for each category (graph, device,
|
|
etc), where information specific to that category is to be stored.
|
|
|
|
Constants that are made available to everyone in the program
|
|
|
|
```console
|
|
include/global_constants.php
|
|
```
|
|
|
|
Arrays that are only used with graphs
|
|
|
|
```console
|
|
include/graph_arrays.php
|
|
```
|
|
|
|
```console
|
|
content/
|
|
fa/ # FontAwesome files
|
|
js/ # javascript files
|
|
themes/[theme]/ # Visual theme files
|
|
vendor/
|
|
csrf/ # CSRF Magic
|
|
flag-icons/ # Flag Icons
|
|
phpgettext/ # PHP GetText Library
|
|
phpmailer/ # PHP Mailer Library
|
|
phpseclib/ # PHP Security Library
|
|
```
|
|
|
|
```console
|
|
auth.php # Ensures user authenticate and
|
|
# includes global.php
|
|
cacti_version
|
|
cli_check.php # Default Command Line Include also
|
|
# includes global.php
|
|
global_arrays.php
|
|
global_constants.php # Constants only
|
|
global_form.php # Form field definitions
|
|
global_languages.php # Language selector
|
|
global.php
|
|
global_session.php # Session variable management
|
|
global_settings.php # Setting definitions
|
|
session.php # Session management
|
|
|
|
plugins.php # Global plugin variables
|
|
|
|
bottom_footer.php # Standard Footer
|
|
top_general_header.php
|
|
top_graph_header.php
|
|
top_header.php
|
|
|
|
layout.js # Main layout javascript
|
|
realtime.js # Realtime javascript functions
|
|
```
|
|
|
|
### lib/
|
|
|
|
Functions that must be accessed globally should be stored in the `lib/`
|
|
directory. This is where most of the heavy lifting in Cacti occurs.
|
|
|
|
Directly under the `lib/` directory, the files beginning with the `api`
|
|
prefix are core Cacti APIs that are only to be used by third party
|
|
developers and should NEVER include a call to a
|
|
`$_REQUEST`, `$_POST`, or `$_GET` variable.
|
|
|
|
Files that have the `html` prefix, generally involve the rendering of page
|
|
content, for example the `html_form.php` library draws forms and
|
|
`html_validate.php` includes functions to validate page variables. There
|
|
are other various files in the current Cacti `lib/` directory that will
|
|
over time be changing with the migration to the next major version of
|
|
Cacti. So, these rules may change over time.
|
|
|
|
Here is the core API for the Cacti `graphs.php` page, and that deals with
|
|
the manipulation of **Graphs**.
|
|
|
|
```console
|
|
lib/api_graph.php
|
|
```
|
|
|
|
### locales/
|
|
|
|
Language-related files are stored here to handle the multi-lingual nature of
|
|
Cacti. These can be updated by running the `update-pot.sh` script. It is
|
|
advised to do this whenever you are submitting a change to Cacti via Pull
|
|
Request. Otherwise, language translations can be missed.
|
|
|
|
### plugins/
|
|
|
|
Directly under the `plugins/` directory are sub directories that contain
|
|
plugins for Cacti. Since Cacti 1.0.0, all plugins must have an accompanying
|
|
INFO file that details the plugin.
|
|
|
|
## Including and Requiring Files
|
|
|
|
To reduce bloat, each file and/or function should include any and all files
|
|
which it relies on.
|
|
|
|
The following function directly relies on the libraries related to sequences and
|
|
reading graph information. The `require_once` directive is used instead of
|
|
`require` to prevent PHP re-declaration errors.
|
|
|
|
```php
|
|
function api_graph_item_save($graph_item_id, &$_fields_graph_item) {
|
|
require_once(CACTI_BASE_PATH . '/lib/sys/sequence.php');
|
|
require_once(CACTI_BASE_PATH . '/lib/graph/graph_info.php');
|
|
```
|
|
|
|
---
|
|
Copyright (c) 2004-2026 The Cacti Group
|