The Cacti ManualIan BerryTony RomanLarry AdamsJ.P. PasnakJimmy ConnerReinhard ScheckAndreas Braun

The Cacti Manualby Ian Berry, Tony Roman, Larry Adams, J.P. Pasnak, Jimmy Conner, Reinhard Scheck, and Andreas BraunPublished 2017Copyright 2017 The Cacti GroupThis project is licensed under the terms of the GPL.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 theFree 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 ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.All product names are property of their respective owners. Such names are used for identification purposes only and are not indicative ofendorsement by or of any company, organization, product, or platform.

Table of ContentsI. Installation. 11. Requirements . 12. Installing Under Unix . 22.1. Required Packages for RPM-based Operating Systems. 22.2. Ports for FreeBSD. 22.3. Configure PHP . 22.4. Configure the Webserver (Apache) . 32.5. Configure MySQL. 32.6. Install and Configure Cacti. 32.7. (Optional) Install and Configure Spine. 42.8. Apply Patches. 43. Installing Under Windows. 64. Upgrading Cacti . 10II. Basics . 115. Principles of Operation. 115.1. Data Retrieval . 115.2. Data Storage. 115.3. Data Presentation. 116. Graph Overview . 127. How to Graph Your Network. 137.1. Creating a Device. 137.2. Creating the Graphs . 178. Viewing Graphs . 198.1. Graph Trees. 199. User Management . 219.1. Editing an existing User. 219.2. Creating a New User . 239.3. Copying a user . 249.4. Enable/Disable Users. 269.5. Batch Copy Users. 279.6. Delete Users . 289.7. Guest (Anonymous) Access . 29III. Advanced Topics. 3010. Graph a Single SNMP OID . 3011. Data Input Methods . 3111.1. Creating a Data Input Method. 3111.2. Making Your Scripts Work With Cacti. 3212. Data Queries. 3312.1. Creating a Data Query . 3312.2. SNMP Query XML Syntax . 3412.3. Script Query XML Syntax. 3613. Templates. 3913.1. Data Templates. 3913.2. Graph Templates . 4113.3. Host Templates. 4613.4. Import Templates . 4613.5. Export Templates . 4714. PHP Script Server . 4914.1. Using the Script Server. 4914.2. Upgrade Steps for the Example HostMib Data Queries . 4914.3. Migration of Existing PHP Scripts to Script Server . 4914.4. Testing Your Script in the Script Server . 5115. Spine . 52IV. Help. 5316. How To. 5316.1. Simplest Method of Going from Script to Graph (Walkthrough). 5317. Frequently Asked Questions . 57

V. Reference . 6018. Variables. 6018.1. Graph Variables. 6018.2. Host Variables. 6419. RRDTool Specific Features . 6519.1. GPRINT Presets. 6519.2. CDEFs . 6520. Command Line Scripts . 7420.1. Rebuild Poller Cache . 7420.2. Re-Index Hosts . 7520.3. Empty Poller Output Table. 7620.4. Reapply Suggested Names to Graphs . 7720.5. Copy Local Cacti Users . 7720.6. Add a New Device. 7820.7. Associate a Data Query to an existing Host. 7920.8. Associate a Graph Template to an existing Host. 8020.9. Add a New Graph . 8120.10. Add Items to a Tree. 8420.11. Add Graph Permissions. 8721. Debugging . 9021.1. Check Cacti Log File. 9021.2. Check Basic Data Gathering. 9021.3. Check cacti’s poller . 9021.4. Check MySQL updating . 9021.5. Check rrd file updating . 9121.6. Check rrd file ownership . 9121.7. Check rrd file numbers. 9121.8. Check rrdtool graph statement . 9221.9. Miscellaneous . 9221.10. RPM Installation?. 9221.11. Not NaN, but 0 (zero) values? . 92iv

List of Tables7-1. Device Field Definitions. 137-2. SNMP Retrieval Types . 158-1. Tree Sporting Type Definitions . 199-1. Field Description: User Management . 2210-1. Field Description: SNMP - Generic OID Template . 3011-1. Field Description: Data Input Methods. 3111-2. Field Description: Data Input Fields. 3112-1. Field Description: Data Queries . 3312-2. Field Description: Associated Graph Templates . 3312-3. SNMP Query XML Field Reference . 3412-4. Script Query XML Field Reference . 3613-1. Data Templates: Field Description of the Data Source Section . 3913-2. Data Templates: Field Description of the Data Source Items Section . 4013-3. Field Description: Graph Templates . 4213-4. Field Description: Graph Template Items . 4413-5. Field Description: Graph Template Items . 4515-1. Spine Specific Execution Parameters . 5218-1. Nth Percentile Argument Description. 6218-2. Nth Percentile Types . 6218-3. Bandwidth Summation Argument Description. 6318-4. Host Variables . 6419-1. CDEF Item Types . 6519-2. CDEF Special Data Source. 6520-1. Re Index Methods. 7520-2. Parametes required for an Interface Traffic Graph . 84

