|
|
| Author |
Message |
dreness
Joined: 02 Jan 2004 Posts: 7 Location: Cupertino, CA
|
Posted: Sun Nov 06, 2005 7:34 pm Post subject: cacti in Tiger Server |
|
|
Greetings,
I've written some cacti build intructions for Mac OS X and Mac OS X Server. For this writeup, I used 10.4.3.
The only nonstandard bits are:
-Using darwinports to get rrdtool + dependencies
UPDATE 1/10/06: The next two items are no longer required as of 10.4.4 server (disclaimed instructions still included provided below for older versions)
-Working around the php / mysql authentication problem by launching mysql with --old-passwords.
-Configuring php to find the mysql sock file which has moved since Panther.
Please let me know of any problems with the document, either here, there, or via dre at mac dot com.
Here are the revised build notes for Tiger.
Cacti in Tiger Server
Requires Mac OS X Server 10.4 (tested on 10.4.3)
Install XCode
Install and configure darwinports
| Code: | | PATH="/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/local/sbin:$PATH" |
Update the ports collection
| Code: | | sudo port -d selfupdate |
Install rrdtool from darwinports
| Code: | | sudo port install rrdtool |
This will install rrdtool and all of its dependencies for you.
Local user setup
Create a local cacti user with workgroup manager or the Accounts system preference pane. If you use workgroup manager, make sure you also create a home directory for the user.
In your Terminal window, su to this new user and then move to the cacti home directory | Code: | andre@casa[~]su cacti
Password:
casa:/Network/Servers/casa.dreness.com/Volumes/Server/andre cacti$ cd ~
casa:~ cacti$ |
Download cacti from http://www.cacti.net/download_cacti.php and decompress the archive
| Code: | casa:~ cacti$ curl -O http://www.cacti.net/downloads/cacti-0.8.6g.tar.gz
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1051k 100 1051k 0 0 184k 0 0:00:05 0:00:05 --:--:-- 216k
casa:~ cacti$ gunzip cacti-0.8.6g.tar.gz
casa:~ cacti$ tar -xf cacti-0.8.6g.tar
casa:~ cacti$ cd cacti-0.8.6g
casa:~/cacti-0.8.6g cacti$ |
Create a symlink to the cacti directory from the web document root (do this as an admin user) | Code: | | andre@casa[~]ln -s ~cacti/cacti-0.8.6g /Library/WebServer/Documents/cacti |
Inititalize MySQL
Use the MySQL Manager application to install and enable mysql. You do not need to enable network connections.
As an alternative to the MySQL Manager, do the following as an admin user: | Code: | sudo mysql_install_db
sudo chown -R mysql /var/mysql
sudo chmod +rx /var/mysql |
Edit /etc/hostconfig, adding
This next bit is only required prior to 10.4.4 server!
Configure MySQL to use old-style passwords by editing /System/Library/StartupItems/MySQL/MySQL. Change the mysqld_safe invocation in the StartService function to appear as follows | Code: | | /usr/bin/mysqld_safe --user=mysql ${OPTIONS} --old-passwords & |
The is required because the php libraries in Tiger don't know how to authenticate to mysql using the new style passwords. Reference: http://docs.info.apple.com/article.html?artnum=301456 and the fix in 10.4.4: http://docs.info.apple.com/article.html?artnum=302977
MySQL Configuration
| Code: | | sudo SystemStarter start MySQL |
Set the mysql root password | Code: | | sudo mysqladmin -u root password <new password> |
Create the cacti database | Code: | | mysqladmin --user=root -p create cacti |
Import the cacti database (as the cacti user while inside the cacti source folder) | Code: | | casa:~/cacti-0.8.6g cacti$ mysql -u root -p cacti < cacti.sql |
Create the cacti mysql user | Code: | mysql -u root -p mysql
GRANT ALL ON cacti.* TO cacti@localhost IDENTIFIED BY 'password'; |
Configure Apache and PHP
Enable the php module in Apache. This can be done either in the "Modules" portion of the Web settings in Server Admin, or by editing the /etc/httpd/httpd.conf file and uncommenting these two lines: | Code: | | LoadModule php4_module libexec/httpd/libphp4.so | and | Code: | | AddModule mod_php4.c |
Perform the following indented section prior to 10.4.4 Server only!
Configure php to find the mysql socket in Tiger. First copy in the default config file: | Code: | | sudo cp /etc/php.ini.default / etc/php.ini |
Now edit it to include a value for mysql.default_socket: | Code: | | mysql.default_socket = /var/mysql/mysql.sock |
Start the Web service using Server Admin, which will start Apache and configure it to start at system boot time.
As an alternative to Server Admin for enabling Apache:
start or restart apache using apachectl: | Code: | | sudo apachectl graceful |
Verify that apache will start at system boot time by editing /etc/hostconfig to include:
Cacti configuration
As your cacti user, while inside the cacti source directory, edit include/config.php to include the apporiate details for making mysql connections. e.g. | Code: | $database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cacti";
$database_password = "pass"; |
Configure the cacti user's crontab, as the cacti user. | Code: | | echo "*/5 * * * * php /Library/WebServer/Documents/cacti/poller.php > /dev/null 2>&1" | crontab |
Hit the cacti page and proceed with the web-based setup, e.g. http://casa.dreness.com/cacti/
Advance through the first screen, and at the next, choose "new install"
Change the binary location for rrdtool if necessary. It should be at /opt/local/bin/rrdtool
Once the setup is complete, log in as admin / admin and change password
Be sure to change the rrd tool version to 1.2.x in the Configuration --> Settings menu
Last edited by dreness on Tue Jan 10, 2006 9:05 pm; edited 1 time in total |
|
| Back to top |
|
 |
Linegod Developer
Joined: 20 Feb 2003 Posts: 911 Location: Canada
|
Posted: Sat Nov 12, 2005 10:24 am Post subject: |
|
|
Just adding a note so I can find this when I'm redoing the documentation.
Good work.... |
|
| Back to top |
|
 |
dreness
Joined: 02 Jan 2004 Posts: 7 Location: Cupertino, CA
|
Posted: Tue Jan 10, 2006 9:07 pm Post subject: |
|
|
| Linegod wrote: | Just adding a note so I can find this when I'm redoing the documentation.
Good work.... |
Thanks!
10.4.4 Server contains fixes for two of the 'nonstandard bits'. I've updated the article and retained the instructions for 10.4 - 10.4.3 users. Here is the reference for the fixed items in 10.4.4 Server:
http://docs.info.apple.com/article.html?artnum=302977 |
|
| Back to top |
|
 |
justdelegard
Joined: 16 Mar 2006 Posts: 2
|
Posted: Mon Mar 20, 2006 12:17 pm Post subject: |
|
|
I have followed your instructions, but still cannot get it to work on my mac os x 10.4.4 server box. The rra files just don't appear and I don't know why.
I have posted about this previously here, but no one answered me! |
|
| Back to top |
|
 |
|
Powered by phpBB © 2001, 2005 phpBB Group
|
|