| 1 | # $Id$ |
|---|
| 2 | |
|---|
| 3 | PortSystem 1.0 |
|---|
| 4 | |
|---|
| 5 | name cacti |
|---|
| 6 | version 0.8.7b |
|---|
| 7 | revision 4 |
|---|
| 8 | categories net |
|---|
| 9 | maintainers markd |
|---|
| 10 | platforms darwin |
|---|
| 11 | |
|---|
| 12 | description Cacti is a complete RRDtool network graphing solution. |
|---|
| 13 | |
|---|
| 14 | long_description Cacti is a complete network graphing solution designed \ |
|---|
| 15 | to harness the power of RRDtool's data storage and \ |
|---|
| 16 | graphing functions. |
|---|
| 17 | |
|---|
| 18 | homepage http://www.cacti.net |
|---|
| 19 | master_sites http://www.cacti.net/downloads/:cacti |
|---|
| 20 | |
|---|
| 21 | distfiles ${distname}${extract.suffix}:cacti |
|---|
| 22 | checksums ${distname}${extract.suffix} md5 63ffca5735b60bc33c68bc880f0e8042 |
|---|
| 23 | |
|---|
| 24 | depends_lib port:mysql5 \ |
|---|
| 25 | port:rrdtool |
|---|
| 26 | |
|---|
| 27 | use_configure no |
|---|
| 28 | build {} |
|---|
| 29 | set cactidir ${prefix}/share/cacti |
|---|
| 30 | |
|---|
| 31 | variant server description {does nothing in this port, but its presence triggers mysql5 server variant} {} |
|---|
| 32 | variant_set server |
|---|
| 33 | |
|---|
| 34 | variant plugins description {The Plugin Architecture for Cacti} { |
|---|
| 35 | master_sites-append http://cactiusers.org/downloads/:plugins |
|---|
| 36 | distfiles-append cacti-plugin-arch${extract.suffix}:plugins |
|---|
| 37 | checksums-append cacti-plugin-arch${extract.suffix} md5 7079c1f366e8ea1b26c7e251e6373226 |
|---|
| 38 | } |
|---|
| 39 | |
|---|
| 40 | destroot { |
|---|
| 41 | file mkdir ${destroot}${cactidir} |
|---|
| 42 | |
|---|
| 43 | if { [variant_isset plugins] } { |
|---|
| 44 | reinplace "s|+++ 0.8.7|+++ cacti-${version}|g" \ |
|---|
| 45 | ${workpath}/cacti-plugin-arch/cacti-plugin-0.8.7b-PA-v2.1.diff |
|---|
| 46 | system "cd ${worksrcpath} && patch -p1 -N < ${workpath}/cacti-plugin-arch/cacti-plugin-0.8.7b-PA-v2.1.diff" |
|---|
| 47 | file copy ${workpath}/cacti-plugin-arch/pa.sql \ |
|---|
| 48 | ${destroot}${cactidir} |
|---|
| 49 | } |
|---|
| 50 | |
|---|
| 51 | system "cp -R ${worksrcpath}/* ${destroot}${cactidir}" |
|---|
| 52 | } |
|---|
| 53 | |
|---|
| 54 | post-activate { |
|---|
| 55 | |
|---|
| 56 | ui_msg "\n **** To complete the Cacti installation **** |
|---|
| 57 | |
|---|
| 58 | To complete the Cacti installation follow the steps below. Read the documentation |
|---|
| 59 | at http://www.cacti.net/documentation.php for operational instructions. |
|---|
| 60 | |
|---|
| 61 | |
|---|
| 62 | 1) Install PHP and MySQL 5 (not covered). These instructions assume MySQL 5 was |
|---|
| 63 | installed from MacPorts. |
|---|
| 64 | |
|---|
| 65 | Check to make sure the PHP variable \"mysql.default_socket\" is set to path |
|---|
| 66 | ${prefix}/var/run/mysql5/mysqld.sock by viewing the output of this terminal command: |
|---|
| 67 | php -i |
|---|
| 68 | |
|---|
| 69 | If not, locate the php.ini file for your version of PHP and type the path there. |
|---|
| 70 | |
|---|
| 71 | |
|---|
| 72 | 2) Set Cacti permissions. |
|---|
| 73 | sudo chown -R <cacti-user>:<cacti-group> ${prefix}/share/${name}/ |
|---|
| 74 | |
|---|
| 75 | |
|---|
| 76 | 3) Setup MySQL and prepare it for Cacti. |
|---|
| 77 | Configure MySQL (new MySQL installs) |
|---|
| 78 | sudo -u mysql ${prefix}/lib/mysql5/bin/mysql_install_db |
|---|
| 79 | |
|---|
| 80 | Start MySQL: |
|---|
| 81 | sudo ${prefix}/share/mysql5/mysql/mysql.server start |
|---|
| 82 | |
|---|
| 83 | Set MySQL to start at system boot (optional) |
|---|
| 84 | sudo launchctl load -w /Library/LaunchDaemons/org.macports.mysql5.plist |
|---|
| 85 | |
|---|
| 86 | Set a root MySQL password. |
|---|
| 87 | Follow the instructions that were given after you executed 'mysql_install_db' above. |
|---|
| 88 | |
|---|
| 89 | Create a cacti MySQL user and cacti database. |
|---|
| 90 | mysql5 -u root -p (login with new root password when prompted) |
|---|
| 91 | mysql> grant CREATE,INSERT,SELECT,DELETE,UPDATE on cacti.* to cacti@localhost; |
|---|
| 92 | mysql> grant CREATE,INSERT,SELECT,DELETE,UPDATE on cacti.* to cacti; |
|---|
| 93 | mysql> SET PASSWORD FOR cacti@localhost = OLD_PASSWORD('<cactidb-pwd>'); |
|---|
| 94 | mysql> create database cacti; |
|---|
| 95 | mysql> exit; |
|---|
| 96 | |
|---|
| 97 | Import the cacti database. |
|---|
| 98 | sudo cat ${cactidir}/cacti.sql | mysql5 -u root -p cacti (cacti is the db name) |
|---|
| 99 | |
|---|
| 100 | Verify the Cacti Database. |
|---|
| 101 | mysql5 -u root -p |
|---|
| 102 | mysql> use cacti; |
|---|
| 103 | mysql> show tables; |
|---|
| 104 | mysql> exit; |
|---|
| 105 | |
|---|
| 106 | |
|---|
| 107 | 4) Edit ${cactidir}/include/config.php to match your MySQL information. |
|---|
| 108 | |
|---|
| 109 | \$database_type = \"mysql\"; |
|---|
| 110 | \$database_default = \"cacti\"; |
|---|
| 111 | \$database_hostname = \"localhost\"; |
|---|
| 112 | \$database_username = \"cacti\"; |
|---|
| 113 | \$database_password = \"<my-cacti-password>\"; |
|---|
| 114 | |
|---|
| 115 | |
|---|
| 116 | 5) Place a symlink for Cacti inside your Apache document root. |
|---|
| 117 | |
|---|
| 118 | ln -s ${cactidir} <Apache-docroot>/cacti |
|---|
| 119 | |
|---|
| 120 | |
|---|
| 121 | 6) Edit the Cacti user's crontab file. |
|---|
| 122 | sudo -u <cactiuser> crontab -e |
|---|
| 123 | |
|---|
| 124 | Insert the crontab entry below: |
|---|
| 125 | */5 * * * * ${prefix}/bin/php ${cactidir}/poller.php > /dev/null 2>&1 |
|---|
| 126 | |
|---|
| 127 | |
|---|
| 128 | 8) If you installed Cacti with the 'plugins' variant for Cacti Plugin Architecture support, |
|---|
| 129 | you must perform these additional steps. |
|---|
| 130 | |
|---|
| 131 | a) Import the PA schema. |
|---|
| 132 | cd ${cactidir} |
|---|
| 133 | sudo cat ${cactidir}/pa.sql | mysql5 -u root -p cacti (cacti is the db name) |
|---|
| 134 | |
|---|
| 135 | b) Download the particular Cacti plugin(s) you want and copy their folders to ${cactidir}/plugins/<plugin-dir>/. |
|---|
| 136 | For example: |
|---|
| 137 | ${cactidir}/plugins/weathermap/ |
|---|
| 138 | |
|---|
| 139 | c) Edit ${cactidir}/include/global.php - modify the url_path to reflect Cacti's default URL |
|---|
| 140 | and add an entry to load each plugin you install; the weathermap plugin is an example: |
|---|
| 141 | |
|---|
| 142 | \$config\['url_path'\] = '/cacti/'; |
|---|
| 143 | |
|---|
| 144 | \$plugins = array(); |
|---|
| 145 | \$plugins[] = 'weathermap'; |
|---|
| 146 | |
|---|
| 147 | d) Enable the plugin in the Cacti web interface; this creates a top-level tab for the plugin in the Cacti interface |
|---|
| 148 | Console -> User Management (select a Cacti user and check the 'View Weathermaps' checkboxes) |
|---|
| 149 | |
|---|
| 150 | |
|---|
| 151 | 7) Go to http://localhost/cacti/install/index.php. |
|---|
| 152 | The default user/password is admin/admin. Select 'New Install', enter |
|---|
| 153 | the paths for SNMP / RRDtool / PHP (see below), and click 'Finish'. |
|---|
| 154 | You may now use Cacti at http://localhost/cacti/index.php. |
|---|
| 155 | |
|---|
| 156 | Paths: |
|---|
| 157 | snmpwalk binary path: /usr/bin/snmpwalk |
|---|
| 158 | snmpget binary path: /usr/bin/snmpget |
|---|
| 159 | |
|---|
| 160 | RRDtool binary path: ${prefix}/bin/rrdtool |
|---|
| 161 | PHP binary path: ${prefix}/bin/php (if not using MacPorts PHP, use appropriate path) |
|---|
| 162 | |
|---|
| 163 | NOTE: After you login to Cacti, immediately click 'Settings' and set the RRDtool version to 1.2.x. |
|---|
| 164 | |
|---|
| 165 | |
|---|
| 166 | \n" |
|---|
| 167 | |
|---|
| 168 | } |
|---|