source: trunk/dports/net/cacti/Portfile @ 58230

Last change on this file since 58230 was 58230, checked in by ryandesign@…, 11 years ago

rewrite mysql5 dependency so mysql5-devel can satisfy it

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