# $Id: Portfile 111384 2013-09-19 21:52:20Z markd@macports.org $ PortSystem 1.0 name cacti version 0.8.8b categories net license GPL-2+ maintainers markd openmaintainer platforms darwin supported_archs noarch description Cacti is a complete RRDtool network graphing solution. long_description Cacti is a complete network graphing solution designed \ to harness the power of RRDtool's data storage and \ graphing functions. homepage http://www.cacti.net master_sites http://www.cacti.net/downloads checksums md5 acb40deae073ca22e5c01a8e3ba389fb \ rmd160 a2c88961565c6b5d593b4f2603514139800c9145 depends_lib path:bin/mysql_config5:mysql5 \ port:rrdtool use_configure no build {} set cactiversion 0.8.8a set cactidir ${prefix}/share/cacti destroot { # Copy Cacti files file mkdir ${destroot}${cactidir} system "cp -R ${worksrcpath}/* ${destroot}${cactidir}" } notes " **** To complete the Cacti installation **** The full documentation may be found at http://www.cacti.net/documentation.php. 1) Install PHP and MySQL 5 (not covered). These instructions assume MySQL 5 was installed from MacPorts. Check to make sure the PHP variable \"mysql.default_socket\" is set to path ${prefix}/var/run/mysql5/mysqld.sock by viewing the output of this terminal command: php -i If not, locate the php.ini file for your version of PHP and type the path there. 2) Set Cacti permissions. sudo chown -R : ${prefix}/share/${name}/ 3) Setup MySQL and prepare it for Cacti. Configure MySQL (new MySQL installs) sudo -u mysql ${prefix}/lib/mysql5/bin/mysql_install_db Start MySQL: sudo ${prefix}/share/mysql5/mysql/mysql.server start Set MySQL to start at system boot sudo launchctl load -w /Library/LaunchDaemons/org.macports.mysql5.plist Set a root MySQL password. Follow the instructions that were given after you executed 'mysql_install_db' above. Create a cacti MySQL user and cacti database. mysql5 -u root -p (login with root password set above when prompted) mysql> GRANT ALL ON cacti.* to cacti@localhost; mysql> SET PASSWORD FOR cacti@localhost = PASSWORD(''); mysql> flush privileges; mysql> create database cacti; mysql> exit; Import the cacti database. sudo cat ${cactidir}/cacti.sql | mysql5 -u root -p cacti (cacti is the db name) Verify the Cacti Database. mysql5 -u root -p mysql> use cacti; mysql> show tables; mysql> exit; 4) Edit ${cactidir}/include/config.php to match your MySQL information and url path. \$database_type = \"mysql\"; \$database_default = \"cacti\"; \$database_hostname = \"localhost\"; \$database_username = \"cacti\"; \$database_password = \"\"; 5) Place a symlink for Cacti inside your Apache document root. ln -s ${cactidir} /cacti 6) Edit the Cacti user's crontab file. sudo -u crontab -e Insert the crontab entry below: */5 * * * * ${prefix}/bin/php ${cactidir}/poller.php > /dev/null 2>&1 7) If you wish to use Cacti plugins, you must perform these additional steps. a) Download the Cacti plugin(s) you want to use and copy the unzipped directory to ${cactidir}/plugins/ For example: ${cactidir}/plugins/weathermap/ b) In the Cacti web GUI, go to Configuration -> Plugin Management and you should see your plugin(s) listed. Under 'Actions', click the the install icon to install each plugin. c) Ensure that your Cacti user has permissions to manage the plugins User Management - select a Cacti user and set Configure/Manage or View options as desired 8) Go to http://localhost/cacti/install/index.php. The default user/password is admin/admin. Select 'New Install', enter the paths for SNMP / RRDtool / PHP (see below), and click 'Finish'. You may now use Cacti at http://localhost/cacti/index.php. Verify paths: snmpwalk binary path: /usr/bin/snmpwalk snmpget binary path: /usr/bin/snmpget RRDtool binary path: ${prefix}/bin/rrdtool PHP binary path: ${prefix}/bin/php (if not using MacPorts PHP, use appropriate path) 9) Create interface traffic graphs a) Devices -> Add -Fill out form for the switch or router -Make sure to include the SNMP community string of the device -Click the 'Create' button to add device b) In the devices pane, click on the newly added device to open the edit pane -Click 'Create Graphs for this Host' link -An SNMP query is made and interfaces listed; check the interface(s) to be graphed -Select a graph type from the menu in the bottom right and click the 'Create' button beside it c) Place some or all a device's graphs on a graph tree from the Devices or Graph Management section "