Files
2024-01-25 02:42:01 +11:00

149 lines
5.0 KiB
Tcl

# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
PortSystem 1.0
name cacti
version 1.1.27
categories net
license GPL-2+
platforms any
maintainers nomaintainer
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 https://www.cacti.net
master_sites https://www.cacti.net/downloads
checksums rmd160 313d40867437bbae1c8cde3a5ca106e41b70e50d \
sha256 b4a5aa2a772aff7eb5abae31d07ed86a1c00300094d3c3c63091554fbb0deea9
depends_lib path:bin/mysql_config5:mysql57 \
port:rrdtool
use_configure no
build {}
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 <cacti-user>:<cacti-group> ${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('<my-cactidb-pwd>');
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 = \"<my-cactidb-pwd>\";
5) Place a symlink for Cacti inside your Apache document root.
ln -s ${cactidir} <Apache-docroot>/cacti
6) Edit the Cacti user's crontab file.
sudo -u <cactiuser> 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
"