Files
Cactidocumentation/Data-Input-Methods.md
Thomas Vincent cb29d10426 docs: fix stale version requirements and dead/insecure links (#208)
* docs: update stale PHP/MySQL/MariaDB version requirements

- Requirements.md: PHP 5.4 -> 8.1 (matches 1.2.31+ requirement note)
- Requirements.md: MySQL 5.6 -> 5.7, MariaDB 5.5 -> 10.2 (current minimums)
- Requirements.md: MySQL section header updated to >= 5.7 / 10.2
- Requirements.md, Install-Under-CentOS_LAMP.md,
  Install-Under-CentOS_LEMP.md, Installing-Under-Windows.md:
  comment out innodb_file_format and innodb_large_prefix (removed
  in MySQL 8.0 / MariaDB 10.3+)

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

* docs: upgrade http:// links to https:// and fix dead wiki URLs

- Upgrade http:// to https:// in 8 files:
  General-Installing-Instructions.md, Graph-Templates.md,
  How-To-SSH-Tunnels.md, Plugin-Development.md,
  Standards-Code-Formatting.md, Templates.md,
  Upgrading-Cacti-Under-Windows.md
- Replace two dead docs.cacti.net wiki links:
  How-To-SSH-Tunnels.md: old wiki SNMP guide -> Net-SNMP man page
  Plugin-Syslog.md: dead plugin:syslog.config -> plugin_syslog repo

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

* docs: fix technically inaccurate MySQL configuration recommendations

- innodb_additional_mem_pool_size: removed in MySQL 5.7.4 / MariaDB 10.0;
  replaced with removal notice in Requirements.md and comments in
  Install-Under-CentOS_LAMP.md and Install-Under-CentOS_LEMP.md
- max_heap_table_size: clarify ">= 5" means ">= 5% of system RAM"
- innodb_buffer_pool_size: clarify ">= 25" means ">= 25% of system RAM"

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

* docs: add missing required PHP extensions to Requirements.md

Add dom, mysqlnd, pcntl, Phar, and sqlite3 — all declared as required
in composer.json but absent from the module list. pcntl is Linux-only
(process control for the poller).

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

* docs: fix 36 spelling errors across 19 documentation files

Corrections detected by codespell:
- somone->someone, Walkthough->Walkthrough, GUAGE->GAUGE
- asociate->associate, messege->message, therefor->therefore
- get's->gets, Proxys->Proxies, paralelisation->parallelization
- parms->params (6 instances in script data query examples)
- finialise->finalise, buildin->built-in, everytime->every time
- Unistall->Uninstall, resiliant->resilient, build-in->built-in
- requriments->requirements (2 instances), explanitory->explanatory (3 instances)
- fro->for, invole->involve, reulting->resulting
- stauts->status, tge->the

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

* ci: add codespell spelling check workflow for documentation

Adds GitHub Actions workflow that runs codespell==2.4.1 on all Markdown
files on every push/PR to main. Also adds .codespell.cfg to skip binary
and generated files (JSON, shell scripts, HTML, images).

Update .gitignore to allow .github directory (was blocked by .git* glob).

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

* docs: improve voice, consistency, and note formatting across 10 files

- Convert passive/impersonal constructions to active voice
- Standardize NOTE -> Note in blockquotes for consistency
- Reformat inline IMPORTANT/Note callouts as blockquotes
- Fix awkward phrasing in LXC container notes
- Consolidate fragmented note bullets into single blockquote

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

* docs: fix technical accuracy and correct typos across 10 files

- Requirements.md: clarify Composer is for source/develop installs only;
  RRDtool minimum updated to 1.5+ (1.8+ for 1.3.x); php-snmp section
  rewritten to describe selective fallback behavior; SELinux/AppArmor
  advice reworded to recommend policy exceptions over blanket disable
- Spine.md: fix PHP Script Server range (10 -> 15); fix 'senstivive'
  and 'Davices' typos
- Trees.md: fix broken table rows split across lines; 'Sporting' -> 'Sorting'
- Data-Sources.md: restructure storage table to standard 3-column layout;
  fix '19b' unit typo -> '19kb'
- How-To-SNMP-Custom-Script.md: convert bold/backtick commands to proper
  fenced code blocks; fix 'intex' and 'BNSMPD' typos
- Plugins.md: fix 'onfiguration' typo; fix YouTube thumbnail http -> https;
  fix 'Tuturial' typo
- Standards-Security.md: fix 'invalidate' -> 'invalid'
- template_apache_config.md: fix 'apcache2' -> 'apache2'
- device-template-specific-proxmox.md: replace service file edit with
  drop-in approach; remove ProtectSystem=off/ProtectHome=off; add note
  on minimal required systemd overrides
- resource/xml/query_interface_traffic.php: http -> https URL

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

* docs: rename CentOS install guides to Enterprise Linux; fix grammar, logic, and security flaws

- Rename Install-Under-CentOS_LAMP.md → Install-Under-Enterprise-Linux-LAMP.md
- Rename Install-Under-CentOS_LEMP.md → Install-Under-Enterprise-Linux-LEMP.md
- Update README.md ToC links to match new filenames and correct labels

LAMP fixes:
- Title updated to reflect RHEL/Rocky Linux/AlmaLinux coverage
- Fix step numbering: "2.Install" / "3.Enable" missing space after number
- Spine build deps: restructure for EL7/EL8/EL9+ separately; EL8 was
  missing package install after repo enable; EL9+ uses 'crb' not 'powertools'
- SELinux URL: fix quadruple-slash typo; switch to English wiki URL

LEMP fixes:
- Title: "CentOS 7" → "Enterprise Linux (RHEL / Rocky Linux / AlmaLinux)"
- TLS: remove TLSv1 and TLSv1.1 (RFC 8996 prohibited, fails OpenSSL 3.x);
  set ssl_protocols TLSv1.2 TLSv1.3
- Ciphers: remove DH+3DES (Sweet32 / CVE-2016-2183)
- HTTP redirect: uncomment return 301 (comment claiming nginx lacks support
  for 'return' has been wrong since nginx 0.8 / 2009)
- PHP location block: fix 'alias' → 'root' (alias breaks $document_root in
  fastcgi_param SCRIPT_FILENAME); add missing semicolon after index directive
- Cron: poller path was /var/www/html/cacti but install target throughout
  this guide is /usr/share/nginx/html/cacti — align them
- DB: split GRANT...IDENTIFIED BY into CREATE USER + GRANT (IDENTIFIED BY
  on GRANT removed in MySQL 8.0 / MariaDB 10.5.2)
- Fix comment typo: "Compression increases performance0" → remove trailing 0
- SELinux URL: fix quadruple-slash typo

README.md:
- Update section 3.1 and 3.2 links to new filenames
- Correct labels from "CentOS 7" to "Enterprise Linux"
- Fix "Reports Admistrative Interface" → "Administrative"
- Fix "requriments" (×2) → "requirements"

* docs: remove Install-Under-CentOS_LAMP.md (superseded by Install-Under-Enterprise-Linux-LAMP.md)

* docs: remove Install-Under-CentOS_LEMP.md (superseded by Install-Under-Enterprise-Linux-LEMP.md)

* docs: update README ToC links and fix typos

- Update 3.1 and 3.2 links from CentOS to Enterprise Linux filenames
- Correct labels: "CentOS 7" → "Enterprise Linux (RHEL/Rocky/AlmaLinux)"
- Fix "Reports Admistrative" → "Reports Administrative"
- Fix "requriments" (×2) → "requirements"

* docs: fix grammar, logic, and technical errors in remaining install/upgrade guides

Installing-Under-Windows.md:
- Replace php_mysql.dll with php_pdo_mysql.dll (php_mysql removed in PHP 7.0)
- Remove IIS ISAPI steps referencing php8isapi.dll (ISAPI dropped in PHP 8.0);
  replace with FastCGI instructions via php-cgi.exe
- Remove NO_AUTO_CREATE_USER from sql_mode (removed MySQL 8.0, breaks startup)
- sort_buffer_size = 200M → 32M with caveat (per-session; 200M causes OOM under load)
- Fix step numbering gaps: main list 5→8, IIS 3→5, Finishing 5→8
- "you will have to user 8.3 notation" → "use"
- "c:cygwin" → "c:\cygwin" (missing backslash)
- "it's subfolders" → "its subfolders"
- "A anm example" → "An example"
- "verify/udate" → "verify/update"

Installing-Under-Ubuntu-Debian.md:
- Cron user: apache → www-data (apache user does not exist on Ubuntu/Debian)
- CREATE DATABASE: use utf8mb4 directly; remove redundant ALTER DATABASE
- php8.1-mbstring listed twice in apt-get install; deduplicated
- "may received" → "may receive"
- Note php8.1 is EOL; recommend checking current supported release

Upgrading-Cacti-Under-Windows.md:
- Fix all steps numbered 1. → proper sequential numbering (1–10)
- Remove hardcoded MySQL 5.7 path; use generic %MYSQL_HOME% note

Upgrading-Cacti-Under-FreeBSD.md:
- mysqldump: remove contradictory -l / --lock-tables=false flags;
  replace with --single-transaction (correct for InnoDB, no locking)

How-To-SSH-Tunnels.md:
- Add prominent note: SSH -L is TCP-only; standard SNMP uses UDP; this
  guide requires TCP transport configured on snmpd and does not work for
  most network devices
- Fix unclosed code fence after ssh-keygen output block
- Replace rc.local persistence with systemd unit (rc.local is deprecated
  and disabled by default on systemd distros: Ubuntu 16.04+, Debian 9+)
- ssh-keygen: recommend ed25519 over RSA

* docs: correct PHP 8.1 EOL date, Net-SNMP link, and grammar

PHP 8.1 security support ended 31 December 2025, not November 2024. Point the
snmpd.conf link at www.net-snmp.org (the sourceforge.io mirror is bot-blocked).
Fix 'There a two ways extending' to 'There are two ways to extend'.

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

* ci: fix spelling workflow trigger to target develop, not main

The repo's default branch is develop; main hasn't moved since 2023.
The workflow's push/pull_request filters targeted main, so it never
ran on any PR opened against develop.

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

---------

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
2026-08-16 20:34:31 +01:00

8.2 KiB

Data Input Methods

Data Input Methods allow Cacti to retrieve data to insert into RRDfiles based upon a mapping controlled by Data Templates and their corresponding Data Sources. These resulting Data Templates and Data Sources can then be used to create Graph Templates and Graphs.

Cacti includes a number of build in Data Input Methods for SNMP data and for Script, Script Server and SNMP Data Queries.

Outside of the built in Data Input Methods, the Cacti Administrator can create virtually any Data Input Method based upon a Script, or a PHP Script Server script. The Script based Data Input Method allows Cacti to virtually collect data from anywhere, though the built in SNMP and Script Server methods provide the greatest scalability in Cacti. Both Data Queries, and PHP Script Server topics will be covered in later sections of the documentation.

Creating a Data Input Method

To create a new Data Input Method, from the Cacti Console, select Data Collection > Data Input Methods. Once on that screen, click the plus (+) glyph on the right which will allow you to add a new Data Input Method. You will be presented with a few fields to populate on the following screen.

Table 11-1. Field Description: Data Input Methods
Name Description
Name Give the data query a name that you will use to identify it
Input Type Select the type of Data Input Method you are trying to create
Input String This field is only used when the Input Type is set to Script/Command

The Name specified will be used throughout Cacti to identify the human readable name given to the Data Input Method. Careful consideration should be made to help uniquely identify the Data Source. Having very similar names can lead to confusion when utilizing them as your Cacti system grows.

Valid options for Input Type are Script/Command, and Script Server. As mentioned previously, Cacti provides built in Data Input Methods for SNMP data gathering and for SNMP, Script, and Script Server based Data Queries. Though present in the Cacti database, they are hidden from user view.

When the type is set to Script/Command, the Input String specifies the full path to the script including any per Data Source input variables. Data Source input variables must be enclosed in greater than and less than characters. For instance, if you are passing an IP address to a script, your input string might look something like: /path/to/script.pl <ip> When the user creates a Data Source based on this Data Input Method, they will be prompted for an IP address to pass onto the script.

When you are finished filling in all necessary fields, click the Create button to continue. Upon saving the new Data Input Method, you will be presented with two new sections to complete. Those sections will instruct Cacti what to pass to the Script, known as Input Fields otherwise known as Input Parameters and how to handle the output data, which we refer to as Output Fields.

The Input Fields box is used to define any fields that require information from the user or from various data within the Cacti Database such as the hostname, ip address, host id, etc. Any input fields referenced to in the input string must be defined here.

The Output Fields box is used to define each field that you expect back from the script and will be eventually stored in both the database and RRDfiles.

All Data Input Methods must have at least one output field defined, but may have more than one depending on the type.

Data Input Fields

To define a new field, click the plus sign (+) next to the input or output field boxes. You will be presented with some or all of the fields below depending on whether you are adding an input or output field.

Table 11-2. Field Description: Data Input Fields
Name Description
Field/Field Name You will be presented a drop down list of the unused braced input fields from the command
Friendly Name Enter a more descriptive name for this field
Regular Expression Match (Input Only) Enter a valid regular expression as to how to modify the output
Allow Empty Input (Input Only) Can the input value of this field blank or not
Special Type Code (Input Only) Pull the input data from the Cacti database and don't prompt the user for this input value
Update RRDfile (Output Only) Checked if you intend this output data to be stored in an RRDfile

The Field Name must contain no spaces or other non-alphanumeric characters (except '-' or '_').

If you want to enforce a certain regular expression pattern when the user enters a value into Regular Expression Match (Input Only) for this Data Input Field, it must follow POSIX syntax as it will be passed to PHP's preg() functions.

If the Data Input Field needs to reference another field internally, you can enter this into the Special Type Code. For instance, if your field requires an IP address from the user, you can enter 'management_ip' here and Cacti will fill this field in with the current IP address of the selected host.

Table 11-3. Special Type Codes
Field Name Description
hostname The hostname
management_ip The ip
snmp_community The SNMP community
snmp_username The SNMP username
snmp_password The SNMP version

If you enable the Update RRDfile, Cacti will insert the return value from this field into the RRDfile. This box needs to be checked for at least one output field per data input source, but can be left blank to have Cacti store the value only in the database instead.

When you are finished filling in all necessary fields, click the Create button to continue. You will be redirected back to the Data Input Method edit page. From here you can continue to add additional fields, or click Save on this screen when finished.

Making Your Scripts Work With Cacti

The simplest way to extend Cacti's data gathering functionality is through external scripts. Cacti comes with a number of scripts out of the box which are located in the scripts/ directory. These scripts are used by the Data Input Methods that are present in a new installation of Cacti.

To have Cacti call an external script to gather data you must create a new Data Input Method, making sure to specify Script/Command for the Input Type field. See the previous section, Creating a Data Input Method for more information about how to create a Data Input Method. To gather data using your Data Input Method, Cacti simply executes the shell command specified in the Input String field. Because of this, you can have Cacti run any shell command or call any script which can be written in almost any language.

What Cacti is concerned with is the output of the script. When you define your Data Input Method, you are required to define one or more output fields. The number of output fields that you define here is important to your script's output. For a Data Input Method with only one output field, your script should output its value in the following format:

<numeric value>

So if I wrote a script that outputs the number of running processes, its output might look like the following:

67

Data Input Methods with more than one output field are handled a bit differently when writing scripts. Scripts that output more than one value should be formatted like the following:

<fieldname_1>:<value_1> <fieldname_2>:<value_2> ... <fieldname_n>:<value_n>

If you wrote a script that outputs the 1, 5, and 10 minute load average of a Unix machine and in Cacti named the output fields '1min', '5min', and '10min', the output of the script should look like the following:

1min:0.40 5min:0.32 10min:0.01

One last thing to keep in mind when writing scripts for Cacti is that they will be executed as the user the data gatherer runs as. Sometimes a script may work correctly when executed as root, but fails due to permissions problems when executed as a less privileged user.

Walkthrough

You can find a detailed example of how to create a complete Graph from simple command output in the following example How To Create a Data Input Method.


Copyright (c) 2004-2026 The Cacti Group