Cacti: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
| (14 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt) | |||
| Zeile 2: | Zeile 2: | ||
==Prerequisites== | ==Prerequisites== | ||
*sudo apt update | *sudo apt update | ||
| − | ==Install Apache & MariaDB | + | ==Install== |
| + | ; #Apache & MariaDB | ||
*sudo apt install -y apache2 mariadb-server mariadb-client php-mysql libapache2-mod-php | *sudo apt install -y apache2 mariadb-server mariadb-client php-mysql libapache2-mod-php | ||
| − | + | ; #PHP Extensions | |
*sudo apt install -y php-xml php-ldap php-mbstring php-gd php-gmp | *sudo apt install -y php-xml php-ldap php-mbstring php-gd php-gmp | ||
| − | + | ; #snmp | |
*sudo apt install -y snmp php-snmp rrdtool librrds-perl | *sudo apt install -y snmp php-snmp rrdtool librrds-perl | ||
=Configuration= | =Configuration= | ||
| Zeile 12: | Zeile 13: | ||
*vi /etc/mysql/mariadb.conf.d/50-server.cnf | *vi /etc/mysql/mariadb.conf.d/50-server.cnf | ||
<pre> | <pre> | ||
| + | [mysqld] | ||
collation-server = utf8mb4_unicode_ci | collation-server = utf8mb4_unicode_ci | ||
max_heap_table_size = 128M | max_heap_table_size = 128M | ||
tmp_table_size = 64M | tmp_table_size = 64M | ||
| − | join_buffer_size = | + | join_buffer_size = 124M |
innodb_file_format = Barracuda | innodb_file_format = Barracuda | ||
innodb_large_prefix = 1 | innodb_large_prefix = 1 | ||
| − | innodb_buffer_pool_size = | + | innodb_buffer_pool_size = 1024M |
| + | innodb_buffer_pool_instances = 10 | ||
innodb_flush_log_at_timeout = 3 | innodb_flush_log_at_timeout = 3 | ||
innodb_read_io_threads = 32 | innodb_read_io_threads = 32 | ||
| Zeile 25: | Zeile 28: | ||
innodb_io_capacity_max = 10000 | innodb_io_capacity_max = 10000 | ||
</pre> | </pre> | ||
| + | ==Restart mariadb== | ||
| + | *systemctl restart mariadb | ||
| + | |||
==Set Timezone== | ==Set Timezone== | ||
*vi /etc/php/7.2/apache2/php.ini | *vi /etc/php/7.2/apache2/php.ini | ||
| Zeile 50: | Zeile 56: | ||
**flush privileges; | **flush privileges; | ||
**exit | **exit | ||
| + | =Install cacti= | ||
| + | *wget https://www.cacti.net/downloads/cacti-latest.tar.gz | ||
| + | *tar -zxvf cacti-latest.tar.gz | ||
| + | *sudo mv cacti-1* /opt/cacti | ||
| + | ==Import the default Cacti database== | ||
| + | *sudo mysql -u root -p cacti < /opt/cacti/cacti.sql | ||
| + | ==Cacti Config== | ||
| + | *vi /opt/cacti/include/config.php | ||
| + | <pre> | ||
| + | $database_type = "mysql"; | ||
| + | $database_default = "cacti"; | ||
| + | $database_hostname = "localhost"; | ||
| + | $database_username = "cactiuser"; | ||
| + | $database_password = "cactipassword"; | ||
| + | $database_port = "3306"; | ||
| + | $database_ssl = false; | ||
| + | </pre> | ||
| + | ==Edit the crontab file== | ||
| + | *vi /etc/cron.d/cacti | ||
| + | <pre> | ||
| + | */5 * * * * www-data php /opt/cacti/poller.php > /dev/null 2>&1 | ||
| + | </pre> | ||
| + | ==Apache Config== | ||
| + | *vi /etc/apache2/sites-available/cacti.conf | ||
| + | <pre> | ||
| + | Alias /cacti /opt/cacti | ||
| + | |||
| + | <Directory /opt/cacti> | ||
| + | Options +FollowSymLinks | ||
| + | AllowOverride None | ||
| + | <IfVersion >= 2.3> | ||
| + | Require all granted | ||
| + | </IfVersion> | ||
| + | <IfVersion < 2.3> | ||
| + | Order Allow,Deny | ||
| + | Allow from all | ||
| + | </IfVersion> | ||
| + | |||
| + | AddType application/x-httpd-php .php | ||
| + | |||
| + | <IfModule mod_php.c> | ||
| + | php_flag magic_quotes_gpc Off | ||
| + | php_flag short_open_tag On | ||
| + | php_flag register_globals Off | ||
| + | php_flag register_argc_argv On | ||
| + | php_flag track_vars On | ||
| + | # this setting is necessary for some locales | ||
| + | php_value mbstring.func_overload 0 | ||
| + | php_value include_path . | ||
| + | </IfModule> | ||
| + | |||
| + | DirectoryIndex index.php | ||
| + | </Directory> | ||
| + | |||
| + | </pre> | ||
| + | ==Enable and restart Apache2== | ||
| + | *a2ensite cacti | ||
| + | *systemctl restart apache2 | ||
| + | ==Create a log file and set Rights== | ||
| + | *sudo touch /opt/cacti/log/cacti.log | ||
| + | *sudo chown -R www-data:www-data /opt/cacti/ | ||
| + | ==Login== | ||
| + | *http://ip/cacti | ||
| + | *user: admin | ||
| + | *pass: admin | ||
| + | |||
| + | =Links= | ||
| + | *https://www.itzgeek.com/how-tos/linux/how-to-monitor-remote-linux-servers-with-cacti.html | ||
Aktuelle Version vom 26. Februar 2020, 21:19 Uhr
Install
Prerequisites
- sudo apt update
Install
- #Apache & MariaDB
- sudo apt install -y apache2 mariadb-server mariadb-client php-mysql libapache2-mod-php
- #PHP Extensions
- sudo apt install -y php-xml php-ldap php-mbstring php-gd php-gmp
- #snmp
- sudo apt install -y snmp php-snmp rrdtool librrds-perl
Configuration
Database Tuning
- vi /etc/mysql/mariadb.conf.d/50-server.cnf
[mysqld] collation-server = utf8mb4_unicode_ci max_heap_table_size = 128M tmp_table_size = 64M join_buffer_size = 124M innodb_file_format = Barracuda innodb_large_prefix = 1 innodb_buffer_pool_size = 1024M innodb_buffer_pool_instances = 10 innodb_flush_log_at_timeout = 3 innodb_read_io_threads = 32 innodb_write_io_threads = 16 innodb_io_capacity = 5000 innodb_io_capacity_max = 10000
Restart mariadb
- systemctl restart mariadb
Set Timezone
- vi /etc/php/7.2/apache2/php.ini
AND
- vi /etc/php/7.2/cli/php.ini
date.timezone = Europe/Berlin memory_limit = 512M max_execution_time = 60
Restart MariaDB
- sudo systemctl restart mariadb
Create Database
- sudo mysql -u root -p
- create database cacti;
- GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY 'cactipassword';
- flush privileges;
- exit
Importmysql_test_data_tiemzone
- sudo mysql -u root -p mysql < /usr/share/mysql/mysql_test_data_timezone.sql
Grant the permission to cactiuser
- sudo mysql -u root -p
- GRANT SELECT ON mysql.time_zone_name TO cactiuser@localhost;
- flush privileges;
- exit
Install cacti
- wget https://www.cacti.net/downloads/cacti-latest.tar.gz
- tar -zxvf cacti-latest.tar.gz
- sudo mv cacti-1* /opt/cacti
Import the default Cacti database
- sudo mysql -u root -p cacti < /opt/cacti/cacti.sql
Cacti Config
- vi /opt/cacti/include/config.php
$database_type = "mysql"; $database_default = "cacti"; $database_hostname = "localhost"; $database_username = "cactiuser"; $database_password = "cactipassword"; $database_port = "3306"; $database_ssl = false;
Edit the crontab file
- vi /etc/cron.d/cacti
*/5 * * * * www-data php /opt/cacti/poller.php > /dev/null 2>&1
Apache Config
- vi /etc/apache2/sites-available/cacti.conf
Alias /cacti /opt/cacti
<Directory /opt/cacti>
Options +FollowSymLinks
AllowOverride None
<IfVersion >= 2.3>
Require all granted
</IfVersion>
<IfVersion < 2.3>
Order Allow,Deny
Allow from all
</IfVersion>
AddType application/x-httpd-php .php
<IfModule mod_php.c>
php_flag magic_quotes_gpc Off
php_flag short_open_tag On
php_flag register_globals Off
php_flag register_argc_argv On
php_flag track_vars On
# this setting is necessary for some locales
php_value mbstring.func_overload 0
php_value include_path .
</IfModule>
DirectoryIndex index.php
</Directory>
Enable and restart Apache2
- a2ensite cacti
- systemctl restart apache2
Create a log file and set Rights
- sudo touch /opt/cacti/log/cacti.log
- sudo chown -R www-data:www-data /opt/cacti/
Login
- http://ip/cacti
- user: admin
- pass: admin