Cacti
| Ligne 1 : | Ligne 1 : | ||
| + | |||
| + | == DOC DE gentoo-wiki.com == | ||
| + | |||
| + | |||
| + | [[Image:cacti.png|right]] | ||
| + | == Getting Started == | ||
| + | Before installing cacti check for net-snmp package. | ||
| + | [[Cacti/SNMP host setup]] | ||
| + | |||
| + | You will probably need the following USE flags set: | ||
| + | |||
| + | USE = mysql xml sockets vhosts | ||
| + | |||
| + | For php to work correctly | ||
| + | |||
| + | You will probably need the following USE flags set: | ||
| + | |||
| + | USE = apache2 snmp vhosts | ||
| + | |||
| + | For cacti. | ||
| + | |||
| + | To install [[Cacti]] run the following command: | ||
| + | emerge cacti | ||
| + | |||
| + | This will install cacti onto your system. | ||
| + | |||
| + | If you already installed php, but without xml flag set, you should re-emerge php with USE="xml" first of all! | ||
| + | The same applies for the sockets flag. | ||
| + | |||
| + | NOTE: You have to run the command | ||
| + | webapp-config -I -h localhost -d cacti cacti <version #> | ||
| + | after you run the emerge. | ||
| + | |||
| + | == Config == | ||
| + | After installation you will need to edit the config file and insert the proper data to fit your installation | ||
| + | {{Box File|<path to cacti>include/config.php| | ||
| + | <pre> ... | ||
| + | $database_type = "mysql"; | ||
| + | $database_default = "cacti"; | ||
| + | $database_hostname = "localhost"; | ||
| + | $database_username = "cactiuser"; | ||
| + | $database_password = "cactipass"; | ||
| + | $database_port = "3306"; | ||
| + | ... </pre> | ||
| + | }} | ||
| + | |||
| + | == Install the database == | ||
| + | First you need to create a database named 'cacti' with a user named cactiuser | ||
| + | mysql -u root -p | ||
| + | mysql> create database cacti; | ||
| + | mysql> grant all on cacti.* to cactiuser@localhost; | ||
| + | mysql> set password for cactiuser@localhost=password('cactipass'); | ||
| + | mysql> exit | ||
| + | |||
| + | |||
| + | If this is a fresh installation of mysql you might get a message like "Can't connect to local MySQL server through Can't connect to local MySQL server through | ||
| + | socket ''/var/run/mysqld/mysqld.sock'' (2)" . Just run mysql_install_db | ||
| + | |||
| + | |||
| + | While in the cacti folder run this command to insert the default database | ||
| + | mysql -u cactiuser -p cacti < cacti.sql | ||
| + | |||
| + | Finish the configuration by accessing the cacti web page | ||
| + | http://url/to/cacti/ | ||
| + | |||
| + | Configure the required file paths. If you're going to login for the first time, | ||
| + | the password-username pair is admin-admin by default. | ||
| + | |||
| + | Set the permissions on the cacti directories to be able to generate the graph/log. Execute this command in the cacti folder. | ||
| + | chown -R apache:apache rra/ log/ | ||
| + | |||
| + | == Crontab == | ||
| + | as your cacti user add the following to the [[cron]] file | ||
| + | */5 * * * * apache php <cacti path>/cacti/poller.php > /dev/null 2>&1 | ||
| + | |||
| + | |||
| + | notice, under vixie cron you do not specify user account that the cronjob is ran, so you must use | ||
| + | */5 * * * * php <cacti path>/cacti/poller.php > /dev/null 2>&1 | ||
| + | |||
| + | == Troubleshooting == | ||
| + | If no graphs are generated and you receieve the following message in your cron logs, this indicates that an entry can not be found for the apache user in /etc/shadow. | ||
| + | <pre> | ||
| + | su: Authentication service cannot retrieve authentication info. | ||
| + | </pre> | ||
| + | This can be fixed by adding it with the following command: | ||
| + | <pre>pwconv</pre> | ||
| + | |||
| + | == More == | ||
| + | * [[Cacti]] | ||
| + | * [[Cacti/Installation]] | ||
| + | * [[Cacti/SNMP host setup]] | ||
| + | * [[Cacti/Hacking prevention]] | ||
| + | * http://cacti.net | ||
| + | |||
| + | {{subpage}} | ||
| + | |||
| + | |||
| + | |||
== Déplacer CACTI dans le serveur == | == Déplacer CACTI dans le serveur == | ||
Version du 3 avril 2008 à 16:27
Sommaire |
DOC DE gentoo-wiki.com
Getting Started
Before installing cacti check for net-snmp package.
Cacti/SNMP host setup
You will probably need the following USE flags set:
USE = mysql xml sockets vhosts
For php to work correctly
You will probably need the following USE flags set:
USE = apache2 snmp vhosts
For cacti.
To install Cacti run the following command:
emerge cacti
This will install cacti onto your system.
If you already installed php, but without xml flag set, you should re-emerge php with USE="xml" first of all! The same applies for the sockets flag.
NOTE: You have to run the command
webapp-config -I -h localhost -d cacti cacti <version #>
after you run the emerge.
Config
After installation you will need to edit the config file and insert the proper data to fit your installation Modèle:Box File
Install the database
First you need to create a database named 'cacti' with a user named cactiuser
mysql -u root -p
mysql> create database cacti;
mysql> grant all on cacti.* to cactiuser@localhost;
mysql> set password for cactiuser@localhost=password('cactipass');
mysql> exit
If this is a fresh installation of mysql you might get a message like "Can't connect to local MySQL server through Can't connect to local MySQL server through
socket /var/run/mysqld/mysqld.sock (2)" . Just run mysql_install_db
While in the cacti folder run this command to insert the default database
mysql -u cactiuser -p cacti < cacti.sql
Finish the configuration by accessing the cacti web page
http://url/to/cacti/
Configure the required file paths. If you're going to login for the first time, the password-username pair is admin-admin by default.
Set the permissions on the cacti directories to be able to generate the graph/log. Execute this command in the cacti folder.
chown -R apache:apache rra/ log/
Crontab
as your cacti user add the following to the cron file
*/5 * * * * apache php <cacti path>/cacti/poller.php > /dev/null 2>&1
notice, under vixie cron you do not specify user account that the cronjob is ran, so you must use
*/5 * * * * php <cacti path>/cacti/poller.php > /dev/null 2>&1
Troubleshooting
If no graphs are generated and you receieve the following message in your cron logs, this indicates that an entry can not be found for the apache user in /etc/shadow.
su: Authentication service cannot retrieve authentication info.
This can be fixed by adding it with the following command:
pwconv
More
Déplacer CACTI dans le serveur
Il faut en plus de copier les fichier refaire l'index des fichiers rra =>
php rebuild_poller_cache.php
Et ca JAZZ ensuite
Ajouter un user sur le serveur distant
net-snmp-config --create-snmpv3-user -a "my_password" my_user
Ouvrir le port 161 pour snmp
iptables -A INPUT -p udp --dport 161 -i eth0 -j ACCEPT