Chapter 1. RequirementsCacti requires that the following software is installed on your system. RRDTool MySQL PHP1.2 or greater, 1.5 recommended5.1 or greater5.3 or greater Web Server with PHP support

Chapter 2. Installing Under UnixPlease make sure, the following packages are installed according to your operating systems requirements. Verify, thathttpd and mysqld are started at system startup.2.1. Required Packages for RPM-based Operating Systems httpd php php-mysql php-snmp mysql mysql-server net-snmp2.2. Ports for FreeBSD www/apache2 net/rrdtool net/net-snmp www/php-cgi lang/php(With MySQL and SNMP Support) databases/mysql-server2.3. Configure PHPPlease ensure, that PHP support is either builtin or installed for the following PHP extension modules: mysql SNMP(For configuration, see note below)(For configuration, see note below) XML Session Sockets LDAP GD(Required only when using LDAP authentication)(Required only for some Plugins)You may run the following command to get the list of all available PHP modulesphp -mPlease verify, that the modules are installed and configured correctly. There are several ways to do so, please consultPHP configuration instructions1 for a complete description.We will continue using the most recommended way of configuring php extension modules. Please find the file/etc/php.ini and make the following changes to it:extension dir /etc/php.dThis will enable PHP to find more configuration directives in that very directory. Other distros point to/usr/lib/php/modules instead. In each case, you should locate e.g. in that directory.Activate the MySQL extension via /etc/php.d/mysql.ini; Enable mysql extension moduleextension

Chapter 2. Installing Under UnixActivate the SNMP extension via /etc/php.d/snmp.ini; Enable snmp extension moduleextension snmp.soIf you want to allow template importing, uncomment the following line:file uploads On2.4. Configure the Webserver (Apache)Please find the file /etc/httpd/conf/httpd.conf or equivalent and make the following changes to it:# Load config files from the config directory "/etc/httpd/conf.d".Include conf.d/*.confNow, please locate the PHP configuration file at /etc/httpd/conf.d/php.conf# PHP is an HTML-embedded scripting language which attempts to make it# easy for developers to write dynamically generated webpages.LoadModule php module modules/ Cause the PHP interpreter to handle files with a .php extension.AddHandler php-script .phpAddType text/html .php## Add index.php to the list of files that will be served as directory# indexes.DirectoryIndex index.php2.5. Configure MySQLSet a password for the root usershell mysqladmin --user root password somepasswordshell mysqladmin --user root --password reload2.6. Install and Configure Cacti1. Extract the distribution tar xzvf cacti-version.tar.gz2. Create the MySQL database:shell mysqladmin --user root create cacti3. Import the default cacti database:shell mysql cacti cacti.sql4. Optional: Create a MySQL username and password for mysql mysql mysql mysqlGRANTGRANTflush--user root mysqlALL ON cacti.* TO [email protected] IDENTIFIED BY ’somepassword’;SELECT ON mysql.time zone name TO [email protected];privileges;5. Edit include/config.php and specify the database type, name, host, user and password for your Cacti configuration. database type "mysql"; database default "cacti"; database hostname "localhost"; database username "cactiuser"; database password "cacti";6. Copy installed plugins from the old Cacti directory (if they exist).3

Chapter 2. Installing Under Unix7. Set the appropriate permissions on cacti’s directories for graph/log generation. You should execute these commands from inside cacti’s directory to change the chown -R cactiuser rra/ log/(Enter a valid username for cactiuser, this user will also be used in the next step for data gathering.)8. Add a line to your /etc/crontab file similar to:*/5 * * * * cactiuser php /var/www/html/cacti/poller.php /dev/null 2 &1Replace cactiuser with the valid user specified in the previous step.Replace /var/www/html/cacti/ with your full Cacti path.9. Point your web browser to:http://your-server/cacti/Log in the with a username/password of admin. You will be required to change this password immediately.Make sure to fill in all of the path variables carefully and correctly on the following screen.2.7. (Optional) Install and Configure SpineSpine is a very fast poller engine, written in C. It is an optional replacement for cmd.php. If you decide to use it, youwill have to install it explicitely. It does not come with cacti itself.The easiest way is to install Spine using rpm or ports. You will find packages for Spine at the main cacti site or fromyour distribution.To compile Spine, please download it to any location of your liking. Then, please issue from the downloaded directoryfollowing commandsshell aclocalshell libtoolize --force(glibtoolize --force on Max OS)shell autoheadershell autoconfshell automakeshell ./configureshell makeshell make installAssuming, you’ve managed to install Spine correctly, you will have to configure it. The configuration file may beplaced in the same directory as Spine itself or at /etc/Spine.conf.DB Host or hostname (not localhost)DB Database cactiDB User cactiuserDB Password cactiDB Port 33062.8. Apply PatchesPlease visit the Cacti website at patches.php If any patch has been released, youwill find installation instructions there.As an example, please find patch installation instructions for cacti 0.8.8 here. Do not apply those patches to recentreleases!wget v3 priv proto none.patchpatch -p1 -N snmpv3 priv proto none.patchYou might need to reapply file/folder security on the files patched. Double check they are correct.Please pay attention not to break cacti when using SELinux or using NTFS file security. If you encounter4

