From 24dbcb49927ab99e9a608ab8d0d738b4bf7bfec7 Mon Sep 17 00:00:00 2001 From: Thomas Vincent Date: Thu, 3 Dec 2026 00:10:21 -0800 Subject: [PATCH] docs: refresh the 1.2.x command-line script reference (#308) Signed-off-by: Thomas Vincent --- Command-Line-Scripts.md | 1383 +++++++-------------------------------- 1 file changed, 244 insertions(+), 1139 deletions(-) diff --git a/Command-Line-Scripts.md b/Command-Line-Scripts.md index 6c6a169..e5a55be 100644 --- a/Command-Line-Scripts.md +++ b/Command-Line-Scripts.md @@ -1,1339 +1,444 @@ # Command Line Scripts (CLI) -Cacti supports a number of command line scripts. You will find them in the -`./cli` directory. The CLI scripts fall into multiple categories; they include: +Run the examples from the `cli/` directory of your Cacti installation with +PHP CLI and access to that installation's configuration. For commands that +write RRD files, use the account that normally runs the poller. -- **Automation** - Utilities to help automate adding objects to Cacti -- **Maintenance** - Utilities to help keep Cacti healthy -- **Repair** - Utilities to help with repairing Cacti database components -- **Repair/Migration** - Utilities to help with repairing or migrating Cacti - components -- **Install/Upgrade** - Utilities to help with installing and upgrading Cacti - -In the table below, each of the CLI scripts is categorized and explained -briefly. +The examples use shell variables for installation-specific IDs. First run +the corresponding list command, then set the variable to the numeric ID +from your installation. For example, if the device you want is listed as +ID 11, run `device_id=11` in that shell. Identifiers for devices, templates, +graphs, queries, users, and tree nodes are separate. ## Automation Scripts -| Script | Category | Description | -| -------------------------- | ----------- | ----------------------------------------------------------------------------------------------- | -| add_device.php | Automation | Allows adding a Device to Cacti. Most device options are included. Some plugin options may not. | -| change_device.php | Automation | Allows editing device details such as IP/Poller association | -| add_data_query.php | Automation | Allows adding a Data Query to Cacti. | -| add_datasource.php | Automation | Allows adding a Data Source to a Device from a Data Template. | -| add_graph_template.php | Automation | Allows adding a Graph Template to Cacti. | -| add_graphs.php | Automation | Allows adding a Graph to Cacti. | -| add_perms.php | Automation | Allows adding permissions to Cacti. | -| add_tree.php | Automation | Allows adding trees, tree branches and objects to Cacti Trees. | -| apply_automation_rules.php | Automation | Executes Cacti automation rules for devices selected by id, hostname or description. | -| remove_device.php | Automation | Allows removing Devices selected by id, IP address or description. | -| plugin_manage.php | Automation | Allows installing, enabling, disabling and uninstalling plugins. | -| copy_user.php | Automation | Allows creating new users from Templates | +| Script | Purpose | +| --- | --- | +| `add_device.php` | Create a device and set its polling and SNMP options. | +| `change_device.php` | Change an existing device's settings. | +| `add_data_query.php` | Associate a data query with a device and set its reindex method. | +| `add_datasource.php` | Create a device data source from a data template. | +| `add_graph_template.php` | Associate a graph template with a device. | +| `add_graphs.php` | Create graphs from graph templates or indexed data queries. | +| `add_perms.php` | Add object permissions to a user's graph, device, tree, or template policy. | +| `add_tree.php` | Create trees and add headers, devices, or graphs to them. | +| `apply_automation_rules.php` | Apply automation rules to selected devices. | +| `remove_device.php` | Remove devices selected by ID, description, or IP address. | +| `plugin_manage.php` | Install, enable, disable, or uninstall plugins. | +| `copy_user.php` | Create a local user from another local account. | ## Maintenance Scripts -| Script | Category | Description | -| ------------------------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| input_whitelist.php | Maintenance | To onboard new Data Input Methods when using Cacti in a high security environment where new Data Input Methods must always be vetted before enabling for general use. | -| poller_graphs_reapply_names.php | Maintenance | Allows selecting re-running of Cacti's suggested values engine for Graphs | -| poller_reindex_hosts.php | Maintenance | Batch method to re-index Cacti Devices | -| analyze_database.php | Maintenance | Analyzes all Cacti tables rebuilding their index cardinality. Important to run after having added large numbers of Devices and Graphs to Cacti. | -| batchgapfix.php | Maintenance | Fills gaps in Graphs over a time range, using parallel threads. | -| float_rrdfiles.php | Maintenance | Floats a range of data in selected RRDfiles using the RRDtool dump/import utility. | -| host_update_template.php | Maintenance | Updates Cacti Devices with the latest Device Template. | -| poller_data_sources_reapply_names.php | Maintenance | Recalculates Data Source names for the selected Data Templates. | -| poller_replicate.php | Maintenance | Fully synchronizes Remote Data Collectors. | -| refresh_csrf.php | Maintenance | Updates the csrf_secret() key of the Cacti system. | -| remove_broken_graphs.php | Maintenance | Reports on or removes Graphs that lack Data Sources. | -| remove_graphs.php | Maintenance | Removes Graphs selected by Graph Template, Device Template, Device or Graph name expression. | -| removespikes.php | Maintenance | Removes spikes from an RRDfile. See [Spikekill](Spikekill.md). | -| reorder_data_query.php | Maintenance | Re-orders Data Queries for a Device or for all Devices in batch mode. | -| update_heartbeat.php | Maintenance | Updates RRDfile heartbeats and the Cacti database to match. | +| Script | Purpose | +| --- | --- | +| `input_whitelist.php` | Review and manage approved data input methods. | +| `poller_graphs_reapply_names.php` | Recalculate suggested titles for selected graphs. | +| `poller_reindex_hosts.php` | Refresh data query indexes for selected devices. | +| `analyze_database.php` | Refresh the database optimizer's table statistics. | +| `batchgapfix.php` | Fill gaps in RRD data over the selected time range. | +| `float_rrdfiles.php` | Adjust a range of values in selected RRD files. | +| `host_update_template.php` | Update devices from their device template. | +| `poller_data_sources_reapply_names.php` | Recalculate suggested names for selected data sources. | +| `poller_replicate.php` | Synchronize data with remote data collectors. | +| `refresh_csrf.php` | Rotate the configured CSRF secret during a maintenance window. | +| `remove_broken_graphs.php` | Find and remove broken graphs. | +| `remove_graphs.php` | Remove graphs matching the supplied device and graph criteria. | +| `removespikes.php` | Remove spikes from selected RRD files. See [Spike Kill](Spikekill.md). | +| `reorder_data_query.php` | Reorder data queries on selected devices. | +| `update_heartbeat.php` | Update the heartbeat in RRD files and the Cacti database. | ## Repair Scripts -| Script | Category | Description | -| ------------------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | -| poller_output_empty.php | Repair | Removes bad entries from Cacti's poller output table. | -| audit_graph_template_inputs.php | Repair | Reports Graph Template input integrity findings without changing the database. | -| push_out_hosts.php | Repair | Deprecated. Use `rebuild_poller_cache.php`. | -| rebuild_poller_cache.php | Repair | Batch process to re-populate Cacti's poller cache. NOTE: This script can run for a very long time on large systems. | -| repair_database.php | Repair | Utility to look for common problems with old Cacti databases where objects were removed while still in use. Also repairs all tables after a system crash. | -| repair_graphs.php | Repair | Utility to repair Cacti Graphs whose structure is damaged due to legacy Cacti behavior. | -| repair_templates.php | Repair | Utility to repair Cacti Templates whose structure was damaged due to legacy Cacti behavior. | +| Script | Purpose | +| --- | --- | +| `poller_output_empty.php` | Process pending poller output. This is a legacy recovery utility. | +| `audit_graph_template_inputs.php` | Report integrity problems with graph template inputs. | +| `push_out_hosts.php` | Legacy entry point. Use rebuild_poller_cache.php for cache rebuilds. | +| `rebuild_poller_cache.php` | Rebuild the commands used to poll data sources. | +| `repair_database.php` | Check and repair database tables. | +| `repair_graphs.php` | Repair damaged graph records. | +| `repair_templates.php` | Repair damaged template records. | ## Repair/Migration Scripts -| Script | Category | Description | -| ------------------ | ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| audit_database.php | Repair/Migration | Script to audit your Cacti schema, and repair any tables that don't match the stock Cacti schema. It will also upgrade the Cacti schema and run plugin upgrade functions. This is a good migration tool to move databases from old versions of Cacti. | -| convert_tables.php | Repair/Migration | Convert all tables from their current form to the Cacti preferred table type, collation and charset | -| fix_mediumint.php | Repair/Migration | Increases the size of key Cacti columns for systems with over a million Graphs that have been in service for years. | -| splice_rrd.php | Repair/Migration | Utility that allows two RRDfiles to be merged, and also assists with resampling an old RRDfile to a new RRA configuration, for example moving a Cacti system from 5 minute polling to 1 minute polling. | +| Script | Purpose | +| --- | --- | +| `audit_database.php` | Compare the database schema with the Cacti schema and optionally repair differences. | +| `convert_tables.php` | Convert database tables to the selected storage engine, character set, and collation. | +| `fix_mediumint.php` | Widen integer columns that have outgrown their original range. | +| `splice_rrd.php` | Merge RRD files or resample data into another archive layout. | ## Install/Upgrade Scripts -| Script | Category | Description | -| ----------------------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| import_package.php | Install/Upgrade | Import a signed Cacti `.xml.gz` package, including its template definitions and embedded resource files. Run on the main collector; see [Template Import](Import-Template.md). | -| import_template.php | Install/Upgrade | Import a Cacti Template XML file from the command line. | -| install_cacti.php | Install/Upgrade | Script to install Cacti from a raw schema. Used primarily by distribution maintainers. | -| md5sum.php | Install/Upgrade | Utility to verify the MD5SUM of a file. | -| sqltable_to_php.php | Install/Upgrade | Utility for Plugin Developers to create an object for creating tables in plugins. | -| structure_rra_paths.php | Install/Upgrade | Utility to convert a system from a flat directory path to a hierarchical one. Important for certain file systems that don't perform well when there are tens or hundreds of thousands of files in a single directory. | -| upgrade_database.php | Install/Upgrade | Utility to upgrade a Cacti database from a point in time to the current release. Or even rerun the database upgrade from a point in the past to catch up with changes. This script should be used in conjunction with the `audit_database.php --repair --upgrade` option. | - -> **NOTE**: Package maintainers may wish to utilize the CLI methods of -> install_cacti.php and upgrade_database.php to perform in-place installations -> and upgrades. - -In the sub-sections below, we will demonstrate the use of a few of these CLI -scripts. - -> **Caution**: In the following examples, several numbers are shown as output -> from various scripts. They will vary between different installations. So don't -> bother if your numbers will vary. +| Script | Purpose | +| --- | --- | +| `import_package.php` | Import a signed Cacti package. | +| `import_template.php` | Import templates from XML. See [Template Import](Import-Template.md). | +| `install_cacti.php` | Install Cacti from an initialized schema. | +| `md5sum.php` | Create or verify an MD5 checksum file. | +| `sqltable_to_php.php` | Generate a PHP table definition from an existing database table. | +| `structure_rra_paths.php` | Migrate RRD files from a flat directory to device-specific paths. | +| `upgrade_database.php` | Run database upgrade steps for this Cacti installation. | ## Rebuild Poller Cache -The poller cache holds all commands that Cacti will issue during the polling -process in an internal format. It is possible to review the current contents of -the poller cache by visiting `System Utilities`, `View Poller Cache`. It is -possible to apply filters to this view; it will show up like +The cache stores the commands the collector runs for each data source. Inspect +a device's entries in **Console > Utilities > System Utilities > View Poller +Cache**. If the commands are stale after a data input or template change, +rebuild the affected device and inspect its entries again. -```console -Localhost - Hard Drive Space Script Server: /var/www/html/cacti/scripts/ss_host_disk.php ss_host_disk 127.0.0.1 1 1:161:500:somesecret:::::: get total 6 - RRD: /var/www/html/cacti/rra/localhost_hdd_total_61.rrd -Localhost - Load Average Script: /usr/bin/perl /var/www/html/cacti/scripts/loadavg_multi.pl - RRD: /var/www/html/cacti/rra/localhost_load_1min_5.rrd -Localhost - Logged in Users Script: /usr/bin/perl /var/www/html/cacti/scripts/unix_users.pl - RRD: /var/www/html/cacti/rra/localhost_users_6.rrd -Localhost - Memory - Free Script: /usr/bin/perl /var/www/html/cacti/scripts/linux_memory.pl MemFree: - RRD: /var/www/html/cacti/rra/localhost_mem_buffers_3.rrd -Localhost - Memory - Free Swap Script: /usr/bin/perl /var/www/html/cacti/scripts/linux_memory.pl SwapFree: - RRD: /var/www/html/cacti/rra/localhost_mem_swap_4.rrd -Localhost - mtaReceivedMessages SNMP Version: 1, Community: somesecret, OID: .1.3.6.1.2.1.28.1.1.1.1 - RRD: /var/www/html/cacti/rra/localhost_mtareceivedmessages_47.rrd -Localhost - mtaReceivedVolume SNMP Version: 1, Community: somesecret, OID: .1.3.6.1.2.1.28.1.1.4.1 - RRD: /var/www/html/cacti/rra/localhost_mtareceivedvolume_49.rrd +```sh +php rebuild_poller_cache.php --host-id="$device_id" --debug ``` -There are several circumstances that may result in the poller cache being out -of sync. An example would be a change of the name of a script used in a -`Data Input Method`. This change is _not_ automatically propagated to the poller -cache. It is required to run `php -q rebuild_poller_cache.php` manually. - -Calling the script with the parameter `--help` yields - -```console -shell>php -q rebuild_poller_cache.php --help -Cacti Rebuild poller cache Tool, Version 1.2.x Copyright (C) 2004-2026 The Cacti Group - -usage: rebuild_poller_cache.php [--host-id=N] [--host-template-id=N] [--data-template-id=N] [--debug] - -Cacti's repopulate poller cache tool. This CLI script will -repopulate poller cache for all or specified hosts. - -This utility will run in parallel with the given number of threads, -Optional: - --threads=N - The number of threads to use to repopulate, default = 5 - --host-id=N - Run for a specific Device - --host-template-id=N - Run for a specific Device Template - --data-template-id=N - Run for a specific Data Template - --debug - Display verbose output during execution - -System Controlled: - --type - The type and subtype of the rebuild poller cache process - --child - The thread id of the child process - -``` - -Debug mode lists the data source items that are worked upon. - -```console -shell>php -q rebuild_poller_cache.php -d -WARNING: Do not interrupt this script. Rebuilding the Poller Cache can take quite some time -DEBUG: There are '38' data source elements to update. -DEBUG: Data Source Item '1' of '38' updated -DEBUG: Data Source Item '2' of '38' updated -DEBUG: Data Source Item '3' of '38' updated -DEBUG: Data Source Item '4' of '38' updated -.... -``` - -Without any parameter, some dots are shown as progress indicators. - -```console -shell>php -q rebuild_poller_cache.php -WARNING: Do not interrupt this script. Rebuilding the Poller Cache can take quite some time -...................................... -shell> -``` - -> **Caution** -> -> Rebuilding the poller cache interferes with the poller operation. Make sure -> that the poller is not running and will not start during a rebuild operation. +Omitting the device filter broadens the rebuild. Schedule a full rebuild +outside a polling cycle. Debug output shows the work being done. ## Re-Index Hosts -Re-Indexing is required only for SNMP/Script Data Queries. Remember that when -applying a Data Query to a Host, a `Re-Index Method` has to be chosen. This -reindex method governs the automatic re-indexing based on specific events. +Reindexing refreshes the items a data query discovers, such as interfaces or +mounted filesystems. The reindex method on the device's query association +determines when Cacti automatically checks those items. -###### Table 20-1. Re-Index Methods +### Table 20-1. Re-Index Methods -| Re-Index Method | Description | -| --------------------- | ------------------------------------------------------------------ | -| Uptime Goes Backwards | Refers to a system reboot | -| Index Count Changed | Refers to a change of the number of indexed items | -| Verify All Fields | All index fields of the corresponding XML file are checked for changes | +| Method | What triggers reindexing | +| --- | --- | +| None (0) | The association has no automatic reindex trigger. | +| Uptime Goes Backwards (1) | The device reports a lower uptime than on the previous check. | +| Index Count Changed (2) | The number of indexed items changes. | +| Verify All Fields (3) | Cacti detects a change in the query's monitored index fields. | -If the method is set to `Uptime Goes Backwards`, Cacti will detect if the target -has been rebooted by querying sysUptime (.1.3.6.1.2.1.1.3.0). If the current -value for the uptime is lower than the previous one (uptime goes backwards), a -reboot is assumed and a re-index is performed. +Rediscover the selected query on one device after its interfaces change: -If the method is set to `Index Count Changed`, Cacti checks the number of -indexed items, e.g. the number of interfaces, without checking sysUptime. It -is of particular interest in cases where indexed -entries may change without the need of a reboot. As modern operating systems -seldom require reboots for system configuration changes, you may want to -consider this setting for many cases (e.g. creating a new filesystem without -a reboot). The index to be considered is defined by the corresponding XML file. - -If the method is set to `Verify All Fields`, all indexes of the data source are -checked for changes. This is of particular interest e.g. in cases where the -index is non-numeric (e.g. a MAC address). It should be noted that in the 1.0 -and 1.1 releases, this method was found to be broken and has been corrected -since 1.2. - -If you feel the need for manual re-indexing, you may run it from CLI. Calling -the script with the parameter `--help` yields - -```console -shell>php -q poller_reindex_hosts.php --help -Cacti Reindex Host Utility, Version 1.2.x (DB: 1.2.x), Copyright (C) 2004-2026 The Cacti Group -usage: poller_reindex_hosts.php --id=[host_id|all] [--qid=[ID|all]] - [--host-descr=[description]] [--debug] - ---id=host_id - The host_id to have data queries reindexed or 'all' to reindex all hosts ---qid=query_id - Only index on a specific data query id; defaults to 'all' ---host-descr=description - The host description to filter by (SQL filters acknowledged) ---force - Force Graph and Data Source Suggested Name Re-mapping for all items ---debug - Display verbose output during execution +```sh +php poller_reindex_hosts.php --id="$device_id" --qid="$query_id" --debug ``` -Running it in debug mode for the host with `id=2` may yield - -```console -shell>php -q poller_reindex_hosts.php -id=2 -d -WARNING: Do not interrupt this script. Reindexing can take quite some time -DEBUG: There are '1' data queries to run -DEBUG: Data query number '1' host: '2' SNMP Query Id: '1' starting -DEBUG: Data query number '1' host: '2' SNMP Query Id: '1' ending -``` - -A silent run for all devices is issued by - -```console -shell>php -q poller_reindex_hosts.php -id=All -WARNING: Do not interrupt this script. Reindexing can take quite some time -.....shell> -``` - -You may run this script against a specific data query id using -`--qid=[data query id]` like - -```console -shell>php -q poller_reindex_hosts.php --id=All --qid=1 -d -WARNING: Do not interrupt this script. Reindexing can take quite some time -DEBUG: There are '3' data queries to run -DEBUG: Data query number '1' host: '1' SNMP Query Id: '1' starting -DEBUG: Data query number '1' host: '1' SNMP Query Id: '1' ending -DEBUG: Data query number '2' host: '2' SNMP Query Id: '1' starting -DEBUG: Data query number '2' host: '2' SNMP Query Id: '1' ending -DEBUG: Data query number '3' host: '15' SNMP Query Id: '1' starting -DEBUG: Data query number '3' host: '15' SNMP Query Id: '1' ending -``` - -It is possible to select a host based on its host description using -`--host-descr=[host description]`. It is allowed to apply an SQL filter -expression for the description like `--host-descr=some%descr`. Use this parameter in -conjunction with either `--id=[host id]` or `--qid=[data query id]` or both: - -```console -shell>php -q poller_reindex_hosts.php --id=All --qid=1 --host-descr=ga%f -d -WARNING: Do not interrupt this script. Reindexing can take quite some time -DEBUG: There are '1' data queries to run -DEBUG: Data query number '1' host: '2' SNMP Query Id: '1' starting -DEBUG: Data query number '1' host: '2' SNMP Query Id: '1' ending -``` - -> **Caution** -> -> Re-Indexing interferes with the poller operation. Make sure that the poller is -> not running and will not start during a reindex operation. +To reindex that query across matching devices, use `--id=all` and +`--host-descr='router%'`. The description filter accepts SQL wildcards. +Omitting `--qid` includes all associated queries. ## Empty Poller Output Table -During normal poller operation, all retrieved results are intermediately stored -in the table named poller_output. After execution of cmd.php or Spine, this -table holds all results. The poller.php finally issues all rrdtool update -operations. Thus, after polling has completed, the table should be empty. - -Conditions may arise where the table is not (completely) emptied. The most -often known issue is lack of PHP memory. In those cases, the table is bigger -than the PHP memory size, thus not all items are handled correctly. If that -issue occurs, you may save all pending updates _after increasing PHP memory -appropriately_ by running this very script. Calling the script with the -parameter `--help` yields - -```console -shell>php -q poller_output_empty.php --help -Cacti Process Poller Output Utility, Version 1.2.x (DB: 1.2.x), Copyright (C) 2004-2026 The Cacti Group - -usage: poller_output_empty.php - -A utility to process the poller output table. This tool is deprecated but should work. +The collector stages readings in `poller_output` before Cacti processes +them for RRDtool. A nonempty table during a polling cycle can be normal. +If readings remain after polling finishes, check the poller log for the +cause, such as an interrupted process. Once normal polling is idle, this +legacy recovery utility processes the outstanding rows: +```sh +php poller_output_empty.php ``` -You see, no parameter is required for operating successfully. Under normal -circumstances, running this script should yield - -```console -shell>php -q poller_output_empty.php -There were 0, RRD updates made this pass -shell> -``` - -In case you hit the poller process or if the table was really not fully -processed, you may find - -```console -shell>php -q poller_output_empty.php -OK u:0.00 s:0.00 r:0.04 -OK u:0.00 s:0.00 r:0.04 -OK u:0.00 s:0.00 r:0.04 -OK u:0.00 s:0.00 r:0.04 -OK u:0.00 s:0.00 r:0.04 -OK u:0.00 s:0.00 r:0.04 -OK u:0.00 s:0.00 r:0.04 -OK u:0.00 s:0.00 r:0.04 -OK u:0.00 s:0.00 r:0.04 -OK u:0.00 s:0.00 r:0.05 -OK u:0.00 s:0.00 r:0.05 -OK u:0.00 s:0.00 r:0.05 -OK u:0.00 s:0.00 r:0.05 -OK u:0.00 s:0.00 r:0.05 -OK u:0.00 s:0.00 r:0.05 -OK u:0.00 s:0.00 r:0.05 -OK u:0.00 s:0.00 r:0.05 -OK u:0.00 s:0.00 r:0.05 -OK u:0.00 s:0.00 r:0.05 -OK u:0.00 s:0.00 r:0.05 -OK u:0.00 s:0.01 r:0.06 -There were 21, RRD updates made this pass -shell> -``` - -If logging level verbosity was switched to `DEBUG`, you may find additional -debug messages that usually show up in `cacti.log`. +The script prints the number of RRD updates processed. A count of zero is +expected for an empty queue. It uses the poller's output processing code. ## Reapply Suggested Names to Graphs -For a general understanding of suggested names used with data queries, please -see [Data Queries](Data-Queries.md#associated-graph-templates). Be aware that -changes to the `Suggested Names` section of a data query -will not automatically be propagated to all existing graphs. This is where -poller_graphs_reapply_names.php drops in. Calling the script with the parameter -`--help` yields - -```console -shell>php -q poller_graphs_reapply_names.php --help -Cacti Reapply graph Names Utility, Version 1.2.x (DB: 1.2.x), Copyright (C) 2004-2026 The Cacti Group - -usage: poller_graphs_reapply_names.php --host-id= [--filter=] [--debug] - -A utility to reapply Cacti Graph naming rules to existing Graphs in bulk. - -Required: - --host-id=id|all|N1,N2,... - The device id, 'all' or a comma delimited list of ids - --id and -id - Aliases for --host-id - -Optional: - --filter=string - A Graph Template name or Graph Title to search for - --debug - Display verbose output during execution +Changing the suggested title on a data query can leave existing graph titles +unchanged. Select a device and a distinctive part of its current graph title +or template name. Inspect the resulting titles in **Graph Management**. +```sh +php poller_graphs_reapply_names.php --host-id="$device_id" --filter='Traffic' --debug ``` -Assume a situation where the suggested names were changed for the standard -data query named `SNMP - Get Mounted Partitions`. In this case, you will want to -rework all graphs for this data query only. A verbose run will yield - -```console -shell>php -q poller_graphs_reapply_names.php --host-id=all -d --filter="Used space" -WARNING: Do not interrupt this script. Interrupting during rename can cause issues -DEBUG: There are '6' Graphs to rename -DEBUG: Graph Name 'Localhost - Used Space - Memory Buffers' starting -DEBUG: Graph Rename Done for Graph 'Localhost - Used Space - Memory Buffers' -DEBUG: Graph Name 'Localhost - Used Space - Real Memory' starting -DEBUG: Graph Rename Done for Graph 'Localhost - Used Space - Real Memory' -DEBUG: Graph Name 'Localhost - Used Space - Swap Space' starting -DEBUG: Graph Rename Done for Graph 'Localhost - Used Space - Swap Space' -DEBUG: Graph Name 'Localhost - Used Space - /' starting -DEBUG: Graph Rename Done for Graph 'Localhost - Used Space - /' -DEBUG: Graph Name 'Localhost - Used Space - /sys' starting -DEBUG: Graph Rename Done for Graph 'Localhost - Used Space - /sys' -DEBUG: Graph Name 'Localhost - Used Space - /boot' starting -DEBUG: Graph Rename Done for Graph 'Localhost - Used Space - /boot' -``` - -Notice the misspelling of the word “Space”. The `--filter` option (also -accepted as `-s`) is not case sensitive. +The filter is a substring match. `--debug` prints progress while applying +the change. See +[associated graph templates][query-graphs] for the suggested-value settings. ## Copy Local Cacti Users -For use and understanding the limitation of this script, it is of importance to -read [User Management](User-Management.md). +Copy a local template account to create another local user. The first +argument is the existing username and the second is the new username. -Calling the script with the parameter `--help` yields - -```console -shell>php -q copy_user.php --help -Cacti Copy User Utility, Version 1.2.x (DB: 1.2.x), Copyright (C) 2004-2026 The Cacti Group -usage: copy_user.php