36 | | file mkdir ${destroot}${cactidir} |
37 | | system "cp -R ${worksrcpath}/* ${destroot}${cactidir}" |
| 46 | xinstall -d ${destroot}${cactidir} |
| 47 | system "cp -R ${worksrcpath}/* ${destroot}${cactidir}" |
| 48 | xinstall -d ${destroot}${prefix}/Library/LaunchAgents/ |
| 49 | copy ${filespath}/org.macports.${name}.plist ${destroot}${prefix}/Library/LaunchAgents/ |
| 50 | reinplace "s|%%PREFIX%%|${prefix}|g;s|%%CACTIDIR%%|${cactidir}|g" ${destroot}${prefix}/Library/LaunchAgents/org.macports.${name}.plist |
| 51 | xinstall -d ${destroot}${prefix}/share/examples/${name} |
| 52 | move ${destroot}${cactidir}/include/config.php ${destroot}${prefix}/share/examples/${name}/ |
| 53 | move ${destroot}${cactidir}/include/global.php ${destroot}${prefix}/share/examples/${name}/ |
| 54 | copy ${filespath}/nginx-cacti.conf ${destroot}${prefix}/share/examples/${name}/ |
| 55 | reinplace "s|%%PREFIX%%|${prefix}|g" ${destroot}${prefix}/share/examples/${name}/nginx-cacti.conf |
| 56 | copy ${filespath}/mp-cacti.conf ${destroot}${prefix}/share/examples/${name}/ |
| 57 | reinplace "s|%%PREFIX%%|${prefix}|g" ${destroot}${prefix}/share/examples/${name}/mp-cacti.conf |
| 58 | xinstall -d -m 755 -o cactiuser ${destroot}${prefix}/var/log/${name} |
| 59 | |
| 60 | destroot.keepdirs ${destroot}${prefix}/var/log/${name} |
| 61 | } |
| 62 | |
| 63 | post-activate { |
| 64 | if ![file exists ${cactidir}/include/config.php ] { |
| 65 | copy ${prefix}/share/examples/${name}/config.php ${cactidir}/include/ |
| 66 | } |
| 67 | if ![file exists ${cactidir}/include/global.php ] { |
| 68 | copy ${prefix}/share/examples/${name}/global.php ${cactidir}/include/ |
| 69 | } |
| 70 | if { ! [file exists ${prefix}/etc/nginx/nginx-cacti.conf ] && [file exists ${prefix}/etc/nginx] } { |
| 71 | copy ${prefix}/share/examples/${name}/nginx-cacti.conf ${prefix}/etc/nginx/nginx-cacti.conf |
| 72 | } |
60 | | |
61 | | 3) Setup MySQL and prepare it for Cacti. |
62 | | Configure MySQL (new MySQL installs) |
63 | | sudo -u mysql ${prefix}/lib/mysql5/bin/mysql_install_db |
64 | | |
65 | | Start MySQL: |
66 | | sudo ${prefix}/share/mysql5/mysql/mysql.server start |
67 | | |
68 | | Set MySQL to start at system boot |
69 | | sudo launchctl load -w /Library/LaunchDaemons/org.macports.mysql5.plist |
70 | | |
71 | | Set a root MySQL password. |
72 | | Follow the instructions that were given after you executed 'mysql_install_db' above. |
| 94 | 3) prepare MySQL for Cacti. |
86 | | mysql5 -u root -p |
87 | | mysql> use cacti; |
88 | | mysql> show tables; |
89 | | mysql> exit; |
90 | | |
91 | | |
92 | | 4) Edit ${cactidir}/include/config.php to match your MySQL information and url path. |
93 | | |
94 | | \$database_type = \"mysql\"; |
95 | | \$database_default = \"cacti\"; |
96 | | \$database_hostname = \"localhost\"; |
97 | | \$database_username = \"cacti\"; |
98 | | \$database_password = \"<my-cactidb-pwd>\"; |
99 | | |
100 | | |
101 | | 5) Place a symlink for Cacti inside your Apache document root. |
102 | | |
103 | | ln -s ${cactidir} <Apache-docroot>/cacti |
104 | | |
105 | | |
106 | | 6) Edit the Cacti user's crontab file. |
107 | | sudo -u <cactiuser> crontab -e |
108 | | |
109 | | Insert the crontab entry below: |
110 | | */5 * * * * ${prefix}/bin/php ${cactidir}/poller.php > /dev/null 2>&1 |
111 | | |
| 108 | mysql5 -u cacti -p cacti |
| 109 | mysql> show tables; |
| 110 | mysql> exit; |
| 111 | |
| 112 | |
| 113 | 4) If not existing, edit ${cactidir}/include/config.php to match your MySQL information and url path. |
| 114 | |
| 115 | \$database_type = \"mysql\"; |
| 116 | \$database_default = \"cacti\"; |
| 117 | \$database_hostname = \"localhost\"; |
| 118 | \$database_username = \"cacti\"; |
| 119 | \$database_password = \"<my-cactidb-pwd>\"; |
| 120 | |
| 121 | If using socket file, remember to check php.ini as said in 1) |
| 122 | |
| 123 | 5) Include in your webserver |
| 124 | If Apache, Place a symlink for Cacti inside your Apache document root. |
| 125 | # ln -s ${cactidir} <Apache-docroot>/cacti |
| 126 | If Nginx, include appropriate config. Example is included and copied |
| 127 | in ${prefix}/etc/nginx if existing |
| 128 | |
| 129 | |
| 130 | 6) Add poller.php scheduled task. A default plist has been installed to use w php55. |
| 131 | Adjust depending on your setup |
| 132 | # ln -s ${prefix}/Library/LaunchAgents/org.macports.${name}.plist /Library/LaunchAgents/ |
| 133 | # launchctl load -w /Library/LaunchAgents/org.macports.${name}.plist |
| 134 | Poller log files are ${prefix}/var/log/cacti/poller*.log |
| 135 | You can enable log rotation by using template for system newsyslog |
| 136 | # cp ${prefix}/share/examples/${name}/mp-cacti.conf /private/etc/newsyslog.d/ |
127 | | The default user/password is admin/admin. Select 'New Install', enter |
128 | | the paths for SNMP / RRDtool / PHP (see below), and click 'Finish'. |
129 | | You may now use Cacti at http://localhost/cacti/index.php. |
130 | | |
131 | | Verify paths: |
132 | | snmpwalk binary path: /usr/bin/snmpwalk |
133 | | snmpget binary path: /usr/bin/snmpget |
134 | | |
135 | | RRDtool binary path: ${prefix}/bin/rrdtool |
136 | | PHP binary path: ${prefix}/bin/php (if not using MacPorts PHP, use appropriate path) |
137 | | |
| 152 | The default user/password is admin/admin. Select 'New Install', enter |
| 153 | the paths for SNMP / RRDtool / PHP (adjusted to macports), and click 'Finish'. |
| 154 | You may now use Cacti at http://localhost/cacti/index.php. |
| 179 | |
| 180 | if {![variant_isset mysql5] && ![variant_isset mysql51] && ![variant_isset mysql55] && ![variant_isset mariadb] && ![variant_isset percona]} { |
| 181 | default_variants +mysql56 |
| 182 | } |
| 183 | |
| 184 | default_variants-append +superlinks |
| 185 | |
| 186 | ## http://wotsit.thingy.com/haj/cacti/superlinks-plugin.html |
| 187 | variant superlinks description { plugin superlinks } { |
| 188 | distfiles-append http://wotsit.thingy.com/haj/cacti/superlinks-0.8.zip |
| 189 | # post-patch { |
| 190 | # system "cd ${worksrcpath}/plugins && unzip ${distpath}/superlinks-0.8.zip" |
| 191 | # } |
| 192 | } |
| 193 | |
| 194 | ## http://www.network-weathermap.com/manual/latest/pages/cacti-plugin.html |
| 195 | variant weathermap description { plugin weathermap } { |
| 196 | depends_lib-append port:pcre port:gd |
| 197 | distfiles-append http://www.network-weathermap.com/files/php-weathermap-0.97c.zip |
| 198 | |
| 199 | destroot-append { |
| 200 | ## unpack in cactidir/plugins/weathermap |
| 201 | ## chown -R cactiuser cactidir/plugins/weathermap/output |
| 202 | } |
| 203 | |
| 204 | notes-append " |
| 205 | As a reminder, you will need php*-pcre php*-gd corresponding to your PHP release target. |
| 206 | You will need to enable the plugin in ${cactidir}/includes/config.php. Add the following line: |
| 207 | \$plugins\[\] = 'weathermap'; |
| 208 | " |
| 209 | } |
| 210 | |
| 211 | ## http://forums.cacti.net/viewtopic.php?p=173542#p173542 |
| 212 | variant advancedping description { template advancedping } { |
| 213 | depends_run-append port:fping |
| 214 | distfiles-append http://forums.cacti.net/download/file.php?id=18479 \ |
| 215 | http://forums.cacti.net/download/file.php?id=18480 |
| 216 | |
| 217 | reinplace "s|/usr/sbin/fping|${prefix}/sbin/fping|g" ss_fping.php |
| 218 | } |
| 219 | |
| 220 | ## include Mac template ? |
| 221 | |
| 222 | ## cpu snmp removed by apple. no but some random conditions can happen, it seems |
| 223 | ## http://macosx.com/forums/mac-os-x-system-mac-software/273289-net-snmp-cpu-stats.html |
| 224 | |
| 225 | variant mysql5 \ |
| 226 | conflicts mysql51 mysql55 mysql56 mariadb percona \ |
| 227 | description "Enable MySQL 5.1 support" { |
| 228 | |
| 229 | depends_lib-append port:mysql5 |
| 230 | } |
| 231 | |
| 232 | variant mysql51 \ |
| 233 | conflicts mysql5 mysql55 mysql56 mariadb percona \ |
| 234 | description "Enable MySQL 5.1 support" { |
| 235 | |
| 236 | depends_lib-append port:mysql51 |
| 237 | } |
| 238 | |
| 239 | variant mysql55 \ |
| 240 | conflicts mysql5 mysql51 mysql56 mariadb percona \ |
| 241 | description "Enable MySQL 5.5 support" { |
| 242 | |
| 243 | depends_lib-append port:mysql55 |
| 244 | } |
| 245 | |
| 246 | variant mysql56 \ |
| 247 | conflicts mysql5 mysql51 mysql55 mariadb percona \ |
| 248 | description "Enable MySQL 5.6 support" { |
| 249 | |
| 250 | depends_lib-append port:mysql56 |
| 251 | } |
| 252 | |
| 253 | variant mariadb \ |
| 254 | conflicts mysql5 mysql51 mysql55 mysql56 percona \ |
| 255 | description "Enable MariaDB (MySQL) support" { |
| 256 | |
| 257 | depends_lib-append port:mariadb |
| 258 | } |
| 259 | |
| 260 | variant percona \ |
| 261 | conflicts mysql5 mysql51 mysql55 mysql56 mariadb \ |
| 262 | description "Enable Percona (MySQL) support" { |
| 263 | depends_lib-append port:percona |
| 264 | } |
| 265 | |