36 | | file mkdir ${destroot}${cactidir} |
37 | | system "cp -R ${worksrcpath}/* ${destroot}${cactidir}" |
| 50 | xinstall -d ${destroot}${cactidir} |
| 51 | system "cp -R ${worksrcpath}/* ${destroot}${cactidir}" |
| 52 | xinstall -d ${destroot}${prefix}/Library/LaunchDaemons/ |
| 53 | copy ${filespath}/org.macports.${name}.plist ${destroot}${prefix}/Library/LaunchDaemons/ |
| 54 | reinplace "s|%%PREFIX%%|${prefix}|g;s|%%CACTIDIR%%|${cactidir}|g" ${destroot}${prefix}/Library/LaunchDaemons/org.macports.${name}.plist |
| 55 | xinstall -d ${destroot}${prefix}/share/examples/${name} |
| 56 | move ${destroot}${cactidir}/include/config.php ${destroot}${prefix}/share/examples/${name}/ |
| 57 | move ${destroot}${cactidir}/include/global.php ${destroot}${prefix}/share/examples/${name}/ |
| 58 | copy ${filespath}/nginx-cacti.conf ${destroot}${prefix}/share/examples/${name}/ |
| 59 | reinplace "s|%%PREFIX%%|${prefix}|g" ${destroot}${prefix}/share/examples/${name}/nginx-cacti.conf |
| 60 | copy ${filespath}/mp-cacti.conf ${destroot}${prefix}/share/examples/${name}/ |
| 61 | reinplace "s|%%PREFIX%%|${prefix}|g" ${destroot}${prefix}/share/examples/${name}/mp-cacti.conf |
| 62 | xinstall -d -m 755 -o cactiuser ${destroot}${prefix}/var/log/${name} |
| 63 | |
| 64 | destroot.keepdirs ${destroot}${prefix}/var/log/${name} |
| 65 | } |
| 66 | |
| 67 | post-activate { |
| 68 | if ![file exists ${cactidir}/include/config.php ] { |
| 69 | copy ${prefix}/share/examples/${name}/config.php ${cactidir}/include/ |
| 70 | } |
| 71 | if ![file exists ${cactidir}/include/global.php ] { |
| 72 | copy ${prefix}/share/examples/${name}/global.php ${cactidir}/include/ |
| 73 | } |
| 74 | if { ! [file exists ${prefix}/etc/nginx/nginx-cacti.conf ] && [file exists ${prefix}/etc/nginx] } { |
| 75 | copy ${prefix}/share/examples/${name}/nginx-cacti.conf ${prefix}/etc/nginx/nginx-cacti.conf |
| 76 | } |
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 | | |
| 112 | mysql5 -u cacti -p cacti |
| 113 | mysql> show tables; |
| 114 | mysql> exit; |
| 115 | |
| 116 | |
| 117 | 4) If not existing, edit ${cactidir}/include/config.php to match your MySQL information and url path. |
| 118 | |
| 119 | \$database_type = \"mysql\"; |
| 120 | \$database_default = \"cacti\"; |
| 121 | \$database_hostname = \"localhost\"; |
| 122 | \$database_username = \"cacti\"; |
| 123 | \$database_password = \"<my-cactidb-pwd>\"; |
| 124 | |
| 125 | If using socket file, remember to check php.ini as said in 1) |
| 126 | |
| 127 | 5) Include in your webserver |
| 128 | If Apache, Place a symlink for Cacti inside your Apache document root. |
| 129 | # ln -s ${cactidir} <Apache-docroot>/cacti |
| 130 | If Nginx, include appropriate config. Example is included and copied |
| 131 | in ${prefix}/etc/nginx if existing |
| 132 | |
| 133 | |
| 134 | 6) Add poller.php scheduled task. A default plist has been installed to use w php55. |
| 135 | Adjust depending on your setup |
| 136 | # ln -s ${prefix}/Library/LaunchDaemons/org.macports.${name}.plist /Library/LaunchDaemons/ |
| 137 | # launchctl load -w /Library/LaunchDaemons/org.macports.${name}.plist |
| 138 | Poller log files are ${prefix}/var/log/cacti/poller*.log |
| 139 | You can enable log rotation by using template for system newsyslog |
| 140 | # 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 | | |
| 156 | The default user/password is admin/admin. Select 'New Install', enter |
| 157 | the paths for SNMP / RRDtool / PHP (adjusted to macports), and click 'Finish'. |
| 158 | You may now use Cacti at http://localhost/cacti/index.php. |
| 172 | |
| 173 | 10) If you want to use snmp on your mac, you can either use |
| 174 | * Apple default SNMP |
| 175 | # /usr/bin/snmpconf -g basic_setup |
| 176 | $ sudo launchctl load -w /System/Library/LaunchDaemons/org.net-snmp.snmpd.plist |
| 177 | * Macports |
| 178 | $ sudo port install net-snmp +server |
| 179 | # ${prefix}/bin/snmpconf -g basic_setup |
| 180 | # mv snmpd.conf ${prefix}/etc/ |
| 181 | $ sudo port load net-snmp |
| 182 | |
| 183 | " |
| 184 | |
| 185 | if {![variant_isset mysql5] && ![variant_isset mysql51] && ![variant_isset mysql55] && ![variant_isset mariadb] && ![variant_isset percona]} { |
| 186 | default_variants +mysql56 |
| 187 | } |
| 188 | |
| 189 | default_variants-append +superlinks |
| 190 | |
| 191 | ## http://wotsit.thingy.com/haj/cacti/superlinks-plugin.html |
| 192 | variant superlinks description { plugin superlinks } { |
| 193 | master_sites-append http://wotsit.thingy.com/haj/cacti/:superlinks |
| 194 | distfiles-append superlinks-0.8.zip:superlinks |
| 195 | checksums-append superlinks-0.8.zip \ |
| 196 | rmd160 880c639db183f1813d37dacec9f89c4dde988d5d \ |
| 197 | sha256 424b8e828306af0646f571aec92dad9c9b9910e49009d08634c41fbf6ff03597 |
| 198 | |
| 199 | post-extract { |
| 200 | system -W ${worksrcpath}/plugins "unzip ${distpath}/superlinks-0.8.zip" |
| 201 | } |
| 202 | } |
| 203 | |
| 204 | ## http://www.network-weathermap.com/manual/latest/pages/cacti-plugin.html |
| 205 | variant weathermap description { plugin weathermap } { |
| 206 | depends_lib-append port:pcre port:gd |
| 207 | master_files-append http://www.network-weathermap.com/files/:w |
| 208 | distfiles-append php-weathermap-0.97c.zip:w |
| 209 | |
| 210 | post-extract { |
| 211 | system -W ${worksrcpath}/plugins "unzip ${distpath}/php-weathermap-0.97c.zip" |
| 212 | } |
| 213 | destroot-append { |
| 214 | ## unpack in cactidir/plugins/weathermap |
| 215 | ## chown -R cactiuser cactidir/plugins/weathermap/output |
| 216 | } |
| 217 | |
| 218 | notes-append " |
| 219 | As a reminder, you will need php*-pcre php*-gd corresponding to your PHP release target. |
| 220 | You will need to enable the plugin in ${cactidir}/includes/config.php. Add the following line: |
| 221 | \$plugins\[\] = 'weathermap'; |
| 223 | } |
| 224 | |
| 225 | ## http://forums.cacti.net/viewtopic.php?p=173542#p173542 |
| 226 | variant advancedping description { template advancedping } { |
| 227 | depends_run-append port:fping |
| 228 | distfiles-append http://forums.cacti.net/download/file.php?id=18479 \ |
| 229 | http://forums.cacti.net/download/file.php?id=18480 |
| 230 | |
| 231 | reinplace "s|/usr/sbin/fping|${prefix}/sbin/fping|g" ss_fping.php |
| 232 | } |
| 233 | |
| 234 | ## include Mac template ? |
| 235 | |
| 236 | ## cpu snmp removed by apple. no but some random conditions can happen, it seems |
| 237 | ## http://macosx.com/forums/mac-os-x-system-mac-software/273289-net-snmp-cpu-stats.html |
| 238 | |
| 239 | variant mysql5 \ |
| 240 | conflicts mysql51 mysql55 mysql56 mariadb percona \ |
| 241 | description "Enable MySQL 5.1 support" { |
| 242 | |
| 243 | depends_lib-append port:mysql5 |
| 244 | } |
| 245 | |
| 246 | variant mysql51 \ |
| 247 | conflicts mysql5 mysql55 mysql56 mariadb percona \ |
| 248 | description "Enable MySQL 5.1 support" { |
| 249 | |
| 250 | depends_lib-append port:mysql51 |
| 251 | } |
| 252 | |
| 253 | variant mysql55 \ |
| 254 | conflicts mysql5 mysql51 mysql56 mariadb percona \ |
| 255 | description "Enable MySQL 5.5 support" { |
| 256 | |
| 257 | depends_lib-append port:mysql55 |
| 258 | } |
| 259 | |
| 260 | variant mysql56 \ |
| 261 | conflicts mysql5 mysql51 mysql55 mariadb percona \ |
| 262 | description "Enable MySQL 5.6 support" { |
| 263 | |
| 264 | depends_lib-append port:mysql56 |
| 265 | } |
| 266 | |
| 267 | variant mariadb \ |
| 268 | conflicts mysql5 mysql51 mysql55 mysql56 percona \ |
| 269 | description "Enable MariaDB (MySQL) support" { |
| 270 | |
| 271 | depends_lib-append port:mariadb |
| 272 | } |
| 273 | |
| 274 | variant percona \ |
| 275 | conflicts mysql5 mysql51 mysql55 mysql56 mariadb \ |
| 276 | description "Enable Percona (MySQL) support" { |
| 277 | depends_lib-append port:percona |
| 278 | } |
| 279 | |
| 280 | livecheck.type regex |
| 281 | livecheck.url ${homepage} |
| 282 | livecheck.regex "\">(\\d+(?:\\.\\d+\\w*)*)</a></strong></span>" |