Chapter 2. Installing Under UnixPHP Warning: include once(./lib/html tree.php) [ a href ’function.include-once’ function.include-once /afailed to open stream: Permission denied in /var/www/cacti/graphs.php on line 33, referer:http://localhost/cacti/graphs.phpor the like, it is very likely that your permissions are wrong.Notes1.

Chapter 3. Installing Under WindowsSoftware Components Required1. (Optional) Apache - This software is optional if running Windows Internet Information Server.2. Cacti - Install from the zip distribution and install in the web root or your choice. Many choose to install into a"Cacti" sub folder.3. Spine - Install from the zip distribution into the c:\cacti directory. Make sure your spine.conf.dist is locatedin that directory as well.4. RRDTool - Install from the Cacti website. Install it into the c:\cacti directory.5. PHP 5.x - Install into the c:\php folder. If you choose to install into c:\Program Files\php, you will have touse 8.3 filenames to reference it’s binaries in Cacti.6. MySQL 5.x - Install into the default location. This is typically c:\Program Files\MySQL\MySQL Server X.XX.7. (Optional) Cygwin - Download and execute setup.exe from the Cygwin website. Keep the setup.exe file forlater use.8. (Optional) Net-SNMP - Install to the c:\net-snmp directory. If you choose to use c:\Program Files\net-snmpyou will have tu use 8.3 filenames to reference it’s binaries in Cacti.Configure PHP1. Add the following directory to the existing Windows System PATH environment variable: c:\php. The Windowspath can be accessed via the Control Panel at: System Advanced Environment Variables System Variables.2. Add the following directory to a new Windows System environment variable called PHPRC: c:\php.3. Add a new Windows System environment variable called MIBDIRS set it to c:\php\extras\mibs4. Rename the file c:\php\php.ini.dist to php.ini, and make the following changes to it:Uncomment the following lines.extension dir c:\php\extextension php mysql.dllextension php snmp.dllextension php sockets.dllcgi.force redirect 05. In earlier installation guides to PHP, they recommended moving certain DLL’s to the c:\winnt\system32directory. If so, you will have to remove those files. Please review the PHP installation documentation for instructions on removing those files.6. If you want to allow template importing, uncomment the following line:file uploads On7. Give the user who will be running the scheduled task, modify rights to the .index file in the location pointed toby the MIBDIRS Windows System environment variable.Configure the Webserver (Apache)1. Make sure you have stopped any IIS web servers before you proceed with Apache installation, or make sureApache is configured on an alternate port.2. If using Apache 2.x and PHP 5, then add the following lines.LoadModule php5 module c:\php\php5apache2.dllAddType application/x-httpd-php .phpDirectoryIndex index.html index.htm index.phpConfigure the Webserver (IIS)1. Start the Internet Information Services (IIS) Manager, right click on the Default Web Site (in most cases) and selectProperties.2. Under the Home Directory tab, select Configuration and click Add. Browse to the path of php4isapi.dll orphp5isapi.dll, and type in .php as the extension. Note: if using IIS6, Enable All Verbs and Script Engine.3. Under the ISAPI Filters tab, click Add and browse to the php4isapi.dll or php5isapi.dll file. Name the filter"php" and click OK.4. Under the Documents tab, add index.php to the list.

Chapter 3. Installing Under Windows5. If using IIS6, goto Web Service Extensions and add a new Web Service Extension. Name the extension "php", andclick Add and browse to the php4isapi.dll or php5isapi.dll file, enable

Chapter 2. Installing Under Unix Activate the SNMP extension via /etc/php.d/snmp.ini; Enable snmp extension module extension If you